FIX_IGR Draft Chnages
This commit is contained in:
parent
2abe812f88
commit
873a206fa7
@ -143,6 +143,7 @@ define('REQ_DELIVERED','ST050');
|
||||
/* IGR Status */
|
||||
define('IGR_CREATED','ST027');
|
||||
define('IGR_CLOSED','ST028');
|
||||
define('IGR_DRAFT','ST074');
|
||||
define('IGR_CANCELLED','ST029');
|
||||
define('POLINEITEM_IGRPARTIAL_CREATED','ST042');
|
||||
|
||||
|
||||
@ -259,6 +259,8 @@ $routes->post('inwardgateregister/ViewIGRfile', 'Inwardgateregister::ViewIGRfile
|
||||
$routes->post('inwardgateregister/ViewIGR', 'Inwardgateregister::ViewIGR');
|
||||
$routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituploadfile');
|
||||
$routes->post('inwardgateregister/addloadfile', 'Inwardgateregister::addloadfile');
|
||||
$routes->post('inwardgateregister/UpdateIGR', 'Inwardgateregister::UpdateIGR');
|
||||
$routes->post('inwardgateregister/updateIGRLineItem', 'Inwardgateregister::updateIGRLineItem');
|
||||
|
||||
// Application OGR Page
|
||||
$routes->match(['get', 'post', 'put', 'delete'],'AddOgr', 'Inwardgateregister::addoutwardgateregister');
|
||||
|
||||
@ -304,7 +304,8 @@ class Inwardgateregister extends BaseController
|
||||
$CreatedBy = $this->session->get('userId');
|
||||
$RowCount = $this->request->getPost('txtRowCount');
|
||||
$createddt = get_current_date_time();
|
||||
$IGRStatus = IGR_CREATED;
|
||||
//$IGRStatus = IGR_CREATED;//old
|
||||
$IGRStatus = (int)$this->request->getPost('hideIGRStatus') == 1 ? IGR_CREATED : IGR_DRAFT;
|
||||
$document = null;
|
||||
$igr = array(); // For IGR Master
|
||||
$paymentstatus = NO_PAIDIGR;
|
||||
@ -376,7 +377,7 @@ class Inwardgateregister extends BaseController
|
||||
}
|
||||
|
||||
#Step 3 Updating OGR Details
|
||||
$OGRStatus = IGR_CREATED;
|
||||
$OGRStatus = $IGRStatus;
|
||||
$check_OGRPO = $this->inwardgateregister_model->update_OGR($PONO, $OGRStatus);
|
||||
// echo "step3";
|
||||
// echo "uuu".(int)$check_OGRPO;
|
||||
@ -401,7 +402,7 @@ class Inwardgateregister extends BaseController
|
||||
$Remarks = $this->request->getPost('txtRemarks' . $i);
|
||||
$ItemStatus = '';
|
||||
if ($PendingQty == 0.00) {
|
||||
$ItemStatus = IGR_CREATED;
|
||||
$ItemStatus = $IGRStatus;
|
||||
} else {
|
||||
$ItemStatus = POLINEITEM_IGRPARTIAL_CREATED;
|
||||
}
|
||||
@ -446,7 +447,193 @@ class Inwardgateregister extends BaseController
|
||||
|
||||
#Step 6 Updating Pending Quantity IN PO Master amd Line Item Details.
|
||||
if ($TotalPendingQty == 0.00) {
|
||||
$Newstatus = array('Status' => IGR_CREATED);
|
||||
$Newstatus = array('Status' => $IGRStatus);
|
||||
$this->inwardgateregister_model->POLineItemsupdatestatus($PONO, $Newstatus);
|
||||
$this->inwardgateregister_model->pomasterupdatestatus($PONO, $Newstatus);
|
||||
} else {
|
||||
/*echo 'error' ;*/
|
||||
}
|
||||
#finally
|
||||
$finalstatement = "Successfully Created IGR Number: $IGRNO \n";
|
||||
if ($fileupdated_count > 0) {
|
||||
$finalstatement .= "Number of files updated: $fileupdated_count \n";
|
||||
$finalstatement .= "Files: \n " . implode('\n ', $fileupdated_name);
|
||||
} else {
|
||||
$finalstatement .= "No files to update";
|
||||
}
|
||||
} else {
|
||||
$finalstatement = 'No data available to process IGR.';
|
||||
}
|
||||
|
||||
// Escape newlines and quotes for the JavaScript alert
|
||||
$finalstatement = json_encode($finalstatement);
|
||||
|
||||
|
||||
echo "<script>
|
||||
alert('$finalstatement');
|
||||
window.location.href='viewIGRDetails';
|
||||
</script>";
|
||||
|
||||
}
|
||||
|
||||
function addNewigr1()
|
||||
{
|
||||
#Step 1 IGR Details
|
||||
$PONO = $this->request->getPost('PONO');
|
||||
$DeliveryChellanOrInvoiceNo = $this->request->getPost('InvoiceNo');
|
||||
$DeliveryChellan = (string)$this->request->getPost('InvoiceDate');
|
||||
$DeliveryChellanDate = get_date_time_format($DeliveryChellan);
|
||||
$Mat_Rcvd_Dt = (string)$this->request->getPost('MaterialRcvdDate');
|
||||
$MaterialRcvdDt = get_date_time_format($Mat_Rcvd_Dt);
|
||||
$VehicleNo = $this->request->getPost('VehicleNo');
|
||||
$DriverName = $this->request->getPost('DriverName');
|
||||
$DriverMobileNumber = $this->request->getPost('DriverMobileNumber');
|
||||
$CreatedBy = $this->session->get('userId');
|
||||
$RowCount = $this->request->getPost('txtRowCount');
|
||||
$createddt = get_current_date_time();
|
||||
$IGRStatus = (int)$this->request->getPost('hideIGRStatus') == 1 ? IGR_CREATED : IGR_DRAFT;
|
||||
$document = null;
|
||||
$igr = array(); // For IGR Master
|
||||
$paymentstatus = NO_PAIDIGR;
|
||||
$constant = $this->request->getPost('hideconstants');
|
||||
$arr = []; // For File to Save
|
||||
$prefile = array();
|
||||
$fileupdated_count = 0;
|
||||
$fileupdated_name = [];
|
||||
|
||||
$igr = array('PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus);
|
||||
//Saving IGR details Here
|
||||
$IGRNO = $this->inwardgateregister_model->addigrM($igr);
|
||||
if($IGRNO){
|
||||
#Step 2 File Details Gathering
|
||||
if($constant){
|
||||
for ($i = 1; $i <= $constant; $i++) {
|
||||
$pathname = 'browseFiles' . $i;
|
||||
$file = $this->request->getFile($pathname);
|
||||
if ($file && $file->isValid()) {
|
||||
$requestfilename = $file->getName();
|
||||
if (!empty($requestfilename)) {
|
||||
|
||||
$files = str_replace(" ", "", $_FILES[$pathname]['name']);
|
||||
$fcount = 0;
|
||||
|
||||
foreach ($prefile as $value) {
|
||||
if ($value == $files) { $fcount++; }
|
||||
}
|
||||
|
||||
if ($fcount == 0) {
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
$path = ROOTPATH.'public/uploads/Igrfiles/';
|
||||
if(!is_dir($path)) { mkdir($path, 0777, true); }
|
||||
$Picture = $file->getName();
|
||||
$file->move($path,$Picture);
|
||||
log_message('error', "File new" . $i . " uploaded successfully. File name: " . $requestfilename);
|
||||
}
|
||||
$arr[] = array($Picture);
|
||||
}
|
||||
|
||||
$prefile[] = $files;
|
||||
}
|
||||
|
||||
} else {
|
||||
log_message('error', "No file uploaded for new" . $i . " or there was an error uploading the file.");
|
||||
}
|
||||
}
|
||||
#Step 2.1 Saving File Details
|
||||
if (!empty($arr)) {
|
||||
foreach ($arr as $ma) {
|
||||
$index = 0;
|
||||
foreach ($ma as $key => $value) {
|
||||
$index++;
|
||||
if ($index == 1) {
|
||||
$filename = $value;
|
||||
}
|
||||
}
|
||||
if (!empty($filename)) {
|
||||
|
||||
$myfile = array('FilePath' => $filename, 'PONO' => $PONO, 'IGRNO' => $IGRNO);
|
||||
$fileupdated = $this->inwardgateregister_model->fileupload($myfile);
|
||||
if ($fileupdated) {
|
||||
$fileupdated_count++;
|
||||
$fileupdated_name[] = $filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Step 3 Updating OGR Details
|
||||
$OGRStatus = $IGRStatus;
|
||||
$check_OGRPO = $this->inwardgateregister_model->update_OGR($PONO, $OGRStatus);
|
||||
// echo "step3";
|
||||
// echo "uuu".(int)$check_OGRPO;
|
||||
$IGRItemStatus = REQITEM_NEW;
|
||||
$TotalPendingQty = '';
|
||||
$TotalPendingQty = (int)$TotalPendingQty;
|
||||
// echo "step4";
|
||||
#Step 4 To Update the Date PO MASTER , Material Master , Historydetails and IGR line Item Details Updating OGR Details
|
||||
for ($i = 1; $i <= (int)$RowCount; $i++) {
|
||||
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
|
||||
$MaterialCode = $MaterialCode !== null && is_string($MaterialCode) ? trim($MaterialCode) : null;
|
||||
$QuantityAsPerInvoice = $this->request->getPost('txtQuantityAsPerInvoice' . $i);
|
||||
$QuantityAsPerInvoice = $QuantityAsPerInvoice !== null && is_string($QuantityAsPerInvoice) ? trim($QuantityAsPerInvoice) : null;
|
||||
$OrderedQuantity = $this->request->getPost('OrderedQuantity' . $i);
|
||||
$OrderedQuantity = $OrderedQuantity !== null && is_string($OrderedQuantity) ? trim($OrderedQuantity) : null;
|
||||
$ReceivedQty = $this->request->getPost('txtReceivedQuantity' . $i);
|
||||
$ReceivedQty = $ReceivedQty !== null && is_string($ReceivedQty) ? trim($ReceivedQty) : null;
|
||||
$PendingQty = $this->request->getPost('txtPendingQty' . $i);
|
||||
$TotalPendingQty = $TotalPendingQty + $PendingQty;
|
||||
|
||||
if (strlen($QuantityAsPerInvoice) > 0 && $QuantityAsPerInvoice != '0') {
|
||||
$Remarks = $this->request->getPost('txtRemarks' . $i);
|
||||
$ItemStatus = '';
|
||||
if ($PendingQty == 0.00) {
|
||||
$ItemStatus = $IGRStatus;
|
||||
} else {
|
||||
$ItemStatus = POLINEITEM_IGRPARTIAL_CREATED;
|
||||
}
|
||||
|
||||
$CreatedBy = $this->session->get('userId');
|
||||
$igrDetails = array('IGRNO' => $IGRNO, 'MaterialCode' => $MaterialCode, 'QuantityAsPerInvoice' => $QuantityAsPerInvoice, 'Remarks' => $Remarks, 'IGRItemStatus' => $IGRItemStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt);
|
||||
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
|
||||
$igrlineno = !empty($igrD) ? $igrD : '';
|
||||
$itemvalue = '';
|
||||
$SupplierId = '';
|
||||
$polineitemvalue = $this->inwardgateregister_model->getitemvalue($PONO, $MaterialCode);
|
||||
foreach ($polineitemvalue as $it) {
|
||||
$itemvalue = $it->Rate;
|
||||
$SupplierId = $it->SupplierID;
|
||||
}
|
||||
$historydetails = array('MaterialCode' => $MaterialCode, 'Transaction_type' => "Add", 'Ref_Type' => "IGR", 'Ref_No' => $igrlineno, 'Quantity' => $QuantityAsPerInvoice, 'CreatedBy' => $CreatedBy, 'CreatedOn' => $createddt, 'SupplierID' => $SupplierId, 'ItemValue' => $itemvalue);
|
||||
$this->inwardgateregister_model->addmaterialhistory($historydetails);
|
||||
$get_pre_qty = $this->inwardgateregister_model->get_CurrentQty($MaterialCode);
|
||||
$av_qty = 0;
|
||||
if (!empty($get_pre_qty)) {
|
||||
foreach ($get_pre_qty as $gt) {
|
||||
$av_qty = $gt->Current_stock;
|
||||
}
|
||||
}
|
||||
$currentav_qty = $QuantityAsPerInvoice + $av_qty;
|
||||
$current_qty = array('Current_stock' => $currentav_qty);
|
||||
$this->inwardgateregister_model->addmaterialmaster($current_qty, $MaterialCode);
|
||||
$Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO, $MaterialCode);
|
||||
$ReceivedQuantity = 0.00;
|
||||
if (count($Recqty) > 0) {
|
||||
foreach ($Recqty as $key) {
|
||||
$ReceivedQuantity = $key->ReceivedQuantity;
|
||||
}
|
||||
}
|
||||
$totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice;
|
||||
$POLineItem = array('ReceivedQuantity' => $totalReceivedqty, 'Status' => $ItemStatus, 'UpdateBY' => $CreatedBy, 'UpdatedOn' => $createddt);
|
||||
$this->inwardgateregister_model->UpdatePOLineItem($POLineItem, $PONO, $MaterialCode);
|
||||
}
|
||||
}
|
||||
|
||||
$this->inwardgateregister_model->UpdatePOMaster($PONO, $CreatedBy);
|
||||
|
||||
#Step 6 Updating Pending Quantity IN PO Master amd Line Item Details.
|
||||
if ($TotalPendingQty == 0.00) {
|
||||
$Newstatus = array('Status' => $IGRStatus);
|
||||
$this->inwardgateregister_model->POLineItemsupdatestatus($PONO, $Newstatus);
|
||||
$this->inwardgateregister_model->pomasterupdatestatus($PONO, $Newstatus);
|
||||
} else {
|
||||
@ -508,11 +695,7 @@ echo "<script>
|
||||
|
||||
$updateby = $this->session->get('userId');
|
||||
|
||||
|
||||
$updatedon = get_date_time_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);
|
||||
|
||||
$data = $this->inwardgateregister_model->updateigr($igrarr, $IGRNo);
|
||||
|
||||
@ -522,6 +705,57 @@ echo "<script>
|
||||
echo "Not Updated!";
|
||||
}
|
||||
}
|
||||
function updateIGRLineItem() {
|
||||
$IGRNo = $this->request->getPost('igr');
|
||||
$Status = $this->request->getPost('status');
|
||||
$requestdata = $this->request->getPost('data');
|
||||
$updateby = $this->session->get('userId');
|
||||
|
||||
// Check if request data is not null and is a string
|
||||
if (is_string($requestdata)) {
|
||||
$lineitemdata = json_decode($requestdata, true); // Decode JSON data
|
||||
|
||||
if (is_array($lineitemdata)) {
|
||||
$igrarr = array('IGRStatus' => $Status, 'UpdateBY' => $updateby);
|
||||
$masterdata = $this->inwardgateregister_model->updateigr($igrarr, $IGRNo);
|
||||
$dummy = 0;
|
||||
$i=1;
|
||||
|
||||
foreach ($lineitemdata as $item) {
|
||||
$IGRNO = $item['IGRNO'.$i];
|
||||
$IGRItemNo = $item['IGRItemNo'.$i];
|
||||
$MaterialCode = $item['MaterialCode'.$i];
|
||||
$QuantityAsPerInvoice = $item['txtQuantityAsPerInvoice'.$i];
|
||||
$Remarks = $item['txtRemarks'.$i];
|
||||
|
||||
$igrline = array(
|
||||
'IGRNO' => $IGRNO,
|
||||
'MaterialCode' => $MaterialCode,
|
||||
'IGRItemNo' => $IGRItemNo,
|
||||
'QuantityAsPerInvoice' => $QuantityAsPerInvoice,
|
||||
'Remarks' => $Remarks,
|
||||
'UpdateBY' => $updateby
|
||||
);
|
||||
// print_r($igrline);
|
||||
$lineitemdata = $this->inwardgateregister_model->updateIGRLineItem($igrline, $IGRItemNo);
|
||||
$i++;
|
||||
if ($lineitemdata > 0) {
|
||||
$dummy++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($dummy > 0) {
|
||||
echo json_encode(array('message' => 'Updated Successfully!'));
|
||||
} else {
|
||||
echo json_encode(array('message' => 'Not Updated!'));
|
||||
}
|
||||
} else {
|
||||
echo json_encode(array('message' => 'Invalid data format!'));
|
||||
}
|
||||
} else {
|
||||
echo json_encode(array('message' => 'Invalid request data!'));
|
||||
}
|
||||
}
|
||||
|
||||
function AddOgr()
|
||||
{
|
||||
|
||||
@ -99,7 +99,7 @@ class Inwardgateregister_model extends Model
|
||||
{
|
||||
|
||||
$builder = $this->db->table('T_IGR_Master igr')
|
||||
->select('igr.*,PO.DeliveryDate,sup.SupplierName,fileup.FilePath,igr.file')
|
||||
->select('igr.*,PO.DeliveryDate,sup.SupplierName,fileup.FilePath,igr.file,PO.POType')
|
||||
->join('T_PurchaseOrder_Master PO', 'igr.PONO = PO.PONO')
|
||||
->join('T_Inwardgateregister_fileupload fileup', ' igr.IGRNO = fileup.IGRNO', 'left')
|
||||
->join('T_SupplierDetailsN` sup', 'PO.SupplierID = sup.SupplierID')
|
||||
@ -145,7 +145,7 @@ class Inwardgateregister_model extends Model
|
||||
{
|
||||
|
||||
$builder = $this->db->table('T_PurchaseOrder_Master POM')
|
||||
->distinct()->select('POM.PONO,POM.ServiceDescription,POM.DeliveryDate,sup.SupplierName,sup.Address,POM.status,OGR_Status,POM.PODate,POM.IsOpenOrder,POM.CreatedDate')
|
||||
->distinct()->select('POM.PONO,POM.ServiceDescription,POM.DeliveryDate,sup.SupplierName,sup.Address,POM.status,OGR_Status,POM.PODate,POM.IsOpenOrder,POM.CreatedDate,POM.POType')
|
||||
->select("IF(POM.PODate IS NOT NULL, DATE_FORMAT(POM.PODate, '%Y-%m-%d'), NULL) AS formatted_PODate")
|
||||
->select("IF(POM.IsOpenOrder IS NULL OR POM.IsOpenOrder = '', 0, POM.IsOpenOrder) AS formatted_IsOpenOrder")
|
||||
->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO')
|
||||
@ -291,7 +291,7 @@ class Inwardgateregister_model extends Model
|
||||
{
|
||||
$builder = $this->db->table('T_IGR_Master igr')
|
||||
->distinct()
|
||||
->select('igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity')
|
||||
->select('igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity,POM.POType')
|
||||
->join('T_IGR_Details igrd', 'igrd.IGRNO = igr.IGRNO')
|
||||
->join('T_PurchaseOrder_Master POM', 'igr.PONO = POM.PONO')
|
||||
->join('T_PurchaseOrder_LineItem POL', 'igr.PONO = POL.PONO and POL.MaterialCode=igrd.MaterialCode ')
|
||||
@ -786,7 +786,13 @@ class Inwardgateregister_model extends Model
|
||||
$r = $this->db->affectedRows();
|
||||
return $r;
|
||||
}
|
||||
|
||||
function updateIGRLineItem($igrlineitemarr, $IGRitemNo){
|
||||
$this->db->table('T_IGR_Details')
|
||||
->where('IGRItemNo', $IGRitemNo)
|
||||
->update($igrlineitemarr);
|
||||
$r = $this->db->affectedRows();
|
||||
return $r;
|
||||
}
|
||||
function getpolineqty($NewPO)
|
||||
{
|
||||
$builder = $this->db->table('T_PurchaseOrder_LineItem')
|
||||
|
||||
@ -1464,14 +1464,12 @@
|
||||
<!-- Inspection menu starts here -->
|
||||
<?php if (empty($DepAccesslist)) {
|
||||
if (
|
||||
$DEPCode == STORE ||
|
||||
$DEPCode == QUALITY ||
|
||||
$DEPCode == SECURITY
|
||||
$DEPCode == "Inspection"
|
||||
) { ?>
|
||||
<li class="treeview">
|
||||
<a href="">
|
||||
<i class="fa fa-check-square-o"></i>
|
||||
<span> Inward</span>
|
||||
<span> OLD Inward</span>
|
||||
<span class="pull-right-container">
|
||||
<span class="fa fa-angle-down pull-right"></span>
|
||||
</span>
|
||||
@ -1479,9 +1477,7 @@
|
||||
<ul class="treeview-menu">
|
||||
|
||||
<?php if (
|
||||
$DEPCode == STORE ||
|
||||
$DEPCode == QUALITY ||
|
||||
$DEPCode == SECURITY
|
||||
$DEPCode == "Inspection"
|
||||
) { ?>
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>Addigr">
|
||||
@ -1588,18 +1584,14 @@
|
||||
$assd = $dep->AssDep;
|
||||
//echo $assd;
|
||||
if (
|
||||
$assd == STORE ||
|
||||
$DEPCode == QUALITY ||
|
||||
$assd == QUALITY ||
|
||||
$DEPCode == STORE ||
|
||||
$DEPCode == SECURITY ||
|
||||
$assd == SECURITY
|
||||
$assd == "Inspection" ||
|
||||
$DEPCode == "Inspection"
|
||||
) {
|
||||
$check8 = $check8 + 1; ?>
|
||||
<li class="treeview">
|
||||
<a href="">
|
||||
<i class="fa fa-check-square-o"></i>
|
||||
<span> Inward</span>
|
||||
<span> Old Inspection</span>
|
||||
<span class="pull-right-container">
|
||||
<span class="fa fa-angle-down pull-right"></span>
|
||||
</span>
|
||||
@ -1657,6 +1649,323 @@
|
||||
<span>Inward Material Test Report</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<?php foreach ($DepAccesslist as $dep) {
|
||||
$assd = $dep->AssDep; ?>
|
||||
<!-- <?php if ($assd == STORE || $DEPCode == STORE) { ?>
|
||||
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>Stock">
|
||||
<i class="fa fa-dashboard"></i> <span>Stock Details</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php } ?> -->
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php if ($check8 == 1) { break; }
|
||||
}
|
||||
} ?>
|
||||
<!-- Inspection menu ends here -->
|
||||
<!-- Inspection now changed into inward menu starts here -->
|
||||
<?php if (empty($DepAccesslist)) {
|
||||
if (
|
||||
$DEPCode == STORE ||
|
||||
$DEPCode == QUALITY ||
|
||||
$DEPCode == SECURITY
|
||||
) { ?>
|
||||
<li class="treeview">
|
||||
<a href="">
|
||||
<i class="fa fa-check-square-o"></i>
|
||||
<span> Old Inspection</span>
|
||||
<span class="pull-right-container">
|
||||
<span class="fa fa-angle-down pull-right"></span>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu">
|
||||
|
||||
<?php if (
|
||||
$DEPCode == STORE ||
|
||||
$DEPCode == QUALITY ||
|
||||
$DEPCode == SECURITY
|
||||
) { ?>
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>Addigr">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>Inward Gate Register Entry</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<?php $link = ($DEPCode == SECURITY) ? base_url() . 'ViewigrDetails' : base_url() . 'Viewigr'; ?>
|
||||
<a href="<?php echo $link; ?>">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>View Inward Gate Register</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
<?php } else {?>
|
||||
<?php $check81 = 0; ?>
|
||||
<?php foreach ($DepAccesslist as $dep) {
|
||||
|
||||
$assd = $dep->AssDep;
|
||||
//echo $assd;
|
||||
if (
|
||||
$assd == STORE ||
|
||||
$DEPCode == QUALITY ||
|
||||
$assd == QUALITY ||
|
||||
$DEPCode == STORE ||
|
||||
$DEPCode == SECURITY ||
|
||||
$assd == SECURITY
|
||||
) {
|
||||
$check81 = $check81 + 1; ?>
|
||||
<li class="treeview">
|
||||
<a href="">
|
||||
<i class="fa fa-check-square-o"></i>
|
||||
<span> Inward</span>
|
||||
<span class="pull-right-container">
|
||||
<span class="fa fa-angle-down pull-right"></span>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu">
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>Addigr">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>Inward Gate Register Entry</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>ViewigrDetails">
|
||||
<i class="fa fa-eye"></i>
|
||||
<span>View Inward Gate Register</span>
|
||||
</a>
|
||||
</li>
|
||||
<!-- <li>
|
||||
<?php // $link = ($DEPCode !== SECURITY) ? base_url() . 'ViewigrDetails' : base_url() . 'Viewigr'; ?>
|
||||
<a href="<?php // echo $link; ?>">
|
||||
<i class="fa fa-eye"></i>
|
||||
<span>View Inward Gate Register</span>
|
||||
</a>
|
||||
</li> -->
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
<?php foreach ($DepAccesslist as $dep) {
|
||||
$assd = $dep->AssDep; ?>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php if ($check81 == 1) { break;}
|
||||
}
|
||||
} ?>
|
||||
<!-- Inspection now changed into inward menu ends here -->
|
||||
<!-- Inspection now changed into outward menu starts here -->
|
||||
<?php if (empty($DepAccesslist)) {
|
||||
if (
|
||||
$DEPCode == STORE ||
|
||||
$DEPCode == QUALITY ||
|
||||
$DEPCode == SECURITY
|
||||
) { ?>
|
||||
<li class="treeview">
|
||||
<a href="">
|
||||
<i class="fa fa-check-square-o"></i>
|
||||
<span> Outward </span>
|
||||
<span class="pull-right-container">
|
||||
<span class="fa fa-angle-down pull-right"></span>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu">
|
||||
|
||||
<?php if (
|
||||
$DEPCode == STORE ||
|
||||
$DEPCode == QUALITY ||
|
||||
$DEPCode == SECURITY
|
||||
) { ?>
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>AddOgr">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>Outward Gate Register Entry</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>ViewOgr">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>View Outward Gate Register</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
<?php } else {?>
|
||||
<?php $check81 = 0; ?>
|
||||
<?php foreach ($DepAccesslist as $dep) {
|
||||
|
||||
$assd = $dep->AssDep;
|
||||
//echo $assd;
|
||||
if (
|
||||
$assd == STORE ||
|
||||
$DEPCode == QUALITY ||
|
||||
$assd == QUALITY ||
|
||||
$DEPCode == STORE ||
|
||||
$DEPCode == SECURITY ||
|
||||
$assd == SECURITY
|
||||
) {
|
||||
$check81 = $check81 + 1; ?>
|
||||
<li class="treeview">
|
||||
<a href="">
|
||||
<i class="fa fa-check-square-o"></i>
|
||||
<span> Outward</span>
|
||||
<span class="pull-right-container">
|
||||
<span class="fa fa-angle-down pull-right"></span>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu">
|
||||
|
||||
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>AddOgr">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>Outward Gate Register Entry</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>ViewOgr">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>View Outward Gate Register</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
<?php foreach ($DepAccesslist as $dep) {
|
||||
$assd = $dep->AssDep; ?>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php if ($check81 == 1) { break; }
|
||||
}
|
||||
} ?>
|
||||
<!-- Inspection changes to outward menu ends here -->
|
||||
|
||||
<!-- Inspection menu starts here -->
|
||||
<?php if (empty($DepAccesslist)) {
|
||||
if (
|
||||
$DEPCode == STORE ||
|
||||
$DEPCode == QUALITY
|
||||
) { ?>
|
||||
<li class="treeview">
|
||||
<a href="">
|
||||
<i class="fa fa-check-square-o"></i>
|
||||
<span> Inspection</span>
|
||||
<span class="pull-right-container">
|
||||
<span class="fa fa-angle-down pull-right"></span>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu">
|
||||
|
||||
<?php if (
|
||||
$DEPCode == STORE ||
|
||||
$DEPCode == QUALITY
|
||||
) { ?>
|
||||
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>ViewMRIR">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>View Material Inspection Report</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php if ($DEPCode == QUALITY) { ?>
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>quality">
|
||||
<i class="fa fa-list-alt"></i>
|
||||
<span>Product Test Specification Master</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>qualityreportlist">
|
||||
<i class="fa fa-table"></i>
|
||||
<span>Product Test Report</span>
|
||||
</a>
|
||||
</li>
|
||||
<li >
|
||||
<a href="<?php echo base_url(); ?>qualityreportlistinward">
|
||||
<i class="fa fa-hand-o-down"></i>
|
||||
<span>Inward Material Test Report</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
<?php } else {?>
|
||||
<?php $check82 = 0; ?>
|
||||
<?php foreach ($DepAccesslist as $dep) {
|
||||
|
||||
$assd = $dep->AssDep;
|
||||
//echo $assd;
|
||||
if (
|
||||
$assd == STORE ||
|
||||
$DEPCode == QUALITY ||
|
||||
$assd == QUALITY ||
|
||||
$DEPCode == STORE
|
||||
) {
|
||||
$check82 = $check82 + 1; ?>
|
||||
<li class="treeview">
|
||||
<a href="">
|
||||
<i class="fa fa-check-square-o"></i>
|
||||
<span> Inspection</span>
|
||||
<span class="pull-right-container">
|
||||
<span class="fa fa-angle-down pull-right"></span>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu">
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>ViewMRIR">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>View Material Inspection Report</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php if ($assd == QUALITY || $DEPCode == QUALITY) { ?>
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>quality">
|
||||
<i class="fa fa-list-alt"></i>
|
||||
<span>Product Test Specification Master</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>qualityreportlist">
|
||||
<i class="fa fa-table"></i>
|
||||
<span>Product Test Report</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>qualityreportlistinward">
|
||||
<i class="fa fa-hand-o-down"></i>
|
||||
<span>Inward Material Test Report</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@ -1666,26 +1975,19 @@
|
||||
|
||||
<?php foreach ($DepAccesslist as $dep) {
|
||||
$assd = $dep->AssDep; ?>
|
||||
<!-- <?php if ($assd == STORE || $DEPCode == STORE) { ?>
|
||||
|
||||
<li>
|
||||
<a href="<?php echo base_url(); ?>Stock">
|
||||
<i class="fa fa-dashboard"></i> <span>Stock Details</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php } ?> -->
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php if ($check8 == 1) {
|
||||
<?php if ($check82 == 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} ?>
|
||||
<!-- Inspection menu ends here -->
|
||||
|
||||
|
||||
<?php if (empty($DepAccesslist)) { ?>
|
||||
<?php if ($DEPCode == HR) { ?>
|
||||
<li class="treeview">
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
<div class="content-wrapper" style="min-height:537px;">
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
<center> Inward Gate Register (IGR) Entry</center>
|
||||
<center> Inward Gate Register </center>
|
||||
</h1>
|
||||
</section>
|
||||
<section class="content" style="margin: 15px;"><br/>
|
||||
@ -67,10 +67,13 @@
|
||||
<div class="row"><br/><br/>
|
||||
<div id="content" > </div>
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-3">
|
||||
|
||||
<label>Select Purchase Order No </label>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||
<label>Select Purchase Order No</label>
|
||||
<a id="printLink" data-toggle="tooltip" href="" target="new" style="text-align: right;">
|
||||
<i class="fa fa-print" data-toggle="tooltip" title="Click here to Print the Purchase Order details"></i>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
$options = array("-1"=>'Purchase Order No');
|
||||
|
||||
@ -176,12 +179,14 @@
|
||||
|
||||
<div class="col-md-12" style="margin: 10px 0;">
|
||||
|
||||
<input type="button" class="btn btn-success" id ="addemorebutton" value=" + ADD FILES..">
|
||||
<!-- <input type="button" class="btn btn-success" id ="addemorebutton" value=" + ADD FILES.."> -->
|
||||
|
||||
|
||||
<div id="newsdiv"></div><!-- this div for add more section-->
|
||||
<input type="hidden" name="hidecounters" id="hidecounters" value="0" />
|
||||
<input type="hidden" name="hideconstants" id="hideconstants" value="0" />
|
||||
<!-- <div id="newsdiv"></div>this div for add more section -->
|
||||
<input type="hidden" name="hidecounters" id="hidecounters" value="0" />
|
||||
<input type="hidden" name="hideconstants" id="hideconstants" value="0" />
|
||||
<input type="hidden" name="hideIGRStatus" id="hideIGRStatus" value="0" />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@ -192,15 +197,14 @@
|
||||
<thead >
|
||||
<tr>
|
||||
<th>S.No</th>
|
||||
<th>Item Code</th>
|
||||
<th>Material</th>
|
||||
<th>UOM</th>
|
||||
<th>Ordered Quantity</th>
|
||||
<th>Received Quantity</th>
|
||||
<th>Pending Quantity</th>
|
||||
<th>Advised Quantity</th>
|
||||
|
||||
<th>Remarks</th>
|
||||
<th>Item Code</th>
|
||||
<th>Material</th>
|
||||
<th>UOM</th>
|
||||
<th>Ordered Quantity</th>
|
||||
<th>Received Quantity</th>
|
||||
<th>Advised Quantity</th>
|
||||
<th>Balance Quantity</th>
|
||||
<th>Remarks</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
@ -233,14 +237,19 @@
|
||||
</thead>-->
|
||||
|
||||
|
||||
<div class="col-md-1 col-md-offset-10">
|
||||
<!-- <div class="col-md-1 col-md-offset-10">
|
||||
|
||||
|
||||
|
||||
<button class="btn btn-success" id='IGRLink' type="submit" name='IGRLink' onclick="filecheck();">Generate IGR</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="col-md-4 col-md-offset-8">
|
||||
<input type="file" name="browseFiles1" id="images1" onchange="Copyfilenames(this.name); "><br>
|
||||
<button class="btn btn-success" id='IGRDraftLink' type="submit" name='IGRDraftLink' onclick="filecheck(0);">Draft IGR</button>
|
||||
<button class="btn btn-success" id='IGRLink' type="submit" name='IGRLink' onclick="filecheck(1);">Generate IGR</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -412,6 +421,10 @@ function validate()
|
||||
|
||||
if(id == obj.PONO)
|
||||
{
|
||||
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
|
||||
var newUrl = baseUrl + '?PONO=' + obj.PONO + '&ReqType=' + obj.POType;
|
||||
$('#printLink').attr('href', newUrl);
|
||||
|
||||
$("#po").val(obj.PONO);
|
||||
$("#Sup").val(obj.SupplierName);
|
||||
$("#hiddenIsOpenOrder").val(obj.IsOpenOrder);
|
||||
@ -590,8 +603,13 @@ function isNumberKey(evt)
|
||||
return true;
|
||||
}
|
||||
|
||||
function Save()
|
||||
function Save(status)
|
||||
{
|
||||
alert("save function worked "+status);
|
||||
return true;
|
||||
}
|
||||
|
||||
function S(){
|
||||
//alert("save function worked ");
|
||||
// var file = $('#images'+counterConstants).val()
|
||||
|
||||
@ -768,8 +786,12 @@ div.innerHTML='<div class="col-md-12">'+
|
||||
|
||||
}
|
||||
|
||||
function filecheck()
|
||||
function filecheck(status)
|
||||
{
|
||||
$('#hideIGRStatus').val(status);
|
||||
$('#hidecounters').val(1);
|
||||
$('#hideconstants').val(1);
|
||||
|
||||
//alert(counterConstants);
|
||||
var file1 = $('#images').val();
|
||||
|
||||
@ -782,7 +804,7 @@ function filecheck()
|
||||
}
|
||||
else
|
||||
{
|
||||
Save();
|
||||
Save(status);
|
||||
}
|
||||
// var sizef = document.getElementById('myfile').files[0].size;
|
||||
// var myfile = $('#myfile').val();
|
||||
|
||||
@ -12,6 +12,9 @@
|
||||
{
|
||||
width:800px ! important;
|
||||
}
|
||||
.modal-footer .btn {
|
||||
margin-right: 10px; /* Add some spacing between buttons */
|
||||
}
|
||||
</style>
|
||||
<div class="content-wrapper">
|
||||
|
||||
@ -63,7 +66,7 @@
|
||||
<tr id="<?php echo $index ?>" >
|
||||
<!-- <td style="text-align: center;"><?php echo $index?></td> -->
|
||||
|
||||
<td><a data-toggle="modal" data-target="#Igrshow" data-id="<%=index%>" data-userid="<?php echo $record->IGRNO ?>" > <u><?php echo $record->IGRNO ?></u></a></td>
|
||||
<td><a data-toggle="modal" data-target="#Igrshow" data-id="<%=index%>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>" > <u><?php echo $record->IGRNO ?></u></a></td>
|
||||
|
||||
<td><?php echo $record->PONO ?></a></td>
|
||||
<td><?php echo $record->SupplierName ?></td>
|
||||
@ -81,8 +84,11 @@
|
||||
<a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Attachment Available for Download/View" data-igrno="<?php echo $record->IGRNO ?>" ><button class="btn btn-success btn-sm ">Download</button></a>
|
||||
<?php } else { ?>
|
||||
<!-- echo "NO FILE"; -->
|
||||
<a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Attachment Available for Download/View" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>"><i class="fa fa-pencil" style="text-align: center;"></i></a>
|
||||
<a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Attachment Available for Download/View" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>"><button class="btn btn-success btn-sm ">Upload</button></a>
|
||||
<?php } ?>
|
||||
<?php if($record->IGRStatus !== "ST074") { ?>
|
||||
<div style="padding-top:10px"> <a href="<?php echo base_url().'MRIRcontroller/igrdatavalues?IGRNO='.$record->IGRNO; ?>"><button style="font-size:12px;" id="generated" name="generated">Generate MRIR <i class="fa fa-file-text"></i></button></div></a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<!--<td><?php echo $record->file ?></td>-->
|
||||
</tr>
|
||||
@ -256,8 +262,12 @@
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Purchase Order Number </label>
|
||||
<?php
|
||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||
<label>Purchase Order No</label>
|
||||
<a id="printLink" data-toggle="tooltip" href="" target="new" style="text-align: right;">
|
||||
<i class="fa fa-print" data-toggle="tooltip" title="Click here to Print the Purchase Order details"></i>
|
||||
</a>
|
||||
</div> <?php
|
||||
$data = array('name' => 'PurchaseOrderNumber','value' => set_value('PurchaseOrderNumber'),'id'=>'PONo', 'class' => 'form-control', 'required=>"true"' , 'readonly'=>'true' );
|
||||
|
||||
echo form_input($data);
|
||||
@ -338,25 +348,23 @@
|
||||
<th>UOM</th>
|
||||
<th>Ordred Quantity</th>
|
||||
<th>Received Quantity</th>
|
||||
<th id="pendingQuantityHeader" style="display:none;">Pending Quantity</th>
|
||||
<th>Remarks</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbleAppend1">
|
||||
<!-- <tr>
|
||||
<td>1</td>
|
||||
<td>RM002</td>
|
||||
<td>Raw sand</td>
|
||||
<td>Kgs</td>
|
||||
<td>10000</td>
|
||||
<td>10000</td>
|
||||
<td>Received</td>
|
||||
</tr>-->
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-success" data-dismiss="modal" value="Cancel">Cancel</a>
|
||||
<div class="modal-footer" id="buttonContainer">
|
||||
<!-- <a class="btn btn-success" data-dismiss="modal" value="Cancel">Cancel</a> -->
|
||||
<!-- <a class="btn btn-success" id="update" value="Update">Update IGR</a> -->
|
||||
<a class="btn btn-success" id="draftIGR" onclick="setStatusAndSubmit('draft')">Draft IGR</a>
|
||||
<a class="btn btn-success" id="generateIGR" onclick="setStatusAndSubmit('generate')">Generate IGR</a>
|
||||
|
||||
<a class="btn btn-success" data-dismiss="modal" value="Cancel">Cancel IGR</a>
|
||||
</div>
|
||||
</div><!-- .modal-content -->
|
||||
</form>
|
||||
@ -570,10 +578,19 @@ $("#hiddenPONO").val(po);
|
||||
|
||||
<script>
|
||||
$("#Igrshow").on("shown.bs.modal", function(e) {
|
||||
var igr = $(e.relatedTarget).data('userid');
|
||||
// alert(igr);
|
||||
|
||||
|
||||
var igr = $(e.relatedTarget).data('userid');
|
||||
var igrstatus = $(e.relatedTarget).data('igrstatus');
|
||||
var buttonContainer = $("#buttonContainer");
|
||||
|
||||
if (igrstatus == "ST074") {
|
||||
// Show buttons in the container
|
||||
buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block");
|
||||
} else {
|
||||
// Hide buttons in the container
|
||||
buttonContainer.find("#draftIGR, #generateIGR").css("display", "none");
|
||||
}
|
||||
|
||||
$("#tbleAppend1").empty();
|
||||
$('#content').loader('show');
|
||||
$.ajax({
|
||||
data:{id:igr},
|
||||
@ -581,15 +598,24 @@ $("#Igrshow").on("shown.bs.modal", function(e) {
|
||||
//dataType: 'json',
|
||||
url:"<?php echo base_url() ?>inwardgateregister/ViewIGR",
|
||||
success:function(data) {
|
||||
console.log(data);
|
||||
console.log('d');
|
||||
// success:function(data) {
|
||||
$('#content').loader('hide');
|
||||
var trHTML = '';
|
||||
$.each(JSON.parse(data), function (i, item) {
|
||||
if(igr == item.IGRNO)
|
||||
{
|
||||
|
||||
|
||||
$("#IGRNO1").val(item.IGRNO);
|
||||
|
||||
$("#IGRItemNo").val(item.IGRItemNo);
|
||||
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
|
||||
var newUrl = baseUrl + '?PONO=' + item.PONO + '&ReqType=' + item.POType;
|
||||
$('#printLink').attr('href', newUrl);
|
||||
$("#Vehicle_No").val(item.VehicleNo);
|
||||
$("#Driver_Name").val(item.DriverName);
|
||||
$("#DriverMobileNumber").val(item.DriverMobileNumber);
|
||||
$("#IGRStatus").val(item.IGRStatus);
|
||||
$("#PONo").val(item.PONO);
|
||||
$("#Supplier").val(item.SupplierName);
|
||||
$("#Add1").val(item.Address);
|
||||
@ -608,8 +634,38 @@ $("#Igrshow").on("shown.bs.modal", function(e) {
|
||||
$("#MaterialRcvdDate").val(Mat_rcv_date);
|
||||
$("#ser").val(item.ServiceDescription);
|
||||
|
||||
|
||||
i=i+1;
|
||||
if(igrstatus == "ST074"){
|
||||
// document.getElementById('pendingQuantityHeader').style.display = 'table-cell';
|
||||
$("#pendingQuantityHeader").css("display", "table-cell");
|
||||
|
||||
|
||||
trHTML += '<tr>' +
|
||||
'<td align="right">' + i + '</td>' +
|
||||
'<td name="MaterialName" onchange="test('+i+')">' + item.MaterialCode + '</td>' +
|
||||
'<td>' + item.MaterialName + '</td>' +
|
||||
'<td name="UOM">' + item.UOM + '</td>' +
|
||||
'<td align="right" id="Quantity'+i+'" name="Quantity">' + parseInt(item.Quantity) + '</td>' +
|
||||
'<td align="right" data-name="sel" ><input type="text" onchange="validateReceivedQuantity('+i+')"id="QuantityAsPerInvoice'+ i +'" name="QuantityAsPerInvoice'+ i +'" value="'+parseInt(item.QuantityAsPerInvoice)+'" onkeypress="return isNumberKey(event);"></td>' +
|
||||
'<td name="PendingQuantity'+i+'" id="PendingQuantity'+i+'">'+ parseInt(item.Quantity -item.QuantityAsPerInvoice) +'</td>'+
|
||||
'<td><input type="text" id="Remark'+ i +'" name="Remark'+ i +'" class="form" onchange="SetRemarks('+i+')"> </td>' +
|
||||
|
||||
'<input type="hidden" id="IGRNO'+ i +'" name="IGRNO'+ i +'" value="'+ item.IGRNO +'">' +
|
||||
'<input type="hidden" id="IGRItemNo'+ i +'" name="IGRItemNo'+ i +'" value="'+ item.IGRItemNo +'">' +
|
||||
'<input type="hidden" id="MaterialCode'+ i +'" name="MaterialCode'+ i +'" value="'+ item.MaterialCode +'">' +
|
||||
'<input type="hidden" id="txtQuantityAsPerInvoice'+ i +'" name="txtQuantityAsPerInvoice'+ i +'" value="'+ item.QuantityAsPerInvoice +'">' +
|
||||
'<input type="hidden" id="txtOrderedQuantity'+ i +'" name="txtOrderedQuantity'+ i +'" value="'+ item.Quantity +'">' +
|
||||
'<input type="hidden" id="txtRemarks'+ i +'" name="txtRemarks'+ i +'">'; // Example with no initial value
|
||||
'</tr>';
|
||||
|
||||
//alert(item.PendingQty);
|
||||
if((item.Quantity-item.QuantityAsPerInvoice) == 0.00)
|
||||
{
|
||||
$('#QuantityAsPerInvoice'+i).attr('readonly', 'true');
|
||||
}
|
||||
}else{
|
||||
$("#pendingQuantityHeader").css("display", "none");
|
||||
|
||||
trHTML += '<tr>' +
|
||||
'<td align="right">' + i + '</td>' +
|
||||
'<td name="MaterialName" id="MaterialCode" onchange="test('+i+')">' + item.MaterialCode + '</td>' +
|
||||
@ -618,7 +674,9 @@ $("#Igrshow").on("shown.bs.modal", function(e) {
|
||||
'<td align="right" name="Quantity">' + item.Quantity + '</td>' +
|
||||
'<td align="right" data-name="sel" >'+item.QuantityAsPerInvoice+'</td>' +
|
||||
'<td>'+ item.Remarks+ '</td>' +
|
||||
'</tr>';
|
||||
'</tr>';
|
||||
}
|
||||
|
||||
//alert(item.QuantityAsPerInvoice);
|
||||
}
|
||||
|
||||
@ -783,3 +841,107 @@ counter++;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function SetRemarks(RowId)
|
||||
{
|
||||
var remks = $("#Remark"+RowId).val();
|
||||
if( remks != '')
|
||||
{
|
||||
$("#txtRemarks"+RowId).val(remks);
|
||||
}
|
||||
}
|
||||
function validateReceivedQuantity(Rowid) {
|
||||
var InvoiceQty = parseFloat($('#QuantityAsPerInvoice' + Rowid).val() || '0.00'); // working fine
|
||||
var OrderedQty = parseFloat($("#Quantity" + Rowid).text());
|
||||
|
||||
if (parseInt(OrderedQty) !== 0) {
|
||||
if ((InvoiceQty) > OrderedQty) {
|
||||
alert("Advised Quantity is exceeding the Ordered Quantity. Please contact the Purchase Team for further process.");
|
||||
$("#QuantityAsPerInvoice" + Rowid).focus().val('');
|
||||
return false;
|
||||
} else if ((InvoiceQty) - OrderedQty > 0.00) {
|
||||
alert("Order is completed.");
|
||||
$("#QuantityAsPerInvoice" + Rowid).focus().val('');
|
||||
return false;
|
||||
} else {
|
||||
var PendingQty = OrderedQty - (InvoiceQty);
|
||||
$('#PendingQuantity' + Rowid).text(PendingQty.toFixed(0));
|
||||
$('#txtPendingQty' + Rowid).val(PendingQty.toFixed(0));
|
||||
$('#txtQuantityAsPerInvoice' + Rowid).val(InvoiceQty.toFixed(2));
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
var PendingQty = OrderedQty - (InvoiceQty);
|
||||
$('#PendingQuantity' + Rowid).text(PendingQty.toFixed(0));
|
||||
$('#txtPendingQty' + Rowid).val(PendingQty.toFixed(0));
|
||||
$('#txtQuantityAsPerInvoice' + Rowid).val(InvoiceQty.toFixed(2));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function isNumberKey(evt)
|
||||
{
|
||||
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
||||
if (charCode != 46 && charCode > 31
|
||||
&& (charCode < 48 || charCode > 57))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
|
||||
function setStatusAndSubmit(status) {
|
||||
var statuscode = (status == "draft") ? 'ST074' : 'ST027';
|
||||
// alert('updated function entered');
|
||||
$('#content').loader('show');
|
||||
var igrno = $("#IGRNO1").val();
|
||||
|
||||
var dataToSend = [];
|
||||
|
||||
$('#tbleAppend1 tr').each(function(index, row) {
|
||||
var rowData = {};
|
||||
|
||||
$(row).find('input[type="hidden"]').each(function() {
|
||||
var fieldName = $(this).attr('name');
|
||||
var fieldValue = $(this).val();
|
||||
rowData[fieldName] = fieldValue;
|
||||
});
|
||||
|
||||
dataToSend.push(rowData);
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: "<?php echo base_url() ?>inwardgateregister/updateIGRLineItem",
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: {
|
||||
igr: igrno,
|
||||
status: statuscode,
|
||||
data: JSON.stringify(dataToSend)
|
||||
},
|
||||
success: function(response) {
|
||||
$('#content').loader('hide');
|
||||
console.log('Data saved successfully:', response);
|
||||
alert(response.message);
|
||||
// Close the modal
|
||||
$('#Igrshow').modal('hide');
|
||||
// location.reload();
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
$('#content').loader('hide');
|
||||
console.error('Error saving data:', textStatus, errorThrown);
|
||||
alert(response.message);
|
||||
$('#Igrshow').modal('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -156,8 +156,13 @@
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Purchase Order Number </label>
|
||||
<?php
|
||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||
<label>Purchase Order No</label>
|
||||
<a id="printLink" data-toggle="tooltip" href="" target="new" style="text-align: right;">
|
||||
<i class="fa fa-print" data-toggle="tooltip" title="Click here to Print the Purchase Order details"></i>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
$data = array('name' => 'PurchaseOrderNumber','value' => set_value('PurchaseOrderNumber'),'id'=>'PONo', 'class' => 'form-control', 'required=>"true"' , 'readonly'=>'true' );
|
||||
|
||||
echo form_input($data);
|
||||
@ -196,6 +201,30 @@
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12" style=" padding-bottom: 10px;">
|
||||
<div class="col-md-4">
|
||||
<label>Vehicle Number</label>
|
||||
<?php
|
||||
$data = array('name' => 'VehicleNo','value' => set_value('VehicleNo'),'id'=>'Vehicle_No', 'class' => 'form-control', 'required=>"true"' , 'readonly'=>'true' );
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Driver Name </label>
|
||||
<?php
|
||||
$data = array('name' => 'DriverName','value' => set_value('DriverName'),'id'=>'Driver_Name', 'class' => 'form-control', 'required=>"true"' , 'readonly'=>'true' );
|
||||
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Driver Mobile Number </label>
|
||||
<?php
|
||||
$data = array('name' => 'DriverMobileNumber','value' => set_value('DriverMobileNumber'),'id'=>'DriverMobileNumber', 'class' => 'form-control' , 'readonly'=>'true' );
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Table to show the line item of po -->
|
||||
@ -209,6 +238,7 @@
|
||||
<th>UOM</th>
|
||||
<th>Ordred Quantity</th>
|
||||
<th>Received Quantity</th>
|
||||
<th>Balance Quantity</th>
|
||||
<th>Remarks</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -268,7 +298,15 @@ $("#Igrshow").on("shown.bs.modal", function(e) {
|
||||
{
|
||||
|
||||
$("#IGRNO1").val(item.IGRNO);
|
||||
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
|
||||
var newUrl = baseUrl + '?PONO=' + item.PONO + '&ReqType=' + item.POType;
|
||||
$('#printLink').attr('href', newUrl);
|
||||
//alert(item.IGRNO);
|
||||
|
||||
$("#Vehicle_No").val(item.VehicleNo);
|
||||
$("#Driver_Name").val(item.DriverName);
|
||||
$("#DriverMobileNumber").val(item.DriverMobileNumber);
|
||||
$("#IGRStatus").val(item.IGRStatus);
|
||||
$("#PONo").val(item.PONO);
|
||||
$("#Supplier").val(item.SupplierName);
|
||||
$("#Add1").val(item.Address);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user