Emergency PO changes-1 vadivel J 03-12--2024

This commit is contained in:
vadivelJ96 2024-12-03 18:01:58 +05:30
parent 7ad0d2853c
commit bef33dc5cd
3 changed files with 988 additions and 1169 deletions

View File

@ -297,34 +297,22 @@ class Emergencypurchaseorder extends BaseController
}
if ($POStatus == SPECIAL_PO) {
$count = $this->request->getPost('hidecounters');
$constant = $this->request->getPost('hideconstants');
$serviceFilesLength = $this->request->getPost('serviceFilesLength');
$file = $this->request->getFiles();
if($serviceFilesLength > 0){ $listOfFiles = $serviceFilesLength ;}
$arr = [];
$prefile = array();
for ($i = 1; $i <= $constant; $i++) {
for ($i = 1; $i <= $listOfFiles; $i++) {
$file = $this->request->getFile('browseFiles' . $i);
$requestfilename = $file->getName();
if (!empty($requestfilename)) {
$files = str_replace(" ", "", $requestfilename);
$fcount = 0;
foreach ($prefile as $value) {
if ($value == $files) {
$fcount++;
}
}
if ($fcount == 0) {
if ($file->isValid() && !$file->hasMoved()) {
$path = ROOTPATH.'public/uploads/BillFiles/';
if(!is_dir($path)) { mkdir($path, 0777, true); }
@ -334,28 +322,14 @@ class Emergencypurchaseorder extends BaseController
//echo $Picture;
$arr[] = array($Picture);
}
$prefile[] = $files;
}
$prefile[] = trim($requestfilename);
}
//print_r($arr);
if (!empty($arr)) {
foreach ($arr as $ma) {
$index = 0;
foreach ($ma as $key => $value) {
$index++;
if ($index == 1) {
$filename = $value;
}
}
if (!empty($filename)) {
foreach ($arr as $filename) {
$myfile = array('FilePath' => $filename, 'PONO' => $PONO);
$this->purchaseorder_model->fileupload($myfile);
}
}
}
}
@ -740,14 +714,9 @@ class Emergencypurchaseorder extends BaseController
$igrDetails = array('IGRNO' => $IGRNO, 'MaterialCode' => $MaterialCode, 'QuantityAsPerInvoice' => $QuantityAsPerInvoice, 'Remarks' => $Remarks, 'IGRItemStatus' => $IGRItemStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt);
//print_r($igrDetails);
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
$IGRItemNo = !empty($igrD) ? $igrD : '';
//echo $IGRItemNo;
$MaterialstockHistoryadd = array('Ref_No' => $IGRItemNo, 'MaterialCode' => $MaterialCode, 'Transaction_type' => 'Add', 'Ref_Type' => 'IGR', 'SupplierID' => $SupplierID, 'Quantity' => $QuantityAsPerInvoice, 'ItemValue' => $itemRate, 'CreatedBy' => $CreatedBy, 'CreatedOn' => $createddt);
@ -797,77 +766,52 @@ class Emergencypurchaseorder extends BaseController
}
//$myfile = array('FilePath'=>$filename);
// $emergencyitemcode = $this->request->getPost('emergencyitemcode'.$i);
// ($this->request->getPost('materialCode'.$i));
}
$counts = $this->request->getPost('hidecounter');
$constants = $this->request->getPost('hideconstant');
$revenueFilesLength = $this->request->getPost('revenueFilesLength');
$serviceFilesLength = $this->request->getPost('serviceFilesLength');
$file = $this->request->getFiles();
dd($file);
$arr = [];
$prefile = array();
for ($i = 1; $i <= $constants; $i++) {
$listOfFiles = 0 ;
if($revenueFilesLength > 0){ $listOfFiles = $revenueFilesLength ;}
if($serviceFilesLength > 0){ $listOfFiles = $serviceFilesLength ;}
for ($i = 1; $i <= $listOfFiles; $i++) {
$file = $this->request->getFile('browseFiles' . $i);
$requestfilename = $file->getName();
if (!empty($requestfilename)) {
$files = str_replace(" ", "", $requestfilename);
$fcount = 0;
foreach ($prefile as $value) {
if ($value == $files) {
$fcount++;
}
}
if ($fcount == 0) {
if ($file->isValid() && !$file->hasMoved()){
$path = ROOTPATH.'public/uploads/BillFiles/';
if(!is_dir($path)) { mkdir($path, 0777, true);}
$Picture = $file->getName();
$file->move($path,$Picture);
}
//echo $Picture;
$arr[] = array($Picture);
}
$prefile[] = $files;
$arr[] = array($Picture);
$prefile[] = trim($requestfilename);
}
}
if (!empty($arr)) {
foreach ($arr as $ma) {
$index = 0;
$filename = null;
foreach ($ma as $key => $value) {
$index++;
if ($index == 1) {
$filename = $value;
}
}
if (!empty($filename)) {
foreach ($arr as $filename) {
$myfile = array('FilePath' => $filename, 'PONO' => $PONO, 'IGRNO' => $IGRNO);
$this->purchaseorder_model->fileupload($myfile);
}
}
}
}

View File

@ -1422,8 +1422,6 @@ if (!empty($INRSYMBOL)) {
function SpecialPOcheck() {
// alert('splpo')
//$('#content').loader('show');
POcheck = $("input:radio[name='Quality']:checked").val();
console.log(POcheck);
@ -1432,24 +1430,8 @@ if (!empty($INRSYMBOL)) {
var row = $('#txtRowCount1').val();
var PO = $('#POType').val();
// $('#hideconstants').val(counterConstants);
var file1 = $('#images1' + counterConstants).val()
var file = $('#imag' + counterConstant).val()
// if(splrow!=row)
// {
// alert("You havent add all the material details")
// return false;
// }
// else
// {
if (PO == 'REVENUE') {
var images = $('#imag').val();
// $('#content').loader('show');
if (POcheck == 0) {
$('#txtSpecial').val(1);
$('#txtQuality').val(1);
@ -4860,17 +4842,23 @@ if (!empty($INRSYMBOL)) {
<div class="modal-body ">
<form action="">
<div class="row">
<div class="col-md-4 "><strong>Delivery Challan /Inv No</strong>
<div class="col-md-4 ">
<strong>Delivery Challan /Inv No</strong>
<span class="text-danger">*</span>
<input type="text" name="ChallanInvNo" id="ChallanInvNo" maxlength="12"
class="form-control" value="" required
onkeypress="return isNumberKey(event)">
</div>
<div class="col-md-4 "><strong>Delivery Challan /Inv Date</strong>
<div class="col-md-4 ">
<strong>Delivery Challan /Inv Date</strong>
<span class="text-danger">*</span>
<?php
$data = array('name' => 'Date1', 'value' => set_value('Date1', $CurrentDate), 'id' => 'Date1', 'class' => 'form-control num', 'required' => 'true');
echo form_input($data); ?>
</div>
<div class="col-md-4 "><strong>Material Received Date</strong>
<div class="col-md-4 ">
<strong>Material Received Date</strong>
<span class="text-danger">*</span>
<?php
$data = array('name' => 'MRC', 'value' => set_value('MRC', $CurrentDate), 'id' => 'MRC', 'class' => 'form-control num', 'required' => 'true');
echo form_input($data); ?>
@ -4878,16 +4866,21 @@ if (!empty($INRSYMBOL)) {
</div>
<div class="row">
<div class="col-md-4 mt-2 "><strong>Vehicle No</strong>
<div class="col-md-4 mt-2 ">
<strong>Vehicle No</strong>
<span class="text-danger">*</span>
<input type="text" name="VehicleNo" id="VehicleNo" maxlength="13"
class="form-control" value="" required>
</div>
<div class="col-md-4 mt-2 "><strong>Courier No</strong>
<div class="col-md-4 mt-2 ">
<strong>Courier No</strong>
<span class="text-danger">*</span>
<input type="text" name="CourierNo" id="CourierNo" maxlength="12"
class="form-control" value="" required>
</div>
<div class="col-md-4 mt-2" id="QualityChecked"><strong>Is Quality Check
<div class="col-md-4 mt-2" id="QualityChecked">
<strong>Is Quality Check
Required</strong>
<div class="radio m-2">
<input type="radio" name="Quality" checked="checked" value='0'
@ -4921,9 +4914,11 @@ if (!empty($INRSYMBOL)) {
<div class="col-md-12 " align="right">
<a class="btn btn-secondary" data-dismiss="modal"
onclick="SetExciseCalculationCancel();" value="Cancel">Cancel</a>
onclick="SetExciseCalculationCancel();" value="Cancel">Cancel
</a>
<a class="btn btn-info ok" ID="ExciseOption12"
onclick="rfilealert();">&nbsp;&nbsp;<span class="bold">Submit</span></a>
onclick="rfilealert();">&nbsp;&nbsp;<span class="bold">Submit</span>
</a>
</div>
</div>
</form>
@ -4956,12 +4951,18 @@ if (!empty($INRSYMBOL)) {
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body" style="padding:0px;">
<div class="col-md-12" align="left">
<div class="row">
<div class="col-md-12">
<button type="button" class="btn btn-success" id="addMoreServiceFileButton">Add
File</button>
<button type="button" class="btn btn-danger" id="removeServiceFileButton">Remove
File</button>
<div class="col-md-offset-0 col-md-1">
<input type="button" class="btn btn-success" id="addemorebutton"
value=" + ADD FILES..">
<div id="newdiv"></div>
</div>
</div>
<div id="newsdiv"></div><!-- this div for add more section-->
@ -5012,8 +5013,8 @@ if (!empty($INRSYMBOL)) {
<div class="radio">
<input type="radio" name="optfreight" checked="checked" value='0'
id="optfreightBasicAmount"> <label for="optfreightBasicAmount">Basic Amount</label>
<input type="radio" name="optfreight" checked="checked" value='0' id="optfreightBasicAmount">
<label for="optfreightBasicAmount">Basic Amount</label>
</div>
<br>
<div class="radio">
@ -5045,8 +5046,8 @@ if (!empty($INRSYMBOL)) {
<div class="modal-body">
<form>
<div class="radio">
<label><input type="radio" name="optExcise" checked="checked" value="0"
id="optExcise">From Basic Amount</label>
<label><input type="radio" name="optExcise" checked="checked" value="0" id="optExcise">From
Basic Amount</label>
</div>
<div class="radio">
<label><input type="radio" name="optExcise" value="1" id="optExcise">Basic
@ -5099,8 +5100,7 @@ if (!empty($INRSYMBOL)) {
</form>
</div>
<div class="modal-footer">
<a class="btn btn-cancel" data-dismiss="modal" style="margin-top: -24px;"
value="Cancel">Cancel</a>
<a class="btn btn-cancel" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
<a class="btn btn-success" ID="VatOption" onclick="SetVatCalculation();"
style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
</div>
@ -5132,8 +5132,7 @@ if (!empty($INRSYMBOL)) {
</form>
</div>
<div class="modal-footer">
<a class="btn btn-cancel" data-dismiss="modal" style="margin-top: -24px;"
value="Cancel">Cancel</a>
<a class="btn btn-cancel" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
<a class="btn btn-success" ID="CSTOption" onclick="SetCSTCalculation();"
style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
</div>
@ -5308,8 +5307,7 @@ if (!empty($INRSYMBOL)) {
</div>
</div>
<div class="col-md-3">
<label><?php echo "Rate ($INRSYM)"; ?><span
class="badge mandatory">*</span></label>
<label><?php echo "Rate ($INRSYM)"; ?><span class="badge mandatory">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'EditRate', 'value' => set_value('EditRate'), 'id' => 'EditRate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'EditRatechange()');
@ -5589,8 +5587,7 @@ if (!empty($INRSYMBOL)) {
</div>
<div class="col-md-3" style="padding-right: 0px;">
<label><?php echo "Rate ($INRSYM)"; ?><span
class="badge mandatory">*</span></label>
<label><?php echo "Rate ($INRSYM)"; ?><span class="badge mandatory">*</span></label>
<div class="form-group">
<?php
$data = array('name' => 'EditRevenueRate', 'value' => set_value('EditRate'), 'id' => 'EditRevenueRate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Editchange()', 'style' => 'text-align:right;');
@ -5885,8 +5882,8 @@ if (!empty($INRSYMBOL)) {
<div class="modal-footer">
<div class="col-md-12 text-right">
<a class="btn btn-secondary waves-effect" data-dismiss="modal" value="Cancel">Cancel</a>
<a class="btn btn-success EditRevenue" ID="EditRevenue"> &nbsp;&nbsp;<span
class="bold">Edit Revenue</span></a>
<a class="btn btn-success EditRevenue" ID="EditRevenue"> &nbsp;&nbsp;<span class="bold">Edit
Revenue</span></a>
</div>
</div>
</div>
@ -7216,6 +7213,18 @@ if (!empty($INRSYMBOL)) {
formData.append('TextStatus', stat);
formData.append('PaymentMethod', $('#PaymentMethod').val());
formData.append('workStatus', $('#workstatusValue').val());
formData.append('serviceFilesLength', $('.servicefiles').length);
//add igr files too here ..!!
$('input[type="file"]').each(function () {
const inputName = $(this).attr('name');
const files = this.files;
if (files.length > 0) {
const file = files[0];
formData.append(inputName, file);
}
});
// Perform form validation
if (validate()) {
@ -7301,8 +7310,31 @@ if (!empty($INRSYMBOL)) {
formData.append('TextStatus', stat);
formData.append('PaymentMethod', $('#PaymentMethod').val());
formData.append('workStatus', $('#workstatusValue').val());
formData.append('ChallanInvNo',$('#ChallanInvNo').val());
formData.append('ChallanInvDate',$('#Date1').val());
//abbreviation
//MRC --> material received
formData.append('MRC',$('#MRC').val());
formData.append('VehicleNo',$('#VehicleNo').val());
formData.append('CourierNo',$('#CourierNo').val());
formData.append('Quality', $('input[name="Quality"]:checked').val());
formData.append('igrStatusForMRC','ST027');
formData.append('revenueFilesLength', $('.revenuefiles').length);
//need to update the Igr status here..!!ST027 because material already recieved..!!
//add igr files too here ..!!
$('input[type="file"]').each(function () {
const inputName = $(this).attr('name'); // Get the `name` attribute
const files = this.files; // Get the FileList
if (files.length > 0) {
const file = files[0]; // Get the first file (or loop through for multiple files)
formData.append(inputName, file); // Append the file to FormData
}
});
// Perform form validation
@ -7329,8 +7361,7 @@ if (!empty($INRSYMBOL)) {
processData: false, // Prevent jQuery from automatically transforming the data into a query string
contentType: false, // Prevent jQuery from setting the content type header
success: function (data) {
// Handle the server response
// alert(data);
$('#loader').hide();
$('#txtRowCount1').val('');
$('#txtDeletedRow1').val('');
@ -8361,30 +8392,32 @@ if (!empty($INRSYMBOL)) {
});
// var count = 0;
// var countConstant = 0;
function rfilealert() {
//alert(counterConstant);
var file = $('#imag').val();
//var file = $('#imag').val();
// alert(file);
if (file == '') {
alert('File not found');
let result = validateIgrDetails();
if(result){
SpecialPOcheck();
// addtable();
}else{
SpecialPOcheck();
// addtable();
alert('Kindly fill all the mandatory details..!!');
return;
}
}
function validateIgrDetails (){
let ChallanInvNo = $('#ChallanInvNo').val().trim();
let Date1 = $('#Date1').val().trim();
let MRC = $('#MRC').val().trim();
let VehicleNo = $('#VehicleNo').val().trim();
let CourierNo = $('#CourierNo').val().trim();
if(ChallanInvNo && Date1 && MRC && VehicleNo && CourierNo ){
return true;
}else{
return false;
}
}
function Copyfilename(id) {
@ -8406,180 +8439,62 @@ if (!empty($INRSYMBOL)) {
}
function removeRow(input) {
// alert(input);
var number = input.replace(/[^0-9]+/ig, "");
//alert(number);
if (counter >= 1) {
counter--;
$("#divid" + number).remove();
$('#hidecounter').val(counter);
}
var rm_count = $("#hideconstant").val();
if (counter != 0) {
if (number != rm_count) {
// alert("if");
$("#addbtn" + counter).show();
$("#removebtn" + counter).show();
} else {
//alert('else');
$("#addbtn" + counter).show();
$("#removebtn" + counter).show();
}
} else {
$("#addmorebutton").show();
}
}
//this script used to multiple file upoads in service//
$("#addMoreServiceFileButton").click(function () {
let filesAdded = $(".servicefiles").length;
var counters = 0;
var counterConstants = 0;
$("#addemorebutton").click(function () {
if (counters > 4) {
alert("You have to upload five files only"); //this allows only 5 files;
return false;
if (filesAdded >= 5) {
alert("Maximum of five files Only be uploaded..!!");
return;
} else {
$("#removeServiceFileButton").show();
counters++;
counterConstants++;
filesAdded++;
let newFile = filesAdded;
var div = document.createElement('div');
div.id = "divid" + counters;
div.className = "row p-2";
div.id = "divid" + newFile;
div.className = "row servicefiles mt-2";
div.innerHTML =
'<div class="col-md-4" >' +
'<label>Select Service Bill</label>' +
'<input type="file" id="images1" name="browseFiles' + counterConstants + '" onchange="Copyfilenames(this.name);"><br>' +
'<br>' +
'<div class="col-md-3">' +
'<label>Select File</label>' +
'<input type="file" name="browseFiles' + newFile + '" "><br>' +
'</div>' +
'<br>';
$('#newdiv').append(div);
'<div class="col-md-1 " >' +
'<label><br><br></label>' +
'<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 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);
$('#hidecounters').val(counters);
$('#hideconstants').val(counterConstants);
if (counters > 1) {
alert("Add button click here"); //this allows only 5 files;
return false;
} else {
$('#addemorebutton').hide();
$('#hidecounter').val(newFile);
$('#hideconstant').val(newFile);
}
// document.write("browseFiles"+length);
})
$("#removeServiceFileButton").click(function () {
let filesAdded = $(".servicefiles").length;
if (filesAdded > 1) {
$(".servicefiles:last").remove();
} else if (filesAdded == 1) {
$(".servicefiles:last").remove();
$('#removeServiceFileButton').hide();
}
});
function addRows(inputs) {
if (inputs < 5) {
if (inputs == 0) {
inputs = inputs + 1;
$("#addbtns" + inputs).hide();
$("#removebtns" + inputs).hide();
} else {
$("#addbtns" + inputs).hide();
$("#removebtns" + inputs).hide();
}
} else {
$("#addbtns" + inputs).show();
$("#removebtns" + inputs).show();
}
// alert(s);
if (counters > 4) {
alert("No more files to add"); //this allows only 5 files;
return false;
} else {
counters++;
counterConstants++;
//alert("count"+counterConstants);
var div = document.createElement('div');
div.id = "divid" + counters;
div.className = "row p-2";
div.innerHTML =
'<div class="col-md-4">' +
'<label>Select Service Bill</label>' +
'<input type="file" name="browseFiles' + counterConstants + '" id="images1" onchange="Copyfilename(this.name); "><br>' +
'</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-danger btn-sm remove remove_this" id="removebtns' + counters + '" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i></button></div>' +
'</div>' +
'</div>';
$('#newsdiv').append(div);
$('#hidecounters').val(counters);
$('#hideconstants').val(counterConstants);
if (counters > 1) {
//alert("Next File choose + button click here");//this allows only 5 files;
//return false;
$('#addbtns').hide();
$("#removebtns").hide();
} else {
$('#addemorebutton').hide();
}
}
}
function sfilealert() {
//alert(counterConstants);
var file1 = $('#images1').val();
//$('input[name='+id+']')[0].files[0].size;
if (file1 == '') {
alert('File not found');
SpecialPOcheck();
} else {
SpecialPOcheck();
}
}
}
function Copyfilenames(id) {
@ -8602,47 +8517,7 @@ if (!empty($INRSYMBOL)) {
// function removeRows(input) {
// var number = input.replace(/[^0-9]+/ig,"");
// if(counters>= 1){
// counters --;
// $("#divid"+number).remove();
// $('#hidecounters').val(counters);
// }
// }
function removeRows(inputs) {
// alert(input);
var number = inputs.replace(/[^0-9]+/ig, "");
//alert(number);
if (counters >= 1) {
counters--;
$("#divid" + number).remove();
$('#hidecounters').val(counters);
}
var rm_count = $("#hideconstants").val();
if (counters != 0) {
if (number != rm_count) {
// alert("if");
$("#addbtns" + counters).show();
$("#removebtns" + counters).show();
} else {
//alert('else');
$("#addbtns" + counters).show();
$("#removebtns" + counters).show();
}
} else {
$("#addemorebutton").show();
}
}
</script>
<script>
$('#IsOpenOrder').change(function () {

View File

@ -2633,7 +2633,7 @@ if (!empty($getlogpodtl)) {
<div class="form-row" style="padding-bottom: 10px;">
<div class=" col-md-8 px-2">
<label>Upload Purchase Order Bill </label>
<label>Upload IGR Bill </label>
<input type="button" class="btn btn-success" id="addmorebutton"
value=" ADD FILES "><br>