Merge branch 'CI4-Application' of bitbucket.org:venbainformationtechnology/ria into CI4-Application
This commit is contained in:
commit
cbac7653a8
@ -322,22 +322,47 @@ class Inwardgateregister extends BaseController
|
||||
$createddt = get_current_date_time();
|
||||
//$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;
|
||||
$constant = $this->request->getPost('hideconstants');
|
||||
$arr = []; // For File to Save
|
||||
$prefile = array();
|
||||
|
||||
$fileupdated_count = 0;
|
||||
$fileupdated_name = [];
|
||||
|
||||
#Step 1 File Path Creation
|
||||
$path = ROOTPATH.'public/uploads/Igrfiles/';
|
||||
if(!is_dir($path)) { mkdir($path, 0777, true); }
|
||||
|
||||
#Step 2 Master File and Its Details Gathering
|
||||
$MasterFile = $this->request->getFile('MasterFile');
|
||||
$requestMasterFileName = $MasterFile->getName();
|
||||
|
||||
if (!empty($requestMasterFileName)) {
|
||||
if ($MasterFile && $MasterFile->isValid() && !$MasterFile->hasMoved()) {
|
||||
if (!empty($this->inwardgateregister_model->isFileExistsInIGRmaster($requestMasterFileName))) {
|
||||
log_message('error', 'File already exists in the database'.$requestMasterFileName);
|
||||
$requestMasterFileName = NULL;
|
||||
}
|
||||
else{
|
||||
$MasterFile->move($path, $requestMasterFileName);
|
||||
$fileupdated_count++;
|
||||
$fileupdated_name[] = $requestMasterFileName;
|
||||
}
|
||||
}else{
|
||||
$requestMasterFileName = NULL;
|
||||
}
|
||||
}else{
|
||||
$requestMasterFileName = NULL;
|
||||
}
|
||||
|
||||
#Step 3 Master Details Gathering to Save In DB
|
||||
$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
|
||||
$igr['MasterFile'] = $requestMasterFileName;
|
||||
#Step 4 Calling DB to Save IGR Master
|
||||
$IGRNO = $this->inwardgateregister_model->addigrM($igr);
|
||||
|
||||
// $IGRNO = "IGRNO02734";
|
||||
if($IGRNO){
|
||||
#Step 1.1 Fetch On History
|
||||
#Step 5 Save Master Detail On History Table
|
||||
if($VehicleNo){
|
||||
$igr_history = array('field' => 'VehicleNo','is_add' => 1,'new_data' => $VehicleNo,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO);
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
@ -353,73 +378,15 @@ class Inwardgateregister extends BaseController
|
||||
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||
}
|
||||
#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
|
||||
#Step 6 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
|
||||
#Step 7 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;
|
||||
@ -438,6 +405,29 @@ class Inwardgateregister extends BaseController
|
||||
$NetWeight= $this->request->getPost('txtNetWeight' . $i);
|
||||
// var_dump($grossWeightDate);
|
||||
// var_dump($tareWeightDate);
|
||||
#Step 8 Saving Weight File and Its Details Gathering
|
||||
$WeightFile = $this->request->getFile('txtWeightFile' . $i);
|
||||
$requestWeightFileName = $WeightFile->getName();
|
||||
// echo $i.$requestWeightFileName;die;
|
||||
|
||||
if (!empty($requestWeightFileName)) {
|
||||
if ($WeightFile && $WeightFile->isValid() && !$WeightFile->hasMoved()) {
|
||||
// $WeightFile->move($path, $requestWeightFileName);
|
||||
if (!empty($this->inwardgateregister_model->isFileExistsInIGRdetails($requestWeightFileName))) {
|
||||
log_message('error', 'File already exists in the database'.$requestWeightFileName);
|
||||
$requestWeightFileName = NULL;
|
||||
}
|
||||
else{
|
||||
$WeightFile->move($path, $requestWeightFileName);
|
||||
$fileupdated_count++;
|
||||
$fileupdated_name[] = $requestWeightFileName;
|
||||
}
|
||||
}else{
|
||||
$requestWeightFileName = NULL;
|
||||
}
|
||||
}else{
|
||||
$requestWeightFileName = NULL;
|
||||
}
|
||||
|
||||
$GrossWeightDate = !empty($grossWeightDate) && is_string($grossWeightDate) ? date('Y-m-d H:i:s', strtotime($grossWeightDate)) : null;
|
||||
$TareWeightDate = !empty($tareWeightDate) && is_string($tareWeightDate) ? date('Y-m-d H:i:s', strtotime($tareWeightDate)) : null;
|
||||
@ -454,6 +444,7 @@ class Inwardgateregister extends BaseController
|
||||
|
||||
$CreatedBy = $this->session->get('userId');
|
||||
$igrDetails = array('IGRNO' => $IGRNO, 'MaterialCode' => $MaterialCode, 'QuantityAsPerInvoice' => $QuantityAsPerInvoice, 'Remarks' => $Remarks, 'IGRItemStatus' => $IGRItemStatus,'GrossWeight' => (float)$GrossWeight ,'GrossWeightDate'=> $GrossWeightDate,'TareWeight' => (float)$TareWeight ,'TareWeightDate' => $TareWeightDate ,'NetWeight' => (float)$NetWeight, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt);
|
||||
$igrDetails['WeightFile'] = $requestWeightFileName;
|
||||
log_message('error', 'SaveIGR igrDetails result : ' . json_encode($igrDetails));
|
||||
|
||||
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
|
||||
@ -532,7 +523,7 @@ class Inwardgateregister extends BaseController
|
||||
|
||||
$this->inwardgateregister_model->UpdatePOMaster($PONO, $CreatedBy);
|
||||
|
||||
#Step 6 Updating Pending Quantity IN PO Master amd Line Item Details.
|
||||
#Step 9 Updating Pending Quantity IN PO Master amd Line Item Details.
|
||||
if ($TotalPendingQty == 0.00) {
|
||||
$Newstatus = array('Status' => $IGRStatus);
|
||||
$this->inwardgateregister_model->POLineItemsupdatestatus($PONO, $Newstatus);
|
||||
@ -544,7 +535,7 @@ class Inwardgateregister extends BaseController
|
||||
$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);
|
||||
$finalstatement .= "Files: \n" . implode(PHP_EOL, $fileupdated_name);
|
||||
} else {
|
||||
$finalstatement .= "No files to update";
|
||||
}
|
||||
@ -579,7 +570,7 @@ function viewIGRDetails()
|
||||
{
|
||||
$IGRNO = $this->request->getPost('id');
|
||||
$igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO);
|
||||
$billfile = $this->inwardgateregister_model->ViewIGRfile1($IGRNO);
|
||||
$billfile = []; // $this->inwardgateregister_model->ViewIGRfile1($IGRNO);
|
||||
$data = array_merge($igrfile, $billfile);
|
||||
echo json_encode($data);
|
||||
}
|
||||
@ -616,9 +607,31 @@ function viewIGRDetails()
|
||||
$IGRStatus = (int)$this->request->getPost('status') == 1 ? IGR_CREATED : IGR_DRAFT;
|
||||
|
||||
$tableData = $this->request->getPost('tableData');
|
||||
if (is_string($tableData)) {
|
||||
$tableData = json_decode($tableData, true);
|
||||
}
|
||||
$updateby = $this->session->get('userId');
|
||||
|
||||
$path = ROOTPATH.'public/uploads/Igrfiles/';
|
||||
if(!is_dir($path)) { mkdir($path, 0777, true); }
|
||||
|
||||
$igrarr = array('DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt,'VehicleNo'=>$VehicleNo,'DriverMobileNumber'=>$DriverMobileNumber,'DriverName'=>$DriverName, 'IGRStatus' => $IGRStatus,'UpdateBY' => $updateby);
|
||||
|
||||
$MasterFile = $this->request->getfile('MasterFile');
|
||||
$requestMasterFileName = $MasterFile->getName();
|
||||
|
||||
if (!empty($requestMasterFileName)) {
|
||||
if ($MasterFile && $MasterFile->isValid() && !$MasterFile->hasMoved()) {
|
||||
if (!empty($this->inwardgateregister_model->isFileExistsInIGRmaster($requestMasterFileName))) {
|
||||
log_message('error', 'File already exists in the database'.$requestMasterFileName);
|
||||
}
|
||||
else{
|
||||
$MasterFile->move($path, $requestMasterFileName);
|
||||
$igrarr['MasterFile'] = $requestMasterFileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log_message('error', 'UpdateIGR igrarr: ' . json_encode($igrarr));
|
||||
$updateigrmaster = $this->inwardgateregister_model->updateigr($igrarr, $IGRNo);
|
||||
if(!empty($tableData )){
|
||||
@ -701,6 +714,21 @@ function viewIGRDetails()
|
||||
'IGRItemNo' => $igrItemNo,
|
||||
'UpdateBY' => $updateby
|
||||
);
|
||||
// $WeightFile = $this->request->getfile('WeightFile');
|
||||
// $requestWeightFileName = $WeightFile->getName();
|
||||
|
||||
// if (!empty($requestWeightFileName)) {
|
||||
// if ($WeightFile && $WeightFile->isValid() && !$WeightFile->hasMoved()) {
|
||||
// if (!empty($this->inwardgateregister_model->isFileExistsInIGRdetails($requestWeightFileName))) {
|
||||
// log_message('error', 'File already exists in the database'.$requestWeightFileName);
|
||||
// }
|
||||
// else{
|
||||
// $WeightFile->move($path, $requestWeightFileName);
|
||||
// $igrline['WeightFile'] = $requestWeightFileName;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
$updateigrlineitem = $this->inwardgateregister_model->updateIGRLineItem($igrline, $igrItemNo);
|
||||
log_message('error', "lineitem updated successfully: " . $updateigrlineitem);
|
||||
log_message('error', 'UpdateIGR updateigrlineitem: ' . json_encode($igrline));
|
||||
@ -1139,6 +1167,11 @@ function updateIGRWeight(){
|
||||
$IGRNO = $this->request->getPost('IGR');
|
||||
$IGRItemNo = $this->request->getPost('IGRlineitem');
|
||||
$updateby = $this->session->get('userId');
|
||||
$WeightFile = $this->request->getfile('WeightFile');
|
||||
$requestWeightFileName = $WeightFile->getName();
|
||||
$path = ROOTPATH.'public/uploads/Igrfiles/';
|
||||
if(!is_dir($path)) { mkdir($path, 0777, true); }
|
||||
|
||||
if($GrossWeight){
|
||||
$gross = $this->inwardgateregister_model->get_igr_history('GrossWeight',$IGRNO, $IGRItemNo);
|
||||
if(!empty($gross)){
|
||||
@ -1241,6 +1274,17 @@ function updateIGRWeight(){
|
||||
$IGRItemNo = $this->request->getPost('IGRlineitem');
|
||||
$igr_lineitem = array('GrossWeight' => $GrossWeight,'GrossWeightDate' => $GrossWeightDate,'TareWeightDate' => $TareWeightDate,'TareWeight' => $TareWeight,'NetWeight' => $NetWeight,'UpdateBY' => $updateby);
|
||||
|
||||
if (!empty($requestWeightFileName)) {
|
||||
if ($WeightFile && $WeightFile->isValid() && !$WeightFile->hasMoved()) {
|
||||
if (!empty($this->inwardgateregister_model->isFileExistsInIGRdetails($requestWeightFileName))) {
|
||||
log_message('error', 'File already exists in the database'.$requestWeightFileName);
|
||||
}
|
||||
else{
|
||||
$WeightFile->move($path, $requestWeightFileName);
|
||||
$igr_lineitem['WeightFile'] = $requestWeightFileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
$update = $this->inwardgateregister_model->updateIGRLineItem($igr_lineitem, $IGRItemNo);
|
||||
|
||||
if ($update) {
|
||||
|
||||
@ -904,6 +904,18 @@ class Inwardgateregister_model extends Model
|
||||
// Pass the result to the view or return it as JSON
|
||||
// return $this->response->setJSON($result);
|
||||
}
|
||||
public function isFileExistsInIGRmaster($filename)
|
||||
{
|
||||
$result = $this->db->table('t_igr_master')->where('MasterFile', $filename);
|
||||
$query = $result->get();
|
||||
return $query->getResult();
|
||||
}
|
||||
public function isFileExistsInIGRdetails($filename)
|
||||
{
|
||||
$result = $this->db->table('t_igr_details')->where('WeightFile', $filename);
|
||||
$query = $result->get();
|
||||
return $query->getResult();
|
||||
}
|
||||
|
||||
public function getCostCenterData($pono)
|
||||
{
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.3.4/jquery.inputmask.bundle.min.js"></script>
|
||||
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
||||
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
||||
@ -6,12 +5,12 @@
|
||||
#MaterialRcvdDate {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#InvoiceDate {
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#PONO").select2();
|
||||
@ -19,11 +18,17 @@
|
||||
|
||||
$("#InvoiceDate").datepicker({
|
||||
maxDate: 'now',
|
||||
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
||||
dateFormat: 'dd-mm-yy',
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
yearRange: '-100:+0'
|
||||
});
|
||||
$("#MaterialRcvdDate").datepicker({
|
||||
maxDate: 'now',
|
||||
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
||||
dateFormat: 'dd-mm-yy',
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
yearRange: '-100:+0'
|
||||
}).datepicker("setDate", new Date());
|
||||
|
||||
});
|
||||
@ -52,12 +57,15 @@
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.select2 {
|
||||
width: 100% ! important;
|
||||
}
|
||||
|
||||
.num {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.dataTables_wrapper {
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
@ -66,20 +74,21 @@
|
||||
<div class="content-wrapper" style="min-height:537px;">
|
||||
|
||||
<section class="content-header">
|
||||
<h5><div class="pull-right hidden-xs">
|
||||
<b><div id="wizard_clock"></div></b>
|
||||
</div></h5>
|
||||
<h5>
|
||||
<div class="pull-right hidden-xs">
|
||||
<b>
|
||||
<div id="wizard_clock"></div>
|
||||
</b>
|
||||
</div>
|
||||
</h5>
|
||||
<h1>
|
||||
<center> Inward Gate Register </center>
|
||||
</h1>
|
||||
|
||||
</section>
|
||||
<section class="content" style="margin: 15px;"><br />
|
||||
<div style="border:2px solid #333;">
|
||||
|
||||
|
||||
<form action ="<?php echo base_url()?>SaveIGR"
|
||||
method="post" enctype="multipart/form-data">
|
||||
<form action="<?php echo base_url() ?>SaveIGR" method="post" enctype="multipart/form-data">
|
||||
<div class="row"><br /><br />
|
||||
<div id="content"> </div>
|
||||
<div class="col-md-12">
|
||||
@ -160,35 +169,11 @@
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<!-- <div class="col-md-3">
|
||||
<label>Courier No</label>
|
||||
<?php
|
||||
// $data = array('name' => 'CourierNo','value' => set_value('CourierNo'),'id'=>'CourierNo', 'class' => 'form-control','onkeypress'=>'return isNumberKey(event);' );
|
||||
// echo form_input($data);
|
||||
?>
|
||||
</div> -->
|
||||
</div>
|
||||
<!-- <div class="col-md-12">
|
||||
<div class="col-md-offset-4">
|
||||
<div class="box-header">
|
||||
<input type="file" accept=".png,.jpg,.pdf" id="myfile" name="myfile" />
|
||||
<label for="photo">Select File to upload<br/></label>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-12" style="margin-top: 10px;">
|
||||
|
||||
<!-- <input type="button" class="btn btn-primary" 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" />
|
||||
<input type="hidden" name="hideIGRStatus" id="hideIGRStatus" value="0" />
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@ -209,9 +194,7 @@
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id ="IGRappend">
|
||||
|
||||
</tbody>
|
||||
<tbody id="IGRappend"></tbody>
|
||||
|
||||
|
||||
|
||||
@ -222,7 +205,7 @@
|
||||
|
||||
|
||||
<div class="col-md-4 col-md-offset-8">
|
||||
<input type="file" name="browseFiles1" id="images1" onchange="Copyfilenames(this.name); "><br>
|
||||
<input type="file" name="MasterFile" 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>
|
||||
@ -240,7 +223,9 @@
|
||||
|
||||
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<center><h4>Inward Gate Register Number</h4></center>
|
||||
<center>
|
||||
<h4>Inward Gate Register Number</h4>
|
||||
</center>
|
||||
</div>
|
||||
<div class="col-md-12"> <br />
|
||||
|
||||
@ -265,9 +250,13 @@
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<center><h4>Weight Calculator</h4><div id="WeightTitle"></div></center>
|
||||
<center>
|
||||
<h4>Weight Calculator<span id="WeightTitle"></span></h4>
|
||||
</center>
|
||||
<div class="pull-right hidden-xs">
|
||||
<b><div id="clock"></div></b>
|
||||
<b>
|
||||
<div id="clock"></div>
|
||||
</b>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12"> <br />
|
||||
@ -316,6 +305,10 @@
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<input type="file" name="WeightFile" id="WeightFile" onchange="Copyfilenames(this.name); "><br>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- </div> -->
|
||||
@ -351,70 +344,47 @@
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function validate()
|
||||
{
|
||||
function validate() {
|
||||
var rowcount = $("#txtRowCount").val();
|
||||
|
||||
var Noval = 0;
|
||||
var isExceed = 0;
|
||||
for(k=1;k<=rowcount ; k++)
|
||||
{
|
||||
var AdvisedQty = parseFloat( $('#QuantityAsPerInvoice'+k).val() == '' ? '0.00' : $('#QuantityAsPerInvoice'+k).val());
|
||||
for (k = 1; k <= rowcount; k++) {
|
||||
var InvoiceQty = parseFloat($('#QuantityAsPerInvoice' + k).val() == '' ? '0.00' : $('#QuantityAsPerInvoice' + k).val());
|
||||
var RecQty = parseFloat($('#txtReceivedQuantity' + k).val() == '' ? '0.00' : $('#txtReceivedQuantity' + k).val());
|
||||
var OrderedQty = parseFloat($('#Quantity_1' + k).text());
|
||||
if(AdvisedQty != '0.00')
|
||||
{
|
||||
if (InvoiceQty != '0.00') {
|
||||
|
||||
if(OrderedQty < (AdvisedQty+RecQty))
|
||||
{
|
||||
if (OrderedQty < (InvoiceQty + RecQty)) {
|
||||
isExceed = 1;
|
||||
return false;
|
||||
}
|
||||
Noval = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($('#PONO').val()=='-1')
|
||||
{
|
||||
|
||||
if ($('#PONO').val() == '-1') {
|
||||
alert("Please select PurchaseOrder");
|
||||
$('#PONO').focus();
|
||||
return false;
|
||||
}
|
||||
else if($('#InvoiceNo').val() == '' )
|
||||
{
|
||||
} else if ($('#InvoiceNo').val() == '') {
|
||||
alert('Please Enter Invoice Number');
|
||||
$('#InvoiceNo').focus();
|
||||
return false;
|
||||
}
|
||||
else if($('#InvoiceDate').val() == '' )
|
||||
{
|
||||
} else if ($('#InvoiceDate').val() == '') {
|
||||
alert('Please Enter Invoice Date');
|
||||
$('#InvoiceDate').focus();
|
||||
return false;
|
||||
}
|
||||
else if($('#MaterialRcvdDate').val() == '' )
|
||||
{
|
||||
} else if ($('#MaterialRcvdDate').val() == '') {
|
||||
alert('Please Enter Material Received Date');
|
||||
$('#MaterialRcvdDate').focus();
|
||||
return false;
|
||||
}
|
||||
else if (Noval == 0 )
|
||||
{
|
||||
|
||||
alert('Advised Quantity is Empty.Please Enter the value');
|
||||
} else if (Noval == 0) {
|
||||
alert('Invoice Quantity is Empty.Please Enter the value');
|
||||
return false;
|
||||
|
||||
}
|
||||
else if(isExceed == 1 ){
|
||||
|
||||
alert("Advised Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
||||
} else if (isExceed == 1) {
|
||||
alert("Invoice Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -428,30 +398,29 @@ function validate()
|
||||
"ordering": false,
|
||||
"info": false,
|
||||
"autoWidth": false
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// $(function() {
|
||||
function removeHidden()
|
||||
{
|
||||
function removeHidden() {
|
||||
var rowcount = $("#txtRowCount").val();
|
||||
for(k=1;k<=rowcount ; k++)
|
||||
{
|
||||
for (k = 1; k <= rowcount; k++) {
|
||||
$("#MaterialCode" + k).remove();
|
||||
$("#txtQuantityAsPerInvoice" + k).remove();
|
||||
$("#OrderedQuantity" + k).remove();
|
||||
$("#txtReceivedQuantity" + k).remove();
|
||||
$("#txtRemarks" + k).remove();
|
||||
$("#txtPendingQty" + k).remove();
|
||||
|
||||
$("#txtGrossWeight" + k).remove();
|
||||
$("#txtGrossWeightDate" + k).remove();
|
||||
$("#txtTareWeight" + k).remove();
|
||||
$("#txtTareWeightDate" + k).remove();
|
||||
$("#txtNetWeight" + k).remove();
|
||||
$("#txtWeightFile" + k).remove();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -459,30 +428,22 @@ function validate()
|
||||
removeHidden();
|
||||
$("#IGRappend").empty();
|
||||
$('#txtRowCount').val('');
|
||||
|
||||
var id = $('#PONO').val();
|
||||
var status = '';
|
||||
if(id != '-1')
|
||||
{
|
||||
|
||||
if (id != '-1') {
|
||||
$('#content').loader('show');
|
||||
var y = <?php echo json_encode($PO_NO, JSON_PRETTY_PRINT) ?>;
|
||||
|
||||
$.each(y, function(idx, obj) {
|
||||
|
||||
if(id == obj.PONO)
|
||||
{
|
||||
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);
|
||||
var isOpenOrder = parseInt(obj.IsOpenOrder, 2);
|
||||
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
|
||||
$('.help-block').text(formatted_IsOpenOrder);
|
||||
|
||||
//$("#Add").val(obj.Address);
|
||||
$("#del").val(obj.DeliveryDate);
|
||||
//$("#ser").val(obj.ServiceDescription);
|
||||
@ -490,31 +451,21 @@ function validate()
|
||||
ostatus = obj.OGR_Status;
|
||||
formatted_PODate = obj.formatted_PODate;
|
||||
formatted_IsOpenOrder = obj.formatted_IsOpenOrder;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//alert(ostatus)
|
||||
$.ajax({
|
||||
data: { id: id },
|
||||
type: "POST",
|
||||
url: "<?php echo base_url() ?>GetIGRLineItemDetails",
|
||||
|
||||
success: function(data) {
|
||||
|
||||
//alert(data);
|
||||
|
||||
$('#content').loader('hide');
|
||||
//alert(data);
|
||||
var trHTML = '';
|
||||
|
||||
var j = 0;
|
||||
var showTable = false;
|
||||
|
||||
|
||||
$.each(JSON.parse(data), function(i, item) {
|
||||
showTable = true;
|
||||
|
||||
if (showTable) {
|
||||
i = i + 1;
|
||||
j = j + 1;
|
||||
@ -527,13 +478,8 @@ function validate()
|
||||
'<td name="ReceivedQuantity' + i + '" id="ReceivedQuantity' + i + '">' + item.ReceivedQuantity + '</td>' +
|
||||
'<td name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + item.PendingQty + '</td>' +
|
||||
'<td data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="" onkeypress="return isNumberKey(event);"></td>' +
|
||||
|
||||
'<td><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')"> </td>' +
|
||||
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
||||
|
||||
|
||||
|
||||
|
||||
'</tr>';
|
||||
$('#txtRowCount').val(i);
|
||||
|
||||
@ -543,18 +489,18 @@ function validate()
|
||||
value: item.MaterialCode,
|
||||
name: 'MaterialCode' + i
|
||||
}).appendTo('form');
|
||||
|
||||
$('<input>').attr({
|
||||
type: 'hidden',
|
||||
id: 'txtQuantityAsPerInvoice' + i,
|
||||
name: 'txtQuantityAsPerInvoice' + i
|
||||
}).appendTo('form');
|
||||
|
||||
$('<input>').attr({
|
||||
type: 'hidden',
|
||||
id: 'OrderedQuantity' + i,
|
||||
|
||||
value: item.Quantity,
|
||||
name: 'OrderedQuantity' + i
|
||||
|
||||
}).appendTo('form');
|
||||
|
||||
$('<input>').attr({
|
||||
@ -576,30 +522,35 @@ $('<input>').attr({
|
||||
name: 'txtPendingQty' + i,
|
||||
value: item.PendingQty
|
||||
}).appendTo('form');
|
||||
|
||||
$('<input>').attr({
|
||||
type: 'hidden',
|
||||
id: 'txtGrossWeight' + i,
|
||||
value: item.GrossWeight,
|
||||
name: 'txtGrossWeight' + i
|
||||
}).appendTo('form');
|
||||
|
||||
$('<input>').attr({
|
||||
type: 'hidden',
|
||||
id: 'txtGrossWeightDate' + i,
|
||||
value: item.GrossWeightDate,
|
||||
name: 'txtGrossWeightDate' + i
|
||||
}).appendTo('form');
|
||||
|
||||
$('<input>').attr({
|
||||
type: 'hidden',
|
||||
id: 'txtTareWeight' + i,
|
||||
value: item.TareWeight,
|
||||
name: 'txtTareWeight' + i
|
||||
}).appendTo('form');
|
||||
|
||||
$('<input>').attr({
|
||||
type: 'hidden',
|
||||
id: 'txtTareWeightDate' + i,
|
||||
value: item.TareWeightDate,
|
||||
name: 'txtTareWeightDate' + i
|
||||
}).appendTo('form');
|
||||
|
||||
$('<input>').attr({
|
||||
type: 'hidden',
|
||||
id: 'txtNetWeight' + i,
|
||||
@ -607,102 +558,77 @@ $('<input>').attr({
|
||||
name: 'txtNetWeight' + i
|
||||
}).appendTo('form');
|
||||
|
||||
//alert(item.PendingQty);
|
||||
if(item.PendingQty == 0.00)
|
||||
{
|
||||
//alert('inside if');
|
||||
$('<input>').attr({
|
||||
type: 'file',
|
||||
id: 'txtWeightFile' + i,
|
||||
value: item.WeightFile,
|
||||
name: 'txtWeightFile' + i,
|
||||
style: 'display:none;' // This makes the input hidden
|
||||
}).appendTo('form'); // Make sure the form has the id 'IGR'
|
||||
|
||||
if (item.PendingQty == 0.00) {
|
||||
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
|
||||
// $('#txtEditFreight').attr('readonly', 'true');
|
||||
}
|
||||
|
||||
$("#IGRLink").show();
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if (JSON.parse(data).length == 1 && item.PendingQty == 0) {
|
||||
|
||||
$("#IGRLink").hide();
|
||||
//alert('The Order is new completed!!');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#IGRappend").empty();
|
||||
|
||||
|
||||
$('#IGRappend').append(trHTML);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
if((status == '<?php echo IGR_CREATED ?>' || status == '<?php echo MRIR_CREATED ?>' || status == '<?php echo MRIR_APPROVED ?>'))
|
||||
{
|
||||
if ((status == '<?php echo IGR_CREATED ?>' || status == '<?php echo MRIR_CREATED ?>' || status == '<?php echo MRIR_APPROVED ?>')) {
|
||||
alert('The Order is completed!!');
|
||||
|
||||
$("#IGRLink").hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$("#IGRLink").show();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
alert('Please Select the Purchase Order Number to Create IGR');
|
||||
}
|
||||
});
|
||||
|
||||
function SetRemarks(RowId)
|
||||
{
|
||||
function SetRemarks(RowId) {
|
||||
var remks = $("#Remark" + RowId).val();
|
||||
if( remks != '')
|
||||
{
|
||||
if (remks != '') {
|
||||
$("#txtRemarks" + RowId).val(remks);
|
||||
}
|
||||
}
|
||||
|
||||
function validateReceivedQuantity(Rowid) {
|
||||
//alert(Rowid);
|
||||
|
||||
var InvoiceQty = parseFloat($('#QuantityAsPerInvoice' + Rowid).val() == '' ? '0.00' : $('#QuantityAsPerInvoice' + Rowid).val());
|
||||
|
||||
var PendingQty = parseFloat($('#PendingQuantity' + Rowid).text() == '' ? '0.00' : $('#PendingQuantity' + Rowid).text());
|
||||
|
||||
var RecQty = parseFloat($('#txtReceivedQuantity' + Rowid).val() == '' ? '0.00' : $('#txtReceivedQuantity' + Rowid).val());
|
||||
|
||||
var OrderedQty = parseFloat($("#Quantity_1" + Rowid).text());
|
||||
|
||||
var r = $("#Remark" + Rowid).val();
|
||||
// alert(RecQty);
|
||||
//alert(InvoiceQty);
|
||||
if((InvoiceQty+RecQty) > OrderedQty){
|
||||
|
||||
alert("Advised Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
||||
if ((InvoiceQty + RecQty) > OrderedQty) {
|
||||
alert("Invoice Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
||||
$("#QuantityAsPerInvoice" + Rowid).focus();
|
||||
$("#QuantityAsPerInvoice" + Rowid).val('');
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
else if(((InvoiceQty+RecQty) - OrderedQty) > 0.00){
|
||||
} else if (((InvoiceQty + RecQty) - OrderedQty) > 0.00) {
|
||||
alert("Order is completed.")
|
||||
$("#QuantityAsPerInvoice" + Rowid).focus();
|
||||
$('#QuantityAsPerInvoice' + Rowid).val('');
|
||||
return false;
|
||||
}
|
||||
|
||||
else {
|
||||
} else {
|
||||
// alert(RecQty);
|
||||
$('#PendingQuantity' + Rowid).text((OrderedQty - (InvoiceQty + RecQty)).toFixed(2));
|
||||
$('#txtPendingQty' + Rowid).val(OrderedQty - (InvoiceQty + RecQty));
|
||||
@ -711,238 +637,39 @@ function validateReceivedQuantity(Rowid){
|
||||
// InvoiceQty
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function isNumberKey(evt)
|
||||
{
|
||||
function isNumberKey(evt) {
|
||||
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
||||
if (charCode != 46 && charCode > 31
|
||||
&& (charCode < 48 || charCode > 57))
|
||||
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function Save(status)
|
||||
{
|
||||
if (validate())
|
||||
{
|
||||
var file = $('#images'+counterConstants).val()
|
||||
function Save(status) {
|
||||
if (validate()) {
|
||||
$("#IGR").attr("method", "post");
|
||||
$("#IGR").attr("enctype", "multipart/form-data");
|
||||
$("#IGR").attr("action", "SaveIGR");
|
||||
$('#IGR').submit();
|
||||
} //validate if closed
|
||||
} //save function closed
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
|
||||
var counters = 0;
|
||||
var counterConstants = 0;
|
||||
|
||||
$("#addemorebutton").click(function(){
|
||||
|
||||
//alert('sda');
|
||||
|
||||
if(counters>4){
|
||||
alert("No more files to add");//this allows only 5 files;
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
|
||||
counters++;
|
||||
counterConstants++;
|
||||
|
||||
var div = document.createElement('div');
|
||||
div.id = "divid"+counters;
|
||||
div.className="row";
|
||||
div.innerHTML='<div class="col-md-12">'+
|
||||
|
||||
'<div class="col-md-3">'+
|
||||
'<label><br></label>'+
|
||||
'<input type="file" id="images" name="browseFiles'+counterConstants+'" onchange="Copyfilenames(this.name);"><br>'+
|
||||
'</div>'+
|
||||
|
||||
'<div class="col-md-1">'+
|
||||
'<label><br><br></label>'+
|
||||
'<button class="btn btn-success" type ="button" onclick="addRow('+counters+')"id="addbtn1" ><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" type ="button" id="removebtn'+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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// document.write("browseFiles"+length);
|
||||
}
|
||||
});
|
||||
|
||||
function addRow(inputs)
|
||||
{ if(inputs <5){
|
||||
if(inputs ==0){
|
||||
inputs = inputs+1;
|
||||
$("#addbtn"+inputs).hide();
|
||||
$("#removebtn"+inputs).hide();
|
||||
}else{
|
||||
$("#addbtn"+inputs).hide();
|
||||
$("#removebtn"+inputs).hide();
|
||||
}
|
||||
}else{
|
||||
$("#addbtn"+inputs).show();
|
||||
$("#removebtn"+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";
|
||||
div.innerHTML='<div class="col-md-12">'+
|
||||
|
||||
'<div class="col-md-3">'+
|
||||
'<label><br></label>'+
|
||||
'<input type="file" name="browseFiles'+counterConstants+'" id="images1" onchange="Copyfilenames(this.name); "><br>'+
|
||||
'</div>'+
|
||||
'<div class="col-md-1">'+
|
||||
'<label><br><br></label>'+
|
||||
'<button class="btn btn-success" type ="button" id="addbtn'+counters+'" onclick="addRow('+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" type ="button" id="removebtn'+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;
|
||||
$('#addbtn').hide();
|
||||
$("#removebtn").hide();
|
||||
}
|
||||
else {
|
||||
|
||||
$('#addemorebutton').hide();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function filecheck(status)
|
||||
{
|
||||
function filecheck(status) {
|
||||
$('#hideIGRStatus').val(status);
|
||||
$('#hidecounters').val(1);
|
||||
$('#hideconstants').val(1);
|
||||
|
||||
var file1 = $('#images').val();
|
||||
|
||||
if(file1=='')
|
||||
{
|
||||
alert('File not Found');
|
||||
}
|
||||
else
|
||||
{
|
||||
Save(status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Copyfilenames(id)
|
||||
{
|
||||
|
||||
function Copyfilenames(id) {
|
||||
var size = $('input[name=' + id + ']')[0].files[0].size;
|
||||
|
||||
var number = id.replace(/[^0-9]+/ig,"");
|
||||
|
||||
if (size > 2100000) {
|
||||
//alert(id);
|
||||
alert('Sorry Your File is Large To 2MB');
|
||||
removeRows(id);
|
||||
//$('input[name = browseFiles'+number+']').val(' ');
|
||||
} else {
|
||||
var name = $('input[name=' + id + ']')[0].files[0].name;
|
||||
//alert(name);
|
||||
//$("#maint_filename"+number).val(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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");
|
||||
$("#addbtn"+counters).show();
|
||||
$("#removebtn"+counters).show();
|
||||
}else{
|
||||
//alert('else');
|
||||
$("#addbtn"+counters).show();
|
||||
$("#removebtn"+counters).show();
|
||||
|
||||
}
|
||||
}else{
|
||||
$("#addemorebutton").show();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -960,6 +687,7 @@ function removeRows(inputs) {
|
||||
WeightDiffer(element)
|
||||
return true;
|
||||
}
|
||||
|
||||
function updateTime() {
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
@ -973,15 +701,14 @@ function removeRows(inputs) {
|
||||
document.getElementById('clock').textContent = dateString + " " + timeString;
|
||||
document.getElementById('wizard_clock').textContent = dateString + " " + timeString;
|
||||
}
|
||||
setInterval(updateTime, 1000); // Update every second
|
||||
updateTime(); // Initial call to display time immediately
|
||||
function WeightDiffer(element)
|
||||
{
|
||||
// console.log(element);
|
||||
setInterval(updateTime, 1000);
|
||||
updateTime();
|
||||
function WeightDiffer(element) {
|
||||
var v1 = $("#GrossWeight").val();
|
||||
var v2 = $("#TareWeight").val();
|
||||
var v3 = v1 - v2;
|
||||
$("#NetWeight").val(v3);
|
||||
|
||||
if (element.id === 'GrossWeight') {
|
||||
$("#GrossWeightDate").val($("#clock").text());
|
||||
}
|
||||
@ -990,15 +717,13 @@ function removeRows(inputs) {
|
||||
$("#TareWeightDate").val($("#clock").text());
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<script>
|
||||
$("#WeightCalculator").on("shown.bs.modal", function(e) {
|
||||
var inx = $(e.relatedTarget).data('index');
|
||||
var material = $(e.relatedTarget).data('material');
|
||||
|
||||
document.getElementById('WeightTitle').textContent = " ( "+material+" )";
|
||||
|
||||
$('#WeightTitle').text(" ( " + material + " )");
|
||||
|
||||
// Clear the modal inputs
|
||||
$("#GrossWeight").val('');
|
||||
@ -1013,14 +738,10 @@ function removeRows(inputs) {
|
||||
var v3 = $("#txtTareWeight" + inx).val();
|
||||
var v4 = $("#txtTareWeightDate" + inx).val();
|
||||
var v5 = $("#txtNetWeight" + inx).val();
|
||||
var fileInput = $("#txtWeightFile" + inx)[0];
|
||||
|
||||
|
||||
|
||||
// Debugging alerts
|
||||
// console.log("v1:", v1);
|
||||
// console.log("v2:", v2);
|
||||
// console.log("v3:", v3);
|
||||
// console.log("v4:", v4);
|
||||
// console.log("v5:", v5);
|
||||
console.log("Selected values for index:", typeof inx, inx);
|
||||
|
||||
// Set modal inputs with the retrieved values
|
||||
@ -1030,6 +751,20 @@ function removeRows(inputs) {
|
||||
$("#TareWeightDate").val(v4);
|
||||
$("#NetWeight").val(v5);
|
||||
$("#CurrentInx").val(inx);
|
||||
if (fileInput && fileInput.files.length > 0) {
|
||||
var targetInput = $("#WeightFile")[0];
|
||||
var file = fileInput.files[0];
|
||||
|
||||
// Create a new DataTransfer object
|
||||
var dataTransfer = new DataTransfer();
|
||||
dataTransfer.items.add(file);
|
||||
|
||||
// Set the file to the target input
|
||||
targetInput.files = dataTransfer.files;
|
||||
|
||||
} else {
|
||||
console.log("No file selected or file input not found.");
|
||||
}
|
||||
});
|
||||
|
||||
function modalSave() {
|
||||
@ -1038,23 +773,34 @@ function modalSave() {
|
||||
var v3 = $("#TareWeight").val();
|
||||
var v4 = $("#TareWeightDate").val();
|
||||
var v5 = $("#NetWeight").val();
|
||||
var v6 = $("#CurrentInx").val();
|
||||
var inx = $("#CurrentInx").val();
|
||||
var fileInput = $("#WeightFile")[0]; // Get the file input element
|
||||
|
||||
// Debugging alerts
|
||||
// console.log("v1:", v1);
|
||||
// console.log("v2:", v2);
|
||||
// console.log("v3:", v3);
|
||||
// console.log("v4:", v4);
|
||||
// console.log("v5:", v5);
|
||||
if (v6 !== undefined && v6 !== '') {
|
||||
console.log("Saving values for index:", v6);
|
||||
if (inx !== undefined && inx !== '') {
|
||||
console.log("Saving values for index:", inx);
|
||||
|
||||
// Set the values back to the hidden inputs
|
||||
$("#txtGrossWeight" + v6).val(v1);
|
||||
$("#txtGrossWeightDate" + v6).val(v2);
|
||||
$("#txtTareWeight" + v6).val(v3);
|
||||
$("#txtTareWeightDate" + v6).val(v4);
|
||||
$("#txtNetWeight" + v6).val(v5);
|
||||
$("#txtGrossWeight" + inx).val(v1);
|
||||
$("#txtGrossWeightDate" + inx).val(v2);
|
||||
$("#txtTareWeight" + inx).val(v3);
|
||||
$("#txtTareWeightDate" + inx).val(v4);
|
||||
$("#txtNetWeight" + inx).val(v5);
|
||||
|
||||
if (fileInput && fileInput.files.length > 0) {
|
||||
var targetInput = $("#txtWeightFile" + inx)[0];
|
||||
var file = fileInput.files[0];
|
||||
|
||||
// Create a new DataTransfer object
|
||||
var dataTransfer = new DataTransfer();
|
||||
dataTransfer.items.add(file);
|
||||
|
||||
// Set the file to the target input
|
||||
targetInput.files = dataTransfer.files;
|
||||
|
||||
} else {
|
||||
console.log("No file selected or file input not found.");
|
||||
}
|
||||
|
||||
|
||||
// Clear modal inputs
|
||||
$("#GrossWeight").val('');
|
||||
@ -1062,12 +808,12 @@ function modalSave() {
|
||||
$("#TareWeight").val('');
|
||||
$("#TareWeightDate").val('');
|
||||
$("#NetWeight").val('');
|
||||
$("#WeightFile").val('');
|
||||
|
||||
// Close the modal
|
||||
$("#WeightCalculator").modal('hide');
|
||||
} else {
|
||||
console.log("Saving values for index: "+v6+" undefined");
|
||||
console.log("Saving values for index: " + inx + " undefined");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -250,6 +250,12 @@
|
||||
|
||||
<div class="modal-footer">
|
||||
<!-- <a class="btn btn-primary" id="update" value="Update">Update</a> -->
|
||||
<div class="col-md-4 col-md-offset-8">
|
||||
<input type="file" name="MasterFile" id="MasterFile" onchange="Copyfilenames(this.name); ">
|
||||
<label id="MasterFileLabel" style="display:none;">
|
||||
<a><span></span><small></small></a>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="buttonContainer">
|
||||
<a class="btn btn-primary" id="draftIGR" value="draftIGR">Draft IGR</a>
|
||||
@ -324,6 +330,13 @@
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<input type="file" name="WeightFile" id="WeightFile" onchange="Copyfilenames(this.name); ">
|
||||
|
||||
<label id="WeightFileLabel" style="display:none;">
|
||||
<a><span></span><small></small></a>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- </div> -->
|
||||
@ -482,6 +495,9 @@
|
||||
var VehicleNoInput = modal.find('#Vehicle_No');
|
||||
var DriverInput = modal.find('#Driver_Name');
|
||||
var DriverMobileNumberInput = modal.find('#DriverMobileNumber');
|
||||
var MasterFileInput = modal.find('#MasterFile');
|
||||
modal.find('#MasterFileLabel').hide();
|
||||
|
||||
var depCode = "<?php echo $DEPCode; ?>";
|
||||
|
||||
// depCode != "DEP27"
|
||||
@ -514,6 +530,7 @@
|
||||
|
||||
$("#tbleIGRAppend").empty();
|
||||
$('#content').loader('show');
|
||||
|
||||
$.ajax({
|
||||
data: { id: igr },
|
||||
type: "POST",
|
||||
@ -521,13 +538,40 @@
|
||||
success: function(data) {
|
||||
// success:function(data) {
|
||||
$('#content').loader('hide');
|
||||
var parsedData = JSON.parse(data);
|
||||
if (parsedData.length === 0) {
|
||||
console.log("No data available");
|
||||
// Reset all relevant fields and table
|
||||
$('#IgrshowTitle').text('');
|
||||
$("#IGRNO1").val('');
|
||||
$("#txtIGRLineItem").val('');
|
||||
$('#printLink').attr('href', '#');
|
||||
$('.help-block').text('');
|
||||
$("#Vehicle_No").val('');
|
||||
$("#Driver_Name").val('');
|
||||
$("#DriverMobileNumber").val('');
|
||||
$("#IGRStatus").val('');
|
||||
$("#PONo").val('');
|
||||
$("#Supplier").val('');
|
||||
$("#Add1").val('');
|
||||
$("#Invoice_No").val('');
|
||||
$("#Invoice_Date").val('');
|
||||
$("#MaterialRcvdDate").val('');
|
||||
$("#ser").val('');
|
||||
$("#tbleIGRAppend").empty(); // Clear the table
|
||||
// Hide the MasterFileLabel if no data
|
||||
modal.find('#MasterFileLabel').hide();
|
||||
|
||||
return; // Exit the function early
|
||||
}
|
||||
|
||||
var trIGRHTML = '';
|
||||
$.each(JSON.parse(data), function(i, item) {
|
||||
$.each(parsedData, function(i, item) {
|
||||
if (igr == item.IGRNO) {
|
||||
console.log(item);
|
||||
$('#IgrshowTitle').text(" ( " + item.IGRNO + " ) ");
|
||||
$("#IGRNO1").val(item.IGRNO);
|
||||
$("#IGRItemNo").val(item.IGRItemNo);
|
||||
$("#txtIGRLineItem").val(item.IGRItemNo);
|
||||
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
|
||||
var newUrl = baseUrl + '?PONO=' + item.PONO + '&ReqType=' + item.POType;
|
||||
$('#printLink').attr('href', newUrl);
|
||||
@ -543,32 +587,31 @@
|
||||
$("#Supplier").val(item.SupplierName);
|
||||
$("#Add1").val(item.Address);
|
||||
$("#Invoice_No").val(item.DeliveryChellanOrInvoiceNo);
|
||||
// alert(item.DeliveryChellanDate);
|
||||
console.log(typeof item.MasterFile);
|
||||
modal.find('#MasterFileLabel').hide();
|
||||
if (typeof item.MasterFile == 'string') {
|
||||
if (item.MasterFile !== null && item.MasterFile !== undefined && item.MasterFile.trim() !== "") {
|
||||
modal.find('#MasterFileLabel a').attr('href', '<?php echo base_url() ?>' + 'public/uploads/Igrfiles/' + item.MasterFile);
|
||||
modal.find('#MasterFileLabel a').attr('title', 'previously uploaded IGR Master File');
|
||||
modal.find('#MasterFileLabel a span').text('previously uploaded - ');
|
||||
modal.find('#MasterFileLabel a small').text(item.MasterFile);
|
||||
modal.find('#MasterFileLabel').show();
|
||||
}
|
||||
} else {
|
||||
modal.find('#MasterFileLabel').hide();
|
||||
}
|
||||
|
||||
// Format dates
|
||||
var dcd = new Date(item.DeliveryChellanDate);
|
||||
//alert(dcd.getDate()+ '.' + (dcd.getMonth() + 1)+ '.' + dcd.getFullYear());
|
||||
// var dcd2 = (dcd.getDate() + '/' + (dcd.getMonth() + 1) + '/' + dcd.getFullYear());
|
||||
var dcd2 = (String(dcd.getDate()).padStart(2, '0') + '-' + (String(dcd.getMonth() + 1).padStart(2, '0')) + '-' + dcd.getFullYear());
|
||||
$("#Invoice_Date").val(dcd2);
|
||||
if (item.MaterialRcvdDate === null) {
|
||||
var Mat_rcv_date = ' ';
|
||||
} else {
|
||||
var MR_dt = new Date(item.MaterialRcvdDate);
|
||||
var Mat_rcv_date = (String(MR_dt.getDate()).padStart(2, '0') + '-' + (String(MR_dt.getMonth() + 1).padStart(2, '0')) + '-' + MR_dt.getFullYear());
|
||||
}
|
||||
var Mat_rcv_date = (item.MaterialRcvdDate === null) ? ' ' : formatDate(new Date(item.MaterialRcvdDate));
|
||||
$("#MaterialRcvdDate").val(Mat_rcv_date);
|
||||
if (item.GrossWeightDate === null) {
|
||||
var gross_rcv_date = ' ';
|
||||
} else {
|
||||
var G_dt = new Date(item.GrossWeightDate);
|
||||
var gross_rcv_date = formatDateTime(G_dt);
|
||||
}
|
||||
var gross_rcv_date = (item.GrossWeightDate === null) ? ' ' : formatDate(new Date(item.GrossWeightDate));
|
||||
$("#ser").val(item.ServiceDescription);
|
||||
|
||||
|
||||
i = i + 1;
|
||||
if (igrstatus === "ST074") {
|
||||
// alert("here");
|
||||
// document.getElementById('pendingQuantityHeader').style.display = 'table-cell';
|
||||
$("#pendingQuantityHeader").css("display", "table-cell");
|
||||
|
||||
trIGRHTML += '<tr>' +
|
||||
@ -581,12 +624,8 @@
|
||||
'<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 + ')" style="width: 75px;"> </td>' +
|
||||
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </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="text" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
|
||||
'<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="txtGrossWeight' + i + '" name="txtGrossWeight' + i + '" value="' + item.GrossWeight + '">' +
|
||||
@ -594,14 +633,15 @@
|
||||
'<input type="hidden" id="txtTareWeight' + i + '" name="txtTareWeight' + i + '" value="' + item.TareWeight + '">' +
|
||||
'<input type="hidden" id="txtTareWeightDate' + i + '" name="txtTareWeightDate' + i + '" value="' + item.TareWeightDate + '">' +
|
||||
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
|
||||
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' + // Example with no initial value
|
||||
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
|
||||
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
|
||||
'<input type="file" id="txtWeightFile' + i + '" name="txtWeightFile' + i + '"value="' + item.WeightFile + '" style="display:none;">' +
|
||||
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' +
|
||||
'</tr>';
|
||||
//alert(item.PendingQty);
|
||||
|
||||
if ((item.Quantity - item.QuantityAsPerInvoice) == 0.00) {
|
||||
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
|
||||
}
|
||||
// console.log("Ifpart ... ");
|
||||
|
||||
} else {
|
||||
$("#pendingQuantityHeader").css("display", "none");
|
||||
@ -615,7 +655,6 @@
|
||||
'<td>' + item.Remarks + '</td>' +
|
||||
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </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 + '">' +
|
||||
@ -626,14 +665,13 @@
|
||||
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
|
||||
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
|
||||
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
|
||||
'<input type="file" id="txtWeightFile' + i + '" name="txtWeightFile' + i + '"value="' + item.WeightFile + '">' +
|
||||
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' +
|
||||
'</tr>';
|
||||
}
|
||||
|
||||
|
||||
//alert(item.QuantityAsPerInvoice);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#tbleIGRAppend").empty();
|
||||
$("#tbleIGRAppend").append(trIGRHTML);
|
||||
}
|
||||
@ -661,11 +699,6 @@
|
||||
$('#draftIGR').click(function(){
|
||||
$('#content').loader('show');
|
||||
var igrno = $("#IGRNO1").val();
|
||||
var materialrcv_date = $("#MaterialRcvdDate").val();
|
||||
var inv_date = $("#Invoice_Date").val();
|
||||
var vehicle_no = $('#Vehicle_No').val();
|
||||
var driver = $('#Driver_Name').val();
|
||||
var driver_mobile = $('#DriverMobileNumber').val();
|
||||
var status = 0;
|
||||
var tableData = [];
|
||||
$('#tbleIGRAppend tr').each(function(index) {
|
||||
@ -680,15 +713,27 @@
|
||||
TareWeight: row.find('#txtTareWeight' + index).val(),
|
||||
TareWeightDate: row.find('#txtTareWeightDate' + index).val(),
|
||||
NetWeight: row.find('#txtNetWeight' + index).val(),
|
||||
IGRItemNo: row.find('#txtIGRLineItem' + index).val()
|
||||
IGRItemNo: row.find('#txtIGRLineItem' + index).val(),
|
||||
WeightFile: row.find('#txtWeightFile' + index).val()
|
||||
};
|
||||
tableData.push(rowData);
|
||||
});
|
||||
console.log(tableData);
|
||||
var formData = new FormData();
|
||||
formData.append('igr', igrno);
|
||||
formData.append('mrc', $("#MaterialRcvdDate").val());
|
||||
formData.append('invdate', $("#Invoice_Date").val());
|
||||
formData.append('vehicle_no', $('#Vehicle_No').val());
|
||||
formData.append('driver', $('#Driver_Name').val());
|
||||
formData.append('driver_mobile', $('#DriverMobileNumber').val());
|
||||
formData.append('status', status);
|
||||
formData.append('tableData', JSON.stringify(tableData));
|
||||
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
|
||||
$.ajax({
|
||||
data:{igr:igrno,mrc:materialrcv_date,invdate:inv_date,vehicle_no:vehicle_no,driver:driver,driver_mobile:driver_mobile,status:status,tableData: tableData},
|
||||
data: formData,
|
||||
type: "POST",
|
||||
url: "<?php echo base_url() ?>UpdateIGR",
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success:function(data) {
|
||||
$('#content').loader('hide');
|
||||
alert(data);
|
||||
@ -699,11 +744,6 @@ console.log(tableData);
|
||||
$('#generateIGR').click(function(){
|
||||
$('#content').loader('show');
|
||||
var igrno = $("#IGRNO1").val();
|
||||
var materialrcv_date = $("#MaterialRcvdDate").val();
|
||||
var inv_date = $("#Invoice_Date").val();
|
||||
var vehicle_no = $('#Vehicle_No').val();
|
||||
var driver = $('#Driver_Name').val();
|
||||
var driver_mobile = $('#DriverMobileNumber').val();
|
||||
var status = 1;
|
||||
var tableData = [];
|
||||
$('#tbleIGRAppend tr').each(function(index) {
|
||||
@ -718,14 +758,28 @@ console.log(tableData);
|
||||
TareWeight: row.find('#txtTareWeight' + index).val(),
|
||||
TareWeightDate: row.find('#txtTareWeightDate' + index).val(),
|
||||
NetWeight: row.find('#txtNetWeight' + index).val(),
|
||||
IGRItemNo: row.find('#txtIGRLineItem' + index).val()
|
||||
IGRItemNo: row.find('#txtIGRLineItem' + index).val(),
|
||||
WeightFile: row.find('#txtWeightFile' + index).val()
|
||||
};
|
||||
tableData.push(rowData);
|
||||
});
|
||||
var formData = new FormData();
|
||||
formData.append('igr', igrno);
|
||||
formData.append('mrc', $("#MaterialRcvdDate").val());
|
||||
formData.append('invdate', $("#Invoice_Date").val());
|
||||
formData.append('vehicle_no', $('#Vehicle_No').val());
|
||||
formData.append('driver', $('#Driver_Name').val());
|
||||
formData.append('driver_mobile', $('#DriverMobileNumber').val());
|
||||
formData.append('status', status);
|
||||
formData.append('tableData', JSON.stringify(tableData));
|
||||
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
|
||||
|
||||
$.ajax({
|
||||
data:{igr:igrno,mrc:materialrcv_date,invdate:inv_date,vehicle_no:vehicle_no,driver:driver,driver_mobile:driver_mobile,status:status,tableData: tableData},
|
||||
data: formData,
|
||||
type:"POST",
|
||||
url: "<?php echo base_url() ?>UpdateIGR",
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success:function(data) {
|
||||
$('#content').loader('hide');
|
||||
alert(data);
|
||||
@ -1057,9 +1111,10 @@ function deleteBill(Billno,i){
|
||||
$("#WeightCalculator").on("shown.bs.modal", function(e) {
|
||||
var inx = $(e.relatedTarget).data('index');
|
||||
var material = $(e.relatedTarget).data('material');
|
||||
var modal = $(this);
|
||||
|
||||
document.getElementById('WeightTitle').textContent = " ( "+material+" )";
|
||||
|
||||
$('#WeightTitle').text(" ( " + material + " )");
|
||||
|
||||
// Clear the modal inputs
|
||||
$("#GrossWeight").val('');
|
||||
@ -1067,6 +1122,8 @@ function deleteBill(Billno,i){
|
||||
$("#TareWeight").val('');
|
||||
$("#TareWeightDate").val('');
|
||||
$("#NetWeight").val('');
|
||||
$("#WeightFile").val('');
|
||||
|
||||
|
||||
// Retrieve values from hidden inputs
|
||||
var v1 = $("#txtGrossWeight" + inx).val();
|
||||
@ -1074,14 +1131,18 @@ function deleteBill(Billno,i){
|
||||
var v3 = $("#txtTareWeight" + inx).val();
|
||||
var v4 = $("#txtTareWeightDate" + inx).val();
|
||||
var v5 = $("#txtNetWeight" + inx).val();
|
||||
|
||||
|
||||
// Debugging alerts
|
||||
// console.log("v1:", v1);
|
||||
// console.log("v2:", v2);
|
||||
// console.log("v3:", v3);
|
||||
// console.log("v4:", v4);
|
||||
// console.log("v5:", v5);
|
||||
var fileInput = $("#txtWeightFile" + inx)[0];
|
||||
var fileName = $("#txtWeightFileName" + inx).val();
|
||||
modal.find('#WeightFileLabel').hide();
|
||||
console.log(typeof fileName);
|
||||
if (fileName !== 'null' && fileName !== undefined && fileName.trim() !== "") {
|
||||
modal.find('#WeightFileLabel a').attr('title', 'previously uploaded IGR Weight File');
|
||||
modal.find('#WeightFileLabel a').attr('href', '<?php echo base_url() ?>'+'public/uploads/Igrfiles/'+fileName);
|
||||
modal.find('#WeightFileLabel a span').text('previously uploaded - ');
|
||||
modal.find('#WeightFileLabel a small').text(fileName);
|
||||
modal.find('#WeightFileLabel').show();
|
||||
}
|
||||
console.log(fileInput);
|
||||
console.log("Selected values for index:", typeof inx,inx);
|
||||
|
||||
// Set modal inputs with the retrieved values
|
||||
@ -1091,6 +1152,22 @@ function deleteBill(Billno,i){
|
||||
$("#TareWeightDate").val(v4);
|
||||
$("#NetWeight").val(v5);
|
||||
$("#CurrentInx").val(inx);
|
||||
|
||||
fileName
|
||||
if (fileInput && fileInput.files.length > 0) {
|
||||
var targetInput = $("#WeightFile")[0];
|
||||
var file = fileInput.files[0];
|
||||
|
||||
// Create a new DataTransfer object
|
||||
var dataTransfer = new DataTransfer();
|
||||
dataTransfer.items.add(file);
|
||||
|
||||
// Set the file to the target input
|
||||
targetInput.files = dataTransfer.files;
|
||||
|
||||
} else {
|
||||
console.log("No file selected or file input not found.");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -1100,31 +1177,57 @@ function deleteBill(Billno,i){
|
||||
var v3 = $("#TareWeight").val();
|
||||
var v4 = $("#TareWeightDate").val();
|
||||
var v5 = $("#NetWeight").val();
|
||||
var v6 = $("#CurrentInx").val();
|
||||
var inx = $("#CurrentInx").val();
|
||||
var IGRNO1 = $("#IGRNO1").val();
|
||||
var fileInput = $("#WeightFile")[0]; // Get the file input element
|
||||
|
||||
// Debugging alerts
|
||||
// console.log("v1:", v1);
|
||||
// console.log("v2:", v2);
|
||||
// console.log("v3:", v3);
|
||||
// console.log("v4:", v4);
|
||||
// console.log("v5:", v5);
|
||||
if (v6 !== undefined && v6 !== '') {
|
||||
console.log("Saving values for index:", v6);
|
||||
if (inx !== undefined && inx !== '') {
|
||||
console.log("Saving values for index:", inx);
|
||||
|
||||
// Set the values back to the hidden inputs
|
||||
$("#txtGrossWeight" + v6).val(v1);
|
||||
$("#txtGrossWeightDate" + v6).val(v2);
|
||||
$("#txtTareWeight" + v6).val(v3);
|
||||
$("#txtTareWeightDate" + v6).val(v4);
|
||||
$("#txtNetWeight" + v6).val(v5);
|
||||
var txtIGRLineItem = $("#txtIGRLineItem" + v6).val();
|
||||
$("#txtGrossWeight" + inx).val(v1);
|
||||
$("#txtGrossWeightDate" + inx).val(v2);
|
||||
$("#txtTareWeight" + inx).val(v3);
|
||||
$("#txtTareWeightDate" + inx).val(v4);
|
||||
$("#txtNetWeight" + inx).val(v5);
|
||||
var txtIGRLineItem = $("#txtIGRLineItem" + inx).val();
|
||||
|
||||
// Prepare FormData
|
||||
var formData = new FormData();
|
||||
formData.append('GrossWeight', v1);
|
||||
formData.append('GrossWeightDate', v2);
|
||||
formData.append('TareWeight', v3);
|
||||
formData.append('TareWeightDate', v4);
|
||||
formData.append('NetWeight', v5);
|
||||
formData.append('IGR', IGRNO1);
|
||||
formData.append('IGRlineitem', txtIGRLineItem);
|
||||
if (fileInput && fileInput.files.length > 0) {
|
||||
var file = fileInput.files[0];
|
||||
formData.append('WeightFile', file);
|
||||
} else {
|
||||
console.log("No file selected or file input not found.");
|
||||
}
|
||||
// if (fileInput && fileInput.files.length > 0) {
|
||||
// var targetInput = $("#txtWeightFile" + inx)[0];
|
||||
// var file = fileInput.files[0];
|
||||
|
||||
// // Create a new DataTransfer object
|
||||
// var dataTransfer = new DataTransfer();
|
||||
// dataTransfer.items.add(file);
|
||||
|
||||
// // Set the file to the target input
|
||||
// targetInput.files = dataTransfer.files;
|
||||
// formData.append('WeightFile', file);
|
||||
|
||||
// } else {
|
||||
// console.log("No file selected or file input not found.");
|
||||
// }
|
||||
$.ajax({
|
||||
data:{GrossWeight:v1,GrossWeightDate:v2,TareWeight:v3,TareWeightDate:v4,NetWeight:v5,IGR:IGRNO1,IGRlineitem:txtIGRLineItem},
|
||||
//dataType:"json",
|
||||
type:"POST",
|
||||
url: "<?php echo base_url() ?>updateIGRWeight",
|
||||
type: "POST",
|
||||
data: formData,
|
||||
contentType: false, // Don't set content type header
|
||||
processData: false,
|
||||
success:function(data) {
|
||||
if(data)
|
||||
{
|
||||
@ -1139,11 +1242,12 @@ function deleteBill(Billno,i){
|
||||
$("#TareWeight").val('');
|
||||
$("#TareWeightDate").val('');
|
||||
$("#NetWeight").val('');
|
||||
$("#WeightFile").val('');
|
||||
|
||||
// Close the modal
|
||||
$("#WeightCalculator").modal('hide');
|
||||
} else {
|
||||
console.log("Saving values for index: "+v6+" undefined");
|
||||
console.log("Saving values for index: "+inx+" undefined");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1320,7 +1424,14 @@ function deleteBill(Billno,i){
|
||||
'</tr>';
|
||||
$('#tblefile').append(newRow);
|
||||
}
|
||||
|
||||
function Copyfilenames(id) {
|
||||
var size = $('input[name=' + id + ']')[0].files[0].size;
|
||||
if (size > 2100000) {
|
||||
alert('Sorry Your File is Large To 2MB');
|
||||
} else {
|
||||
var name = $('input[name=' + id + ']')[0].files[0].name;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<!-- Latest DataTables JS -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user