changes in stock module -vadivel j
This commit is contained in:
parent
864a6f62ac
commit
b193589451
@ -455,3 +455,7 @@ $routes->post('updateDustAndRoughStockDetails', 'StockController::updateDustAndR
|
|||||||
//Resin stock details
|
//Resin stock details
|
||||||
$routes->match(['GET','POST'],'resinStockDetails', 'StockController::loadView_resinStockDetails');
|
$routes->match(['GET','POST'],'resinStockDetails', 'StockController::loadView_resinStockDetails');
|
||||||
$routes->post('updateResinStockDetails', 'StockController::updateResinStockDetails');
|
$routes->post('updateResinStockDetails', 'StockController::updateResinStockDetails');
|
||||||
|
|
||||||
|
//Gas stock details
|
||||||
|
$routes->match(['GET','POST'],'gasStockDetails', 'StockController::loadView_gasStockDetails');
|
||||||
|
$routes->post('updateGasStockDetails', 'StockController::updateGasStockDetails');
|
||||||
@ -15,6 +15,7 @@ use App\Models\Rawmaterialdetails_model;
|
|||||||
use App\Models\BagStockDetailsModel;
|
use App\Models\BagStockDetailsModel;
|
||||||
use App\Models\DustAndRoughModel;
|
use App\Models\DustAndRoughModel;
|
||||||
use App\Models\ResinStockModel;
|
use App\Models\ResinStockModel;
|
||||||
|
use App\Models\GasStockModel;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ class StockController extends BaseController
|
|||||||
protected $Rawmaterialdetails_model;
|
protected $Rawmaterialdetails_model;
|
||||||
protected $dustAndRoughStockDetails_model;
|
protected $dustAndRoughStockDetails_model;
|
||||||
protected $resinStockDetails_model;
|
protected $resinStockDetails_model;
|
||||||
|
protected $gasStockDetails_model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is default constructor of the class
|
* This is default constructor of the class
|
||||||
@ -68,6 +70,8 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
$this->resinStockDetails_model = new ResinStockModel() ;
|
$this->resinStockDetails_model = new ResinStockModel() ;
|
||||||
|
|
||||||
|
$this->gasStockDetails_model = new GasStockModel() ;
|
||||||
|
|
||||||
|
|
||||||
$this->session = session();
|
$this->session = session();
|
||||||
helper('form');
|
helper('form');
|
||||||
@ -99,10 +103,14 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
$this->global['pageTitle'] = 'Coating Machine Details ';
|
$this->global['pageTitle'] = 'Coating Machine Details ';
|
||||||
|
|
||||||
|
|
||||||
|
$startDate = "$month-01";
|
||||||
|
$endDate = date("Y-m-t", strtotime($startDate));
|
||||||
$data['coatingMachineDetails']= $this->coatingMachineDetails_model
|
$data['coatingMachineDetails']= $this->coatingMachineDetails_model
|
||||||
|
->where('date >=', $startDate)
|
||||||
|
->where('date <=', $endDate)
|
||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
->orderBy('created_at','DESC')
|
->orderBy('date','asc')
|
||||||
->like('created_at', $month, 'after')
|
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
$date = DateTime::createFromFormat('Y-m', $month);
|
$date = DateTime::createFromFormat('Y-m', $month);
|
||||||
@ -721,15 +729,76 @@ class StockController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Gas Stock Details
|
||||||
|
|
||||||
|
public function loadView_gasStockDetails(){
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'POST'){
|
||||||
|
|
||||||
|
$month = $this->request->getPost('month');
|
||||||
|
|
||||||
|
$date = DateTime::createFromFormat('M-Y', $month);
|
||||||
|
|
||||||
|
$formattedDate = $date->format('Y-m');
|
||||||
|
|
||||||
|
$month=$formattedDate;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$month = date('Y-m');
|
||||||
|
}
|
||||||
|
|
||||||
|
$data=[];
|
||||||
|
|
||||||
|
$data['month']=$month;
|
||||||
|
|
||||||
|
$this->global['pageTitle'] = "Gas Stock Details";
|
||||||
|
|
||||||
|
$startDate = "$month-01";
|
||||||
|
$endDate = date("Y-m-t", strtotime($startDate));
|
||||||
|
|
||||||
|
$data['gasStockDetails'] = $this->gasStockDetails_model
|
||||||
|
->select('t_gasStockDetails.*,
|
||||||
|
t_drierMachineDetails.total_gas_consumption AS drierMachineGasConsumption,
|
||||||
|
t_drierMachineDetails.sand_dried_qty AS sandDried,
|
||||||
|
coating_summary.coatingMachineGasconsumption,
|
||||||
|
coating_summary.coatedSand'
|
||||||
|
)
|
||||||
|
// Subquery with early date filtering
|
||||||
|
->join(
|
||||||
|
'(SELECT date,
|
||||||
|
SUM(totalGasconsumption) AS coatingMachineGasconsumption,
|
||||||
|
SUM(totalCoatingSandInKg) / 1000 AS coatedSand
|
||||||
|
FROM t_coatingMachineDetails
|
||||||
|
WHERE is_active = 1
|
||||||
|
AND date >= ' . $this->db->escape($startDate) . '
|
||||||
|
AND date <= ' . $this->db->escape($endDate) . '
|
||||||
|
GROUP BY date
|
||||||
|
) AS coating_summary',
|
||||||
|
'coating_summary.date = t_gasStockDetails.date',
|
||||||
|
'left'
|
||||||
|
)
|
||||||
|
->join('t_drierMachineDetails',
|
||||||
|
't_drierMachineDetails.date = t_gasStockDetails.date
|
||||||
|
AND t_drierMachineDetails.date >= ' . $this->db->escape($startDate) . '
|
||||||
|
AND t_drierMachineDetails.date <= ' . $this->db->escape($endDate),
|
||||||
|
'left'
|
||||||
|
)
|
||||||
|
|
||||||
|
->where('t_gasStockDetails.date >=', $startDate)
|
||||||
|
->where('t_gasStockDetails.date <=', $endDate)
|
||||||
|
->groupBy('t_gasStockDetails.date')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$data['month'] = DateTime::createFromFormat('Y-m', $month)->format('M-Y');
|
||||||
|
|
||||||
|
return $this->loadViews("gasStockDetails", $this->global, $data, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateGasStockDetails(){
|
||||||
|
echo "welcome to update Gas Stock Details";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
47
app/Models/GasStockModel.php
Normal file
47
app/Models/GasStockModel.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class GasStockModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 't_gasStockDetails';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = ['date','opening','purchaseBharath','purchaseIndian',
|
||||||
|
'total','consumption','balanceStock'];
|
||||||
|
|
||||||
|
protected bool $allowEmptyInserts = false;
|
||||||
|
protected bool $updateOnlyChanged = true;
|
||||||
|
|
||||||
|
protected array $casts = [];
|
||||||
|
protected array $castHandlers = [];
|
||||||
|
|
||||||
|
// Dates
|
||||||
|
protected $useTimestamps = false;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
protected $validationRules = [];
|
||||||
|
protected $validationMessages = [];
|
||||||
|
protected $skipValidation = false;
|
||||||
|
protected $cleanValidationRules = true;
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
}
|
||||||
500
app/Views/gasStockDetails.php
Normal file
500
app/Views/gasStockDetails.php
Normal file
@ -0,0 +1,500 @@
|
|||||||
|
<style type="text/css">
|
||||||
|
.num {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fht-table,
|
||||||
|
.fht-table thead,
|
||||||
|
.fht-table tfoot,
|
||||||
|
.fht-table tbody,
|
||||||
|
.fht-table tr,
|
||||||
|
.fht-table th,
|
||||||
|
.fht-table td {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fht-table td {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fht-table td:hover {
|
||||||
|
background-color: #00a65a;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fht-table {
|
||||||
|
border: 0 none;
|
||||||
|
height: auto;
|
||||||
|
width: auto;
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0;
|
||||||
|
/*table-layout: fixed; Algoritmo de distribucion fijo */
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fht-table th,
|
||||||
|
.fht-table td {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fht-table-wrapper,
|
||||||
|
.fht-table-wrapper .fht-thead,
|
||||||
|
.fht-table-wrapper .fht-tfoot,
|
||||||
|
.fht-table-wrapper .fht-fixed-column .fht-tbody,
|
||||||
|
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
||||||
|
.fht-table-wrapper .fht-tbody {
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
||||||
|
.fht-table-wrapper .fht-tbody {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fht-table-wrapper .fht-table .fht-cell {
|
||||||
|
overflow: hidden;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fht-table-wrapper .fht-fixed-column,
|
||||||
|
.fht-table-wrapper .fht-fixed-body {
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fht-table-wrapper .fht-fixed-column {
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fht-fixed-body .fht-thead table {
|
||||||
|
margin-right: 20px;
|
||||||
|
border: 0 none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*For Examples*/
|
||||||
|
|
||||||
|
.ContenedorTabla {
|
||||||
|
height: 500px;
|
||||||
|
margin: 0 auto;
|
||||||
|
overflow: auto;
|
||||||
|
width: auto;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header,
|
||||||
|
.main {
|
||||||
|
display: inline-block;
|
||||||
|
height: auto;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.titulosHeader {
|
||||||
|
border-bottom: 1px solid #e8bb25;
|
||||||
|
height: auto;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding-bottom: 8px;
|
||||||
|
padding-top: 8px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.celda_encabezado_general {
|
||||||
|
background-color: #00a65a;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
color: #ffffff;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 6px 10px;;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
._Separador {
|
||||||
|
background-color: #fff;
|
||||||
|
height: 12px;
|
||||||
|
border-left: 1px solid #ccc;
|
||||||
|
border-right: 1px solid #ccc;
|
||||||
|
width: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
._Separador div {
|
||||||
|
width: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.celda_normal {
|
||||||
|
/*background-color: #fff;*/
|
||||||
|
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 2px 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*style excel*/
|
||||||
|
.excel_cell {
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
color: #222;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: normal;
|
||||||
|
padding: 4px;
|
||||||
|
white-space: pre-line;
|
||||||
|
empty-cells: show;
|
||||||
|
}
|
||||||
|
|
||||||
|
._cell_header {
|
||||||
|
background-color: #EEE;
|
||||||
|
}
|
||||||
|
|
||||||
|
._cell_Default {
|
||||||
|
background-color: #FFF;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.excel_cell div {
|
||||||
|
width: 30px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bagStockDetailsTableId th:nth-child(1),
|
||||||
|
#bagStockDetailsTableId td:nth-child(1) {
|
||||||
|
position: sticky;
|
||||||
|
left: 0;
|
||||||
|
background-color: #00a65a;
|
||||||
|
z-index: 2;
|
||||||
|
border-right: 2px solid #ddd;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
padding-right: 30% ! important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="content-page">
|
||||||
|
<div class="content">
|
||||||
|
<!-- Start Content-->
|
||||||
|
<div class="container-fluid">
|
||||||
|
<!-- start page title -->
|
||||||
|
<div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="page-title-box page-title-box-alt">
|
||||||
|
<div class="page-title-right">
|
||||||
|
<ol class="breadcrumb m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Stocks</a></li>
|
||||||
|
<li class="breadcrumb-item active">
|
||||||
|
<h4 class="page-title">Gas Stock Details </h4>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 text-right">
|
||||||
|
<!-- Right-aligned buttons or links can be added here -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
|
||||||
|
<form action="<?= base_url('gasStockDetails'); ?>" method="post">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-3">
|
||||||
|
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
|
||||||
|
class="form-control mt-2" data-provide="datepicker"
|
||||||
|
data-date-format="M-yyyy" data-date-min-view-mode="1">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<button type="submit" class="btn btn-success"> Change Month </button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table id="bagStockDetailsTableId" class="fht-table table-striped">
|
||||||
|
|
||||||
|
<thead class="celda_encabezado_general" style="padding: 10px;">
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
<th class="celda_encabezado_general" rowspan="2" colspan="2">RIPL </th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
<th class="celda_encabezado_general" rowspan="2" colspan="2">RIPL </th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="celda_encabezado_general" colspan="5">Gas Stock </th>
|
||||||
|
<th class="celda_encabezado_general">10 Ton</th>
|
||||||
|
<th class="celda_encabezado_general">Sand Dried</th>
|
||||||
|
<th class="celda_encabezado_general">Coating Machine</th>
|
||||||
|
<th class="celda_encabezado_general">Sand Coated</th>
|
||||||
|
<th class="celda_encabezado_general">Trp Machine </th>
|
||||||
|
<th class="celda_encabezado_general">Sand TRP</th>
|
||||||
|
<th class="celda_encabezado_general">Rotary Drier </th>
|
||||||
|
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th class="celda_encabezado_general">Date </th>
|
||||||
|
<th class="celda_encabezado_general">Opening Stock</th>
|
||||||
|
<th class="celda_encabezado_general">Purchase(Bharath)</th>
|
||||||
|
<th class="celda_encabezado_general">Purchase(Indian)</th>
|
||||||
|
<th class="celda_encabezado_general">Total</th>
|
||||||
|
<th class="celda_encabezado_general">Consumption </th>
|
||||||
|
<th class="celda_encabezado_general">Balance Stock</th>
|
||||||
|
<th class="celda_encabezado_general">Consumption </th>
|
||||||
|
<th class="celda_encabezado_general">ton </th>
|
||||||
|
<th class="celda_encabezado_general">Consumption</th>
|
||||||
|
<th class="celda_encabezado_general">ton </th>
|
||||||
|
<th class="celda_encabezado_general">Consumption</th>
|
||||||
|
<th class="celda_encabezado_general">ton </th>
|
||||||
|
<th class="celda_encabezado_general">Consumption</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody style="background-color: #fff;" >
|
||||||
|
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right">
|
||||||
|
<input type="button" class="btn btn-success" id="saveId" value="save">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div> <!-- End card-body -->
|
||||||
|
</div> <!-- End card -->
|
||||||
|
</div> <!-- End col -->
|
||||||
|
</div> <!-- End row -->
|
||||||
|
</div>
|
||||||
|
</div> <!-- End container-fluid -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
$('#saveId').click(function () {
|
||||||
|
|
||||||
|
//table to json function
|
||||||
|
|
||||||
|
var updateBagStockDetails = tableToJson();
|
||||||
|
|
||||||
|
|
||||||
|
alert('Updation may take a while, And we appreciate your patience..!!');
|
||||||
|
|
||||||
|
$('#loader').show();
|
||||||
|
$.ajax({
|
||||||
|
data: {
|
||||||
|
updateBagStockDetails
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
url: "<?php echo base_url() ?>updateBagStockDetails",
|
||||||
|
|
||||||
|
success: function (data) {
|
||||||
|
if (data) {
|
||||||
|
$('#loader').hide();
|
||||||
|
console.log(data);
|
||||||
|
alert(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
|
||||||
|
alert("An error occurred while processing the request. Please try again.");
|
||||||
|
console.error("Error Code:", xhr.status);
|
||||||
|
console.error("Error Message:", error);
|
||||||
|
console.error("Response Text:", xhr.responseText);
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
$('#loader').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function tableToJson() {
|
||||||
|
const table = $('#bagStockDetailsTableId');
|
||||||
|
const rows = [];
|
||||||
|
|
||||||
|
//this table to json is customized for bagstock not for all
|
||||||
|
|
||||||
|
table.find('tbody tr').each(function() {
|
||||||
|
const rowCells = $(this).find('td');
|
||||||
|
const date = rowCells.eq(0).text().trim();
|
||||||
|
|
||||||
|
|
||||||
|
/** we get eight entries against a material so we loop from 1 to 7 and so on
|
||||||
|
in a single row **/
|
||||||
|
for (let i = 1; i < rowCells.length; i += 7) {
|
||||||
|
const rowData = {
|
||||||
|
date: rowCells.eq(i).text().trim(),
|
||||||
|
materialCode: rowCells.eq(i+1).text().trim(),
|
||||||
|
customer: rowCells.eq(i+2).text().trim(),
|
||||||
|
opening: rowCells.eq(i+3).text().trim(),
|
||||||
|
receipt: rowCells.eq(i+4).text().trim(),
|
||||||
|
used: rowCells.eq(i+5).text().trim(),
|
||||||
|
balanceStock: rowCells.eq(i + 6).text().trim()
|
||||||
|
};
|
||||||
|
|
||||||
|
rows.push(rowData);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return JSON.stringify(rows, null, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function openingStockChange(tdElement) {
|
||||||
|
|
||||||
|
try{
|
||||||
|
let dataId = tdElement.getAttribute('data-id');
|
||||||
|
let [date,materialCode] = tdElement.getAttribute('data-id').split(' ');
|
||||||
|
let openingStock = tdElement.innerText;
|
||||||
|
let usedStock = document.querySelector(`td.usedStock[data-id="${dataId}"]`).innerText;
|
||||||
|
let receiptStock = document.querySelector(`td.receiptStock[data-id="${dataId}"]`).innerText;
|
||||||
|
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
|
||||||
|
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
||||||
|
|
||||||
|
updateStockValue( date,materialCode,currentBalanceStock )
|
||||||
|
|
||||||
|
|
||||||
|
} catch(error){
|
||||||
|
|
||||||
|
console.error("There is an error updating stock ..!!" + error);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function receiptStockChange(tdElement) {
|
||||||
|
try{
|
||||||
|
let dataId = tdElement.getAttribute('data-id');
|
||||||
|
let [date,materialCode] = tdElement.getAttribute('data-id').split(' ');
|
||||||
|
let openingStock = document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText;
|
||||||
|
let receiptStock = tdElement.innerText;
|
||||||
|
let usedStock = document.querySelector(`td.usedStock[data-id="${dataId}"]`).innerText;
|
||||||
|
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
|
||||||
|
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
||||||
|
|
||||||
|
updateStockValue( date,materialCode,currentBalanceStock )
|
||||||
|
|
||||||
|
|
||||||
|
} catch(error){
|
||||||
|
|
||||||
|
console.error("There is an error updating stock ..!!" + error);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function usedStockChange(tdElement) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
let dataId = tdElement.getAttribute('data-id');
|
||||||
|
let [date,materialCode] = tdElement.getAttribute('data-id').split(' ');
|
||||||
|
let openingStock = document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText;
|
||||||
|
let receiptStock = document.querySelector(`td.receiptStock[data-id="${dataId}"]`).innerText;
|
||||||
|
let usedStock = tdElement.innerText;
|
||||||
|
let currentBalanceStock = ( Number(openingStock) + Number(receiptStock) ) - Number(usedStock);
|
||||||
|
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
||||||
|
|
||||||
|
updateStockValue( date,materialCode,currentBalanceStock )
|
||||||
|
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
console.error("There is an error updating stock ..!!" + error);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function updateStockValue( date, materialCode, currentBalanceStock ){
|
||||||
|
|
||||||
|
const table = $('#bagStockDetailsTableId');
|
||||||
|
const rows = [];
|
||||||
|
|
||||||
|
table.find('tbody tr').each(function() {
|
||||||
|
const rowCells = $(this).find('td');
|
||||||
|
const otherDate = rowCells.eq(1).text().trim();
|
||||||
|
|
||||||
|
|
||||||
|
if( new Date(otherDate) > new Date(date) ){ //other records present after it
|
||||||
|
|
||||||
|
/**this data-id ,openingStock ,used stock , current Balance Stock
|
||||||
|
is for changing subsequent dates not the earlier one **/
|
||||||
|
|
||||||
|
let dataId = `${otherDate} ${materialCode}`;
|
||||||
|
|
||||||
|
document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
||||||
|
|
||||||
|
let usedStock = document.querySelector(`td.usedStock[data-id="${dataId}"]`).innerText;
|
||||||
|
|
||||||
|
let receiptStock = document.querySelector(`td.receiptStock[data-id="${dataId}"]`).innerText;
|
||||||
|
|
||||||
|
currentBalanceStock = (Number(currentBalanceStock) + Number(receiptStock)) - Number(usedStock);
|
||||||
|
|
||||||
|
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
||||||
|
|
||||||
|
// console.log( 'other date' , new Date(otherDate));
|
||||||
|
// console.log('new balance stock' , currentBalanceStock)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function customerChange(thElement){
|
||||||
|
let materialCode = thElement.getAttribute('data-materialCode');
|
||||||
|
let newCustomerValue = thElement.innerText;
|
||||||
|
let matchingCustomerData = document.querySelectorAll(`td.customer[data-materialCode="${materialCode}"]`);
|
||||||
|
matchingCustomerData.forEach((element,index)=>{
|
||||||
|
element.innerText=newCustomerValue;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@ -773,16 +773,18 @@
|
|||||||
|
|
||||||
<a href="<?php echo base_url(); ?>coatingMachineDetails" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Coating Machine Details</a>
|
<a href="<?php echo base_url(); ?>coatingMachineDetails" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Coating Machine Details</a>
|
||||||
|
|
||||||
|
<a href="<?php echo base_url(); ?>gasStockDetails" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Gas Stock Details</a>
|
||||||
|
|
||||||
<a href="<?php echo base_url(); ?>factoryVehicleDieselDetails" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Diesel - Factory Vehicle </a>
|
<a href="<?php echo base_url(); ?>factoryVehicleDieselDetails" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Diesel - Factory Vehicle </a>
|
||||||
|
|
||||||
<a href="<?php echo base_url(); ?>powerConsumptionDetails" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Power Consumption </a>
|
<a href="<?php echo base_url(); ?>powerConsumptionDetails" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Power Consumption </a>
|
||||||
|
|
||||||
<a href="<?php echo base_url(); ?>bagStockDetails" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Bag Stock Details</a>
|
|
||||||
|
|
||||||
<a href="<?php echo base_url(); ?>dustAndRoughStockDetails" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Dust And Rough Stock Details</a>
|
<a href="<?php echo base_url(); ?>dustAndRoughStockDetails" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Dust And Rough Stock Details</a>
|
||||||
|
|
||||||
<a href="<?php echo base_url(); ?>resinStockDetails" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Resin Stock Details</a>
|
<a href="<?php echo base_url(); ?>resinStockDetails" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Resin Stock Details</a>
|
||||||
|
|
||||||
|
<a href="<?php echo base_url(); ?>bagStockDetails" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Bag Stock Details</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user