bug fix in ria -vadivel J

This commit is contained in:
vadivel J 2024-10-29 17:23:11 +05:30
parent 71fdcd8512
commit ecaf4e3a1c
4 changed files with 75 additions and 47 deletions

View File

@ -1448,14 +1448,15 @@ class Purchaseorder extends BaseController
$IGRDs = array('QuantityAsPerInvoice' => $Quantity, 'UpdateBY' => $updatedBy, 'UpdatedOn' => $updateddt);
$this->purchaseorder_model->updateIGR($IGRD[$j]['IGRItemNo'], $IGRDs);
$itemNo = isset($IGRD[$j]['IGRItemNo']) ? $IGRD[$j]['IGRItemNo'] : null;
$this->purchaseorder_model->updateIGR($itemNo, $IGRDs);
$MaterialstockHistoryupdate = array('SupplierID' => $SupplierID, 'Quantity' => $Quantity, 'ItemValue' => $itemRate, 'UpdateBY' => $updatedBy, 'UpdatedOn' => $updateddt);
$MaterialstockHistoryupdate = array('SupplierID' => $SupplierID, 'Quantity' => $Quantity, 'ItemValue' => $itemRate, 'UpdatedBY' => $updatedBy, 'UpdatedOn' => $updateddt);
$itemNo = $IGRD[$j]['IGRItemNo'];
$this->purchaseorder_model->updateMatStock(
@ -4312,8 +4313,13 @@ class Purchaseorder extends BaseController
}
}else{
echo " File already Uploaded with this name..!!";
return false;
$response = [
'message' => 'File already uploaded with this name.!!',
'data' => false
];
// Return the response as JSON
return $this->response->setJSON($response);
}
}

View File

@ -4727,7 +4727,7 @@ if (!empty($INRSYMBOL)) {
<div id="packagingcalmodel" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false"
style="display: none;">
<div class="modal-dialog modal-sm">
<div class="modal-dialog modal-sm" style="width: 1060px;">
<div class="modal-content"
>
<div class="modal-header">
@ -4763,7 +4763,7 @@ if (!empty($INRSYMBOL)) {
<div id="submitmodel" class="modal fade" role="dialog"
aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-dialog" style="width:1060px;">
<!-- Modal content-->
<div class="modal-content" style="">
@ -4801,7 +4801,7 @@ if (!empty($INRSYMBOL)) {
<div id="filemodel" class="modal fade " tabindex="-1" data-backdrop="true" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog modal-dialog-scrollable " role="document">
<div class="modal-dialog modal-dialog-scrollable " style="width: 1060px;" role="document">
<!-- Modal content-->
<div class="modal-content" >
<div class="modal-header">
@ -4859,8 +4859,8 @@ if (!empty($INRSYMBOL)) {
</div>
<div class="col-md-12 " align="right">
<a class="btn btn-danger" data-dismiss="modal" onclick="SetExciseCalculationCancel();" value="Cancel">Cancel</a>
<a class="btn btn-success ok" ID="ExciseOption12" onclick="rfilealert();">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-secondary" data-dismiss="modal" onclick="SetExciseCalculationCancel();" value="Cancel">Cancel</a>
<a class="btn btn-info ok" ID="ExciseOption12" onclick="rfilealert();">&nbsp;&nbsp;<span class="bold">Submit</span></a>
</div>
</div>
</form>
@ -4946,7 +4946,7 @@ if (!empty($INRSYMBOL)) {
<div id="freightmodel" class="modal fade" data-backdrop-limit="1" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
<div class="modal-dialog modal-sm">
<div class="modal-dialog modal-sm" style="width: 1060px;">
<!-- Modal content-->
<div class="modal-content">
@ -4969,9 +4969,9 @@ if (!empty($INRSYMBOL)) {
</div>
<div class="modal-footer">
<a class="btn btn-danger" data-dismiss="modal"
<a class="btn btn-secondary" data-dismiss="modal"
value="Cancel">Cancel</a>
<a class="btn btn-success" ID="freightOption"
<a class="btn btn-info" ID="freightOption"
data-bs-target="#REVENUE" data-bs-toggle="modal" data-bs-dismiss="modal"
onclick="setfreightOption();"
><span class="bold">Ok</span></a>
@ -8529,11 +8529,11 @@ if (!empty($INRSYMBOL)) {
'<div class="col-md-1" >' +
'<label><br><br></label>' +
'<button class="btn btn-success" type="button" onclick="addRows(' + counters + ')"id="addbtns1" ><i class="fa fa-plus-square"></i></button></div>' +
'<button class="btn btn-success btn-sm" type="button" onclick="addRows(' + counters + ')"id="addbtns1" ><i class="fa fa-plus-square"></i></button></div>' +
'<div class="col-md-1" >' +
'<label><br><br></label>' +
'<button class="btn btn-danger remove remove_this" id="removebtns' + counters + '" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i></button></div>' +
'<button class="btn btn-danger btn-sm remove remove_this" id="removebtns' + counters + '" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i></button></div>' +
'</div>';
$('#newsdiv').append(div);
@ -8588,23 +8588,18 @@ if (!empty($INRSYMBOL)) {
div.className = "row";
div.innerHTML = '<div class="col-md-12">' +
'<div class="col-md-4">' +
'<div class="col-md-6">' +
'<label><br></label>' +
'<input type="file" name="browseFiles' + counterConstants + '" id="images1" onchange="Copyfilename(this.name); "><br>' +
'</div>' +
// '<div class="col-md-2">'+
// '<label><br><br></label>'+
// '<button class="btn btn-danger remove remove_this" id="removebtns'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-"></i>-</button></div>'+
// '</div>'+
'<div class="col-md-1" >' +
'<label><br><br></label>' +
'<button class="btn btn-success btn-sm" type="button" id="addbtns' + counters + '" onclick="addRows(' + counters + ')"><i class="fa fa-plus-square"></i></button></div>' +
'<div class="col-md-1" >' +
'<label><br><br></label>' +
'<button class="btn btn-success" type="button" id="addbtns' + counters + '" onclick="addRows(' + counters + ')"><i class="fa fa-plus-square"></i></button></div>' +
'<div class="col-md-1" >' +
'<label><br><br></label>' +
'<button class="btn btn-danger remove remove_this" id="removebtns' + counters + '" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i></button></div>' +
'<button class="btn btn-danger btn-sm remove remove_this" id="removebtns' + counters + '" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i></button></div>' +
'</div>' +

View File

@ -1505,13 +1505,16 @@ if (!empty($INRSYMBOL)) {
</div>
<div class="modal-body p-4">
<form>
<div class="radio">
<label><input type="radio" name="optPackaging" checked="checked" value='0' id="optPackaging"> Basic Amount</label>
</div>
<br>
<div class="radio">
<label><input type="radio" name="optPackaging" id="optPackaging" value='1'> After Discount Amount</label>
</div>
<div >
<input type="radio" name="optPackaging" checked="checked" value="0" id="optPackagingBasicAmount">
<label for="optPackagingBasicAmount">Basic Amount</label>
</div>
<div >
<input type="radio" name="optPackaging" id="optPackagingAfterDiscountAmount" value="1">
<label for="optPackagingAfterDiscountAmount">After Discount Amount</label>
</div>
</form>
</div>
<div class="modal-footer">

View File

@ -5097,11 +5097,11 @@ if (!empty($getlogpodtl)) {
},
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
}
// 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
// }
});
}
@ -5428,13 +5428,17 @@ if (!empty($getlogpodtl)) {
contentType: false,
processData: false,
success: function(response) {
if (response) {
if (response.data) {
$('#loader').hide();
alert(response.message);
console.log(response);
console.log(response.data.BillNo);
console.log(response.data.FilePath);
addRowToTable(response.data);
$('#billModel').modal('hide');
}else{
alert(response.message);
$('#billModel').modal('hide');
}
},
error: function(jqXHR, textStatus, errorThrown) {
@ -5463,20 +5467,28 @@ if (!empty($getlogpodtl)) {
}
}
var counter = 0;
let counter = 0;
let uploadCounter = 0; // Tracks actual uploads
//var counterConstant = 0;
$("#addmorebutton").click(function() {
counter++;
if (uploadCounter >= 5) {
alert("You can upload only five files.");
return false;
}
counter++;
var bill = <?php echo json_encode($billfile) ?>;
//alert(bill.length);
if (bill.length >= 5) {
alert("You have to upload five files only"); //this allows only 5 files;
alert("You have already uploaded maximum files "); //this allows only 5 files;
return false;
} else {
var div = document.createElement('div');
@ -5487,7 +5499,7 @@ if (!empty($getlogpodtl)) {
<br>
<input type="file" name="browseFiles" id="images${counter}" onchange="Copyfilename(${this.name}); ">
<br>
<button class="btn btn-success btn-sm add add_this" id="addbtn" onclick="addRow(${counter})">ADD</button>
<button class="btn btn-success btn-sm add add_this" id="addbtn" onclick="addRow(${counter},${bill.length})">ADD</button>
</div>
</div>
@ -5506,21 +5518,33 @@ if (!empty($getlogpodtl)) {
});
function addRow(counter) {
function addRow(counter,billLength) {
console.log("counter");
console.log(counter); //1
console.log("billLength");
console.log(billLength);
var file = $(`#images${counter}`).val();
if (file == '') {
if (file == '' ) {
alert('Please Select File..!!');
return false;
} else {
}
else if (billLength >= 5) { // Check upload limit here
alert('You can only upload a maximum of five files!');
return false;
} else {
// Increment uploadCounter and call file upload function
billLength++;
fileupload(counter);
}
}
function Copyfilename(id) {
var size = $('input[name=' + id + ']')[0].files[0].size;