Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme

This commit is contained in:
Gowtham M 2024-10-29 14:37:44 +05:30
commit cd64841608
4 changed files with 167 additions and 97 deletions

View File

@ -7,25 +7,19 @@ use CodeIgniter\Model;
class BagStockDetailsModel extends Model class BagStockDetailsModel extends Model
{ {
protected $table = 't_bagStockDetails'; protected $table = 't_bagStockDetails';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array'; protected $returnType = 'array';
protected $useSoftDeletes = false; protected $useSoftDeletes = false;
protected $protectFields = true; protected $protectFields = true;
protected $allowedFields = []; protected $allowedFields = [
'date', 'materialCode', 'customer', 'opening', 'receipt', 'used', 'balanceStock'
];
protected bool $allowEmptyInserts = false; protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true; protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates // Dates
protected $useTimestamps = false; protected $useTimestamps = false;
protected $dateFormat = 'datetime'; protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation // Validation
protected $validationRules = []; protected $validationRules = [];
@ -33,14 +27,35 @@ class BagStockDetailsModel extends Model
protected $skipValidation = false; protected $skipValidation = false;
protected $cleanValidationRules = true; protected $cleanValidationRules = true;
// Callbacks /**
protected $allowCallbacks = true; * Custom method to handle composite key updates.
protected $beforeInsert = []; * @param array $data Array of records to be updated in bulk.
protected $afterInsert = []; * @return bool
protected $beforeUpdate = []; */
protected $afterUpdate = []; public function updateBatchWithCompositeKey(array $data)
protected $beforeFind = []; {
protected $afterFind = []; $db = \Config\Database::connect();
protected $beforeDelete = []; $db->transBegin();
protected $afterDelete = [];
foreach ($data as $record) {
$db->table($this->table)
->where('date', $record['date'])
->where('materialCode', $record['materialCode'])
->update([
'customer' => $record['customer'],
'opening' => $record['opening'],
'receipt' => $record['receipt'],
'used' => $record['used'],
'balanceStock' => $record['balanceStock']
]);
}
if ($db->transStatus() === FALSE) {
$db->transRollback();
return false;
} else {
$db->transCommit();
return true;
}
}
} }

View File

@ -378,12 +378,12 @@ class Inwardgateregister_model extends Model
->join('t_transporter trans', 'igr.TransporterId = trans.id' , 'left') ->join('t_transporter trans', 'igr.TransporterId = trans.id' , 'left')
->join('t_igr_details IGRD', 'igr.IGRNo = IGRD.IGRNo') ->join('t_igr_details IGRD', 'igr.IGRNo = IGRD.IGRNo')
->where('igr.IGRStatus !=', MRIR_CREATED) ->where('igr.IGRStatus !=', MRIR_CREATED)
->where('igr.CreatedDate >=',"$fromDate") ->where('Date(igr.CreatedDate) >=',"$fromDate")
->where('igr.CreatedDate <=', "$toDate") ->where('Date(igr.CreatedDate) <=', "$toDate")
->groupBy('igr.IGRNo') ->groupBy('igr.IGRNo')
->orderBy('igr.CreatedDate', 'desc'); ->orderBy('igr.CreatedDate', 'desc');
$query = $builder->get(); $query = $builder->get();
$result = $query->getResult(); $result = $query->getResult();
$builder2 = $this->db->table('t_igr_details igr_details') $builder2 = $this->db->table('t_igr_details igr_details')
->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName,item.MaterialName, igr_details.QuantityAsPerInvoice as ReceivedQuantity , igr_details.NetWeight as NetWeight') ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName,item.MaterialName, igr_details.QuantityAsPerInvoice as ReceivedQuantity , igr_details.NetWeight as NetWeight')

View File

@ -403,8 +403,8 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
// $builder->orderBy('POMast.Status !=',PO_AMENDED); // $builder->orderBy('POMast.Status !=',PO_AMENDED);
} }
$builder->where('POMast.CreatedDate >=', $fromDate) $builder->where('Date(POMast.CreatedDate) >=', $fromDate)
->where('POMast.CreatedDate <=', $toDate); ->where('Date(POMast.CreatedDate) <=', $toDate);
$builder->orderBy('POMast.CreatedDate', 'desc'); $builder->orderBy('POMast.CreatedDate', 'desc');

View File

@ -208,85 +208,108 @@
</div> </div>
</form> </form>
<table id="data-table">
<thead>
<tr>
<th rowspan="4" colspan="1">
Material <br><br> Customer <br><br> Date
</th>
</tr>
<tr>
<?php foreach ($materials as $material) { ?>
<th colspan="4"><?php echo ($material) ?></th>
<?php } ?>
</tr>
<tr>
<?php foreach ($materials as $material) { ?>
<th colspan="4" contenteditable="true">
customers
</th>
<?php } ?>
</tr>
<tr>
<?php foreach ($materials as $material) { ?>
<th>info1</th>
<th>info2</th>
<th>info3</th>
<th>info4</th>
<?php } ?>
</tr>
</thead>
<tbody>
<tr>
<td>23-10-2024</td>
<td>472</td>
<td></td>
<td>-</td>
<td>472</td>
<td>472</td>
<td></td>
<td>-</td>
<td>472</td>
</tr>
<!-- Add more rows as needed -->
</tbody>
</table>
<!-- Add table-responsive for horizontal scroll -->
<div class="table-responsive"> <div class="table-responsive">
<table id="bagStockDetailsTableId" class="fht-table table-striped" <table id="bagStockDetailsTableId" class="fht-table table-striped"
style="font-size: small;"> style="font-size: small;">
<thead>
<thead class="celda_encabezado_general" style="padding: 10px;">
<tr> <tr>
<th class="celda_encabezado_general" style="padding: 10px;">S.NO </th>
<th class="celda_encabezado_general" style="padding: 10px;">IGR No </th> <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> </tr>
</thead> </thead>
<tbody style="background-color: #fff;"> <tbody style="background-color: #fff;" >
<tr id="1">
<td width="45" height="45" class="celda_normal">1</td> <tr>
<td class="celda_normal"> <td class="celda_normal" >23-10-2024</td>
data 2 <td style="display:none">23-10-2024</td>
</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>
<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> </tbody>
</table> </table>
</div>
</div><!-- End table-responsive -->
<div class="row"> <div class="row">
<div class="col-md-12 text-right"> <div class="col-md-12 text-right">
@ -322,9 +345,7 @@
//table to json function //table to json function
var updateBagStockDetails = $("#bagStockDetailsTableId").tableToJSON(); var updateBagStockDetails = tableToJSON();
updateBagStockDetails = JSON.stringify(incomingSilicaSandDetailsData);
$('#loader').show(); $('#loader').show();
$.ajax({ $.ajax({
@ -349,8 +370,42 @@
}); });
}); });
</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> </script>