411 lines
14 KiB
PHP
411 lines
14 KiB
PHP
<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: 2px 4px;
|
|
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 --> */
|
|
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;
|
|
}
|
|
|
|
.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">Bag 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('bagStockDetails'); ?>" method="post">
|
|
<div class="row">
|
|
|
|
<div class="col-3">
|
|
<?php $today = date('M-Y'); ?>
|
|
|
|
<input type="text" name="month" id="month" value=""
|
|
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"
|
|
style="font-size: small;">
|
|
|
|
<thead class="celda_encabezado_general" style="padding: 10px;">
|
|
|
|
<tr>
|
|
|
|
<th colspan="1">material </th>
|
|
|
|
<!-- this will loop till materials present -->
|
|
<th colspan="4">material 1</th>
|
|
|
|
<th colspan="4">material 2</th>
|
|
|
|
</tr>
|
|
<tr>
|
|
<th colspan="1">Customer </th>
|
|
|
|
<!-- this will loop till materials present -->
|
|
<th colspan="4" contenteditable="true">
|
|
<?php echo $customer??'Customer' ?>
|
|
</th>
|
|
|
|
<th colspan="4" contenteditable="true">
|
|
<?php echo $customer??'Customer2' ?>
|
|
</th>
|
|
|
|
</tr>
|
|
<tr>
|
|
|
|
<th colspan="1">Date </th>
|
|
|
|
<!-- this will loop till materials present -->
|
|
<th style="display:none">Date</th>
|
|
<th style="display:none"> material</th>
|
|
<th style="display:none"> customer</th>
|
|
<th>Opening</th>
|
|
<th>Receipt</th>
|
|
<th>Used</th>
|
|
<th>Balance Stock</th>
|
|
|
|
<th style="display:none">Date</th>
|
|
<th style="display:none"> material</th>
|
|
<th style="display:none"> customer</th>
|
|
<th>Opening</th>
|
|
<th>Receipt</th>
|
|
<th>Used</th>
|
|
<th>Balance Stock</th>
|
|
|
|
</tr>
|
|
|
|
|
|
</thead>
|
|
<tbody style="background-color: #fff;" >
|
|
|
|
|
|
<tr>
|
|
<td class="celda_normal" >23-10-2024</td>
|
|
<td style="display:none">23-10-2024</td>
|
|
<td style="display:none"> material 1</td>
|
|
<td style="display:none"> customer 1</td>
|
|
<td class="celda_normal">472</td>
|
|
<td class="celda_normal" >11212</td>
|
|
<td class="celda_normal" contenteditable="true" >-</td>
|
|
<td class="celda_normal" >472</td>
|
|
|
|
<td style="display:none">23-10-2024</td>
|
|
<td style="display:none"> material 2</td>
|
|
<td style="display:none"> customer 2</td>
|
|
<td class="celda_normal" >472</td>
|
|
<td class="celda_normal">11212</td>
|
|
<td class="celda_normal" contenteditable="true" >-</td>
|
|
<td class="celda_normal">472</td>
|
|
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="celda_normal" >24-10-2024</td>
|
|
<td style="display:none">24-10-2024</td>
|
|
<td style="display:none"> material 1</td>
|
|
<td style="display:none"> customer 1</td>
|
|
<td class="celda_normal" >472</td>
|
|
<td class="celda_normal">11212</td>
|
|
<td class="celda_normal" contenteditable="true" >-</td>
|
|
<td class="celda_normal">472</td>
|
|
|
|
<td style="display:none">24-10-2024</td>
|
|
<td style="display:none"> material 2</td>
|
|
<td style="display:none"> customer 2</td>
|
|
<td class="celda_normal" >472</td>
|
|
<td class="celda_normal">11212</td>
|
|
<td class="celda_normal" contenteditable="true" >-</td>
|
|
<td class="celda_normal">472</td>
|
|
|
|
|
|
</tr>
|
|
|
|
</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();
|
|
|
|
$('#loader').show();
|
|
$.ajax({
|
|
data: {
|
|
updateBagStockDetails
|
|
},
|
|
type: "POST",
|
|
url: "<?php echo base_url() ?>updateBagStockDetails",
|
|
|
|
success: function (data) {
|
|
if (data) {
|
|
$('#loader').hide();
|
|
|
|
alert(data);
|
|
|
|
}
|
|
|
|
}
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<script>
|
|
function tableToJson() {
|
|
const table = $('#bagStockDetailsTableId');
|
|
const rows = [];
|
|
|
|
|
|
table.find('tbody tr').each(function() {
|
|
const rowCells = $(this).find('td');
|
|
const date = rowCells.eq(0).text().trim();
|
|
|
|
|
|
|
|
for (let i = 1; i < rowCells.length; i += 7) {
|
|
const rowData = {
|
|
date: rowCells.eq(i).text().trim(),
|
|
material: 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);
|
|
}
|
|
|
|
console.log(tableToJson());
|
|
|
|
|
|
</script>
|