Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme
This commit is contained in:
commit
f01e195f01
@ -4256,8 +4256,14 @@ class Purchaseorder extends BaseController
|
|||||||
$filelist = array('PONO' => $pono, 'IGRNO' => $igr, 'FilePath' => $Picture);
|
$filelist = array('PONO' => $pono, 'IGRNO' => $igr, 'FilePath' => $Picture);
|
||||||
$uploadfiles = $this->purchaseorder_model->insertfile($filelist);
|
$uploadfiles = $this->purchaseorder_model->insertfile($filelist);
|
||||||
if ($uploadfiles > 0) {
|
if ($uploadfiles > 0) {
|
||||||
echo "file updated successfully!";
|
$response = [
|
||||||
return true;
|
'message' => 'File updated successfully!',
|
||||||
|
'data' => $uploadfiles
|
||||||
|
];
|
||||||
|
|
||||||
|
// Return the response as JSON
|
||||||
|
return $this->response->setJSON($response);
|
||||||
|
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
echo " Internal Server Error..!!";
|
echo " Internal Server Error..!!";
|
||||||
@ -4395,8 +4401,16 @@ class Purchaseorder extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($uploadfile > 0){
|
if( $uploadfile['afftectedRows'] > 0){
|
||||||
echo "updated successfully!";
|
|
||||||
|
$response = [
|
||||||
|
'message' => 'File updated successfully!',
|
||||||
|
'data' =>$uploadfile['updatedRow']
|
||||||
|
];
|
||||||
|
|
||||||
|
// Return the response as JSON
|
||||||
|
return $this->response->setJSON($response);
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
echo "Update Failed (maybe same file provided for update kindly check)..!!";
|
echo "Update Failed (maybe same file provided for update kindly check)..!!";
|
||||||
|
|||||||
@ -2325,12 +2325,23 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
|
|||||||
function updatefile($bill, $Picture)
|
function updatefile($bill, $Picture)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$uploadfile;
|
||||||
$this->db->table('t_purchaseorder_billupload')
|
$this->db->table('t_purchaseorder_billupload')
|
||||||
->set('FilePath', $Picture)
|
->set('FilePath', $Picture)
|
||||||
->where('BillNo', $bill)
|
->where('BillNo', $bill)
|
||||||
->update();
|
->update();
|
||||||
$afftectedRows = $this->db->affectedRows();
|
|
||||||
return $afftectedRows;
|
$uploadfile['afftectedRows'] = $this->db->affectedRows();
|
||||||
|
|
||||||
|
if( $uploadfile['afftectedRows'] > 0){
|
||||||
|
$uploadfile['updatedRow'] = $this->db->table('t_purchaseorder_billupload')
|
||||||
|
->where('BillNo', $bill)
|
||||||
|
->get()
|
||||||
|
->getRowArray();
|
||||||
|
|
||||||
|
}
|
||||||
|
return $uploadfile;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2425,11 +2436,11 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
|
|||||||
function insertfile($filelist)
|
function insertfile($filelist)
|
||||||
{
|
{
|
||||||
|
|
||||||
//print_r($myfile);die;
|
|
||||||
$builder = $this->db->table('t_purchaseorder_billupload');
|
$builder = $this->db->table('t_purchaseorder_billupload');
|
||||||
$builder->insert($filelist);
|
$builder->insert($filelist);
|
||||||
$myfile = $this->db->affectedRows();
|
$insertedID = $this->db->insertID();
|
||||||
return $myfile;
|
$insertedRow = $builder->where('BillNo', $insertedID)->get()->getRowArray();
|
||||||
|
return $insertedRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -1096,11 +1096,11 @@ if (!empty($getlogpodtl)) {
|
|||||||
<table id="ServiceTable" class="table table-striped table-hover mb-0" style="font-size:12px;">
|
<table id="ServiceTable" class="table table-striped table-hover mb-0" style="font-size:12px;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>SNo</th>
|
<th style="text-align:center !important;">SNo</th>
|
||||||
<th>Requisition No</th>
|
<th style="text-align:center !important;">Requisition No</th>
|
||||||
<th>Item Code</th>
|
<th style="text-align:center !important;">Item Code</th>
|
||||||
<th>Item Name</th>
|
<th>Item Name</th>
|
||||||
<th style="text-align: right;">Quantity</th>
|
<th style="text-align: center;">Quantity</th>
|
||||||
<th>UOM</th>
|
<th>UOM</th>
|
||||||
<th style="text-align: right;">Rate <?php echo "($INRSYM)" ?></th>
|
<th style="text-align: right;">Rate <?php echo "($INRSYM)" ?></th>
|
||||||
<th style="text-align: right;">Basic Amount <?php echo "($INRSYM)" ?></th>
|
<th style="text-align: right;">Basic Amount <?php echo "($INRSYM)" ?></th>
|
||||||
@ -1132,11 +1132,11 @@ if (!empty($getlogpodtl)) {
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<tr id="<?php echo $index; ?>">
|
<tr id="<?php echo $index; ?>">
|
||||||
<td align="left"><?php echo $index; ?></td>
|
<td align="center"><?php echo $index; ?></td>
|
||||||
<td><?php echo $record->ReqNo ?></td>
|
<td align="center"><?php echo $record->ReqNo ?></td>
|
||||||
<td><?php echo $record->MaterialCode ?></td>
|
<td align="center"><?php echo $record->MaterialCode ?></td>
|
||||||
<td><?php echo $record->MaterialName ?></td>
|
<td><?php echo $record->MaterialName ?></td>
|
||||||
<td align="right"><?php echo $record->Quantity ?></td>
|
<td align="center"><?php echo $record->Quantity ?></td>
|
||||||
<td><?php echo $record->UOM ?></td>
|
<td><?php echo $record->UOM ?></td>
|
||||||
|
|
||||||
<td align="right"><?php echo $record->Rate ?></td>
|
<td align="right"><?php echo $record->Rate ?></td>
|
||||||
|
|||||||
@ -128,7 +128,7 @@
|
|||||||
<th>PONO#</th>
|
<th>PONO#</th>
|
||||||
<th>PO Type</th>
|
<th>PO Type</th>
|
||||||
<th>Supplier Name</th>
|
<th>Supplier Name</th>
|
||||||
<th>Total Order Value</th>
|
<th style="text-align: right !important;">Total Order Value</th>
|
||||||
<th>PO Status</th>
|
<th>PO Status</th>
|
||||||
<th>Delivery Option</th>
|
<th>Delivery Option</th>
|
||||||
<th>Delivery Date</th>
|
<th>Delivery Date</th>
|
||||||
@ -152,7 +152,7 @@
|
|||||||
<td><?php echo $record->ReqType ?></td>
|
<td><?php echo $record->ReqType ?></td>
|
||||||
|
|
||||||
<td><?php echo $record->SupplierName ?></td>
|
<td><?php echo $record->SupplierName ?></td>
|
||||||
<td><?php echo $record->TotalOrderValue ?></td>
|
<td align="right"><?php echo $record->TotalOrderValue ?></td>
|
||||||
|
|
||||||
<!-- <td><?php echo $record->StatusName ?></td> -->
|
<!-- <td><?php echo $record->StatusName ?></td> -->
|
||||||
<td><?php
|
<td><?php
|
||||||
|
|||||||
@ -2522,14 +2522,14 @@ if (!empty($getlogpodtl)) {
|
|||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="spl">
|
<tbody id="splPoBillTbId">
|
||||||
<?php
|
<?php
|
||||||
if (!empty($billfile)) {
|
if (!empty($billfile)) {
|
||||||
|
|
||||||
foreach ($billfile as $row => $gd) {
|
foreach ($billfile as $row => $gd) {
|
||||||
if (!empty($gd->BillNo)) {
|
if (!empty($gd->BillNo)) {
|
||||||
$index = $row + 1;
|
$index = $row + 1;
|
||||||
?>
|
?>
|
||||||
<tr id="lastvalue">
|
<tr id="lastvalue">
|
||||||
<td><?php echo $gd->BillNo ?></td>
|
<td><?php echo $gd->BillNo ?></td>
|
||||||
|
|
||||||
@ -5090,8 +5090,17 @@ if (!empty($getlogpodtl)) {
|
|||||||
|
|
||||||
},
|
},
|
||||||
error: function(jqXHR, textStatus, errorThrown) {
|
error: function(jqXHR, textStatus, errorThrown) {
|
||||||
console.error("AJAX Error: " + textStatus + ": " + errorThrown);
|
// Handle errors here
|
||||||
alert("Error: " + textStatus);
|
$('#loader').hide();
|
||||||
|
console.error("AJAX Error: ", textStatus, errorThrown);
|
||||||
|
alert("An error occurred: " + textStatus + " - " + errorThrown);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
complete: function() {
|
||||||
|
// Actions that should always happen regardless of success or error
|
||||||
|
console.log("AJAX request completed.");
|
||||||
|
$('#loader').hide(); // Hide the loader in any case
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -5304,24 +5313,25 @@ if (!empty($getlogpodtl)) {
|
|||||||
|
|
||||||
$('#loader').show();
|
$('#loader').show();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: formData, // The form data to send (contains the file)
|
data: formData,
|
||||||
type: "POST", // HTTP method
|
type: "POST",
|
||||||
url: "<?php echo base_url();?>purchaseorder/uploadfile", // URL to send the request to
|
url: "<?php echo base_url();?>purchaseorder/uploadfile",
|
||||||
cache: false, // Disable caching of the response
|
cache: false,
|
||||||
contentType: false, // Tell jQuery not to set content type (it's handled by FormData)
|
contentType: false,
|
||||||
processData: false, // Don't process the data into a query string (needed for FormData)
|
processData: false,
|
||||||
|
|
||||||
success: function(data) {
|
success: function(response) {
|
||||||
if (data) {
|
if (response) {
|
||||||
$('#loader').hide(); // Hide loader on success
|
$('#loader').hide();
|
||||||
alert(data); // Show response data (you may want to customize this)
|
updateRowToTable(response.data,response.data.BillNo);
|
||||||
$('#billModel').modal('hide'); // Hide the modal if file uploaded successfully
|
console.log(response.data);
|
||||||
window.location.reload(); // Reload the page to reflect changes
|
$('#billModel').modal('hide');
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
error: function(xhr, status, error) { // Handle errors gracefully
|
error: function(xhr, status, error) {
|
||||||
$('#loader').hide(); // Hide the loader even on error
|
$('#loader').hide();
|
||||||
let errorMessage = '';
|
let errorMessage = '';
|
||||||
|
|
||||||
// Custom error messages based on status codes
|
// Custom error messages based on status codes
|
||||||
@ -5417,11 +5427,13 @@ if (!empty($getlogpodtl)) {
|
|||||||
cache: false,
|
cache: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
processData: false,
|
processData: false,
|
||||||
success: function(data) {
|
success: function(response) {
|
||||||
if (data) {
|
if (response) {
|
||||||
$('#loader').hide();
|
$('#loader').hide();
|
||||||
alert(data);
|
alert(response.message);
|
||||||
window.location.reload();
|
console.log(response.data.BillNo);
|
||||||
|
console.log(response.data.FilePath);
|
||||||
|
addRowToTable(response.data);
|
||||||
$('#billModel').modal('hide');
|
$('#billModel').modal('hide');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -5551,4 +5563,57 @@ if (!empty($getlogpodtl)) {
|
|||||||
$('#Quantity').attr('required', true);
|
$('#Quantity').attr('required', true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// This function adds a new row to the table
|
||||||
|
function addRowToTable(data) {
|
||||||
|
|
||||||
|
var currentRowCount = $('#splPoBillTbId tr').length;
|
||||||
|
|
||||||
|
var newIndex = currentRowCount + 1;
|
||||||
|
|
||||||
|
var newRow = `
|
||||||
|
<tr id="lastvalue">
|
||||||
|
<td>${data.BillNo}</td>
|
||||||
|
<td>${data.FilePath ? data.FilePath : "No File"}</td>
|
||||||
|
<input type="hidden" id="billnos${newIndex}" value="${data.BillNo}">
|
||||||
|
<input type="hidden" id="file${newIndex}" name="file" value="${data.FilePath}">
|
||||||
|
<td style="cursor:pointer">
|
||||||
|
<span onclick="openbillmodel(${newIndex});">
|
||||||
|
<i class="ri-pencil-fill"></i>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<a target="_blank" href="<?= base_url('public/uploads/BillFiles/') ?>${data.FilePath}">
|
||||||
|
<i class="fa fa-download"></i>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
|
||||||
|
$('#splPoBillTbId').append(newRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function updateRowToTable(updatedData, billNo) {
|
||||||
|
// Find the row using the provided BillNo
|
||||||
|
$('#splPoBillTbId tr').each(function(index) {
|
||||||
|
// Check if the BillNo of the current row matches the provided billNo
|
||||||
|
var currentBillNo = $(this).find('td:first').text(); // Assuming BillNo is in the first cell
|
||||||
|
if (currentBillNo === billNo) {
|
||||||
|
// Update the relevant cells of the row with the new values from updatedData
|
||||||
|
$(this).find('td:nth-child(1)').text(updatedData.BillNo); // Update BillNo
|
||||||
|
$(this).find('td:nth-child(2)').text(updatedData.FilePath || 'No File'); // Update FilePath
|
||||||
|
|
||||||
|
// Also update the hidden inputs if necessary
|
||||||
|
$(this).find('input[id^="billnos"]').val(updatedData.BillNo); // Update BillNo hidden input
|
||||||
|
$(this).find('input[id^="file"]').val(updatedData.FilePath); // Update FilePath hidden input
|
||||||
|
|
||||||
|
// Exit the loop once the correct row is found and updated
|
||||||
|
return false; // Stops the iteration as we've found the row to update
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|||||||
@ -50,7 +50,7 @@
|
|||||||
<ol class="breadcrumb m-0">
|
<ol class="breadcrumb m-0">
|
||||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Master Details</a></li>
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Master Details</a></li>
|
||||||
<li class="breadcrumb-item active">
|
<li class="breadcrumb-item active">
|
||||||
<h4 class="page-title ">User Listing</h4>
|
<h4 class="page-title">User Listing</h4>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user