changes in bag stock module - vadivel J
This commit is contained in:
parent
439909fda0
commit
4a28f03d1a
@ -28,6 +28,7 @@ class StockController extends BaseController
|
|||||||
protected $inwardGateRegister_model;
|
protected $inwardGateRegister_model;
|
||||||
protected $rawmaterialdetails_model;
|
protected $rawmaterialdetails_model;
|
||||||
protected $bagStockDetails_model;
|
protected $bagStockDetails_model;
|
||||||
|
protected $Rawmaterialdetails_model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is default constructor of the class
|
* This is default constructor of the class
|
||||||
@ -46,6 +47,7 @@ class StockController extends BaseController
|
|||||||
$this->inwardGateRegister_model = new Inwardgateregister_model();
|
$this->inwardGateRegister_model = new Inwardgateregister_model();
|
||||||
$this->bagStockDetails_model = new BagStockDetailsModel();
|
$this->bagStockDetails_model = new BagStockDetailsModel();
|
||||||
|
|
||||||
|
|
||||||
$this->session = session();
|
$this->session = session();
|
||||||
helper('form');
|
helper('form');
|
||||||
|
|
||||||
@ -311,10 +313,26 @@ class StockController extends BaseController
|
|||||||
// Reset the structure to have indexed arrays without the date keys
|
// Reset the structure to have indexed arrays without the date keys
|
||||||
$data['groupedBagStockDetails'] = array_values($groupedByDate);
|
$data['groupedBagStockDetails'] = array_values($groupedByDate);
|
||||||
|
|
||||||
$data['distinctMaterialCodes'] = $this->bagStockDetails_model
|
|
||||||
->distinct()
|
|
||||||
->select('materialCode')
|
$bagMaterials= $this->rawmaterialdetails_model->getAllBagMaterialCode();
|
||||||
->findAll();
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach($bagMaterials as $key => $bagMaterial){
|
||||||
|
$materialCode = $bagMaterial['MaterialCode'];
|
||||||
|
$bagMaterials[$key]['customers'] = $this->bagStockDetails_model
|
||||||
|
->select('customer')
|
||||||
|
->where('date >=', $startDate)
|
||||||
|
->where('date <=', $endDate)
|
||||||
|
->where('materialCode', $materialCode)
|
||||||
|
->first()['customer'] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$bagMaterialcount = count($bagMaterials);
|
||||||
|
|
||||||
|
$data['bagMaterialcount'] = $bagMaterialcount;
|
||||||
|
$data['bagMaterials'] = $bagMaterials;
|
||||||
|
|
||||||
$date = DateTime::createFromFormat('Y-m', $month);
|
$date = DateTime::createFromFormat('Y-m', $month);
|
||||||
|
|
||||||
@ -323,6 +341,7 @@ class StockController extends BaseController
|
|||||||
$data['month']=$formattedDate;
|
$data['month']=$formattedDate;
|
||||||
|
|
||||||
return $this->loadViews("bagStockDetails", $this->global, $data, NULL);
|
return $this->loadViews("bagStockDetails", $this->global, $data, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateBagStockDetails(){
|
public function updateBagStockDetails(){
|
||||||
|
|||||||
@ -136,6 +136,20 @@ class Rawmaterialdetails_model extends Model
|
|||||||
return $materialCodes = array_column($materialResults, 'MaterialCode');
|
return $materialCodes = array_column($materialResults, 'MaterialCode');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAllBagMaterialCode(){
|
||||||
|
|
||||||
|
$builder = $this->db->table('t_materialmaster')
|
||||||
|
->select('MaterialCode , MaterialName')
|
||||||
|
->where('IsActive', 1)
|
||||||
|
->where('Category', 'bag')
|
||||||
|
->orderBy('MaterialCode', 'asc');
|
||||||
|
$query = $builder->get();
|
||||||
|
$materialResults = $query->getResultArray();
|
||||||
|
|
||||||
|
return $materialResults;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getMaterialstock($MaterialCode, $currentdate)
|
function getMaterialstock($MaterialCode, $currentdate)
|
||||||
|
|
||||||
|
|||||||
@ -105,10 +105,11 @@
|
|||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding: 2px 4px;
|
padding: 6px 10px;;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
._Separador {
|
._Separador {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
height: 12px;
|
height: 12px;
|
||||||
@ -124,6 +125,7 @@
|
|||||||
.celda_normal {
|
.celda_normal {
|
||||||
/*background-color: #fff;*/
|
/*background-color: #fff;*/
|
||||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||||
|
text-align: center;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
}
|
}
|
||||||
@ -216,19 +218,24 @@
|
|||||||
|
|
||||||
<th class="celda_encabezado_general" colspan="1">material </th>
|
<th class="celda_encabezado_general" colspan="1">material </th>
|
||||||
|
|
||||||
<?php foreach($distinctMaterialCodes as $index => $distinctMaterialCode){ ?>
|
|
||||||
|
|
||||||
|
<?php foreach($bagMaterials as $bagMaterial){ ?>
|
||||||
<!-- this will loop till materials present -->
|
<!-- this will loop till materials present -->
|
||||||
<th class="celda_encabezado_general" colspan="4">material<?php echo $index?></th>
|
<th class="celda_encabezado_general" colspan="4">
|
||||||
|
<?= $bagMaterial['MaterialName']?>
|
||||||
|
<!-- (<?= $bagMaterial['MaterialCode']?>) -->
|
||||||
|
</th>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th class="celda_encabezado_general" colspan="1">Customer </th>
|
<th class="celda_encabezado_general" colspan="1">Customer </th>
|
||||||
|
|
||||||
<?php foreach($distinctMaterialCodes as $index => $distinctMaterialCode){ ?>
|
<?php foreach($bagMaterials as $bagMaterial){ ?>
|
||||||
<!-- this will loop till materials present -->
|
<!-- this will loop till materials present -->
|
||||||
<th class="celda_encabezado_general" colspan="4" contenteditable="true">
|
<th class="celda_encabezado_general" colspan="4" contenteditable="true">
|
||||||
<?php echo $customer??"customer$index" ?>
|
<?= $bagMaterial['customers']?>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
</th>
|
</th>
|
||||||
@ -237,10 +244,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<th class="celda_encabezado_general" colspan="1">Date </th>
|
<th class="celda_encabezado_general" colspan="1">Date </th>
|
||||||
|
|
||||||
<?php foreach($distinctMaterialCodes as $index => $distinctMaterialCode){ ?>
|
<?php foreach($bagMaterials as $bagMaterial){ ?>
|
||||||
<!-- this will loop till materials present -->
|
<!-- this will loop till materials present -->
|
||||||
<th class="celda_encabezado_general" style="display:none">Date</th>
|
<th class="celda_encabezado_general" style="display:none">Date</th>
|
||||||
<th class="celda_encabezado_general" style="display:none"> material</th>
|
<th class="celda_encabezado_general" style="display:none"> material</th>
|
||||||
@ -266,7 +272,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<?php foreach($bagStockDetails as $bagStockIndex => $bagStock){ ?>
|
<?php foreach($bagStockDetails as $bagStockIndex => $bagStock){ ?>
|
||||||
<?php if ($bagStockIndex === 0): ?>
|
<?php if ($bagStockIndex == 0): ?>
|
||||||
<td class="celda_normal">
|
<td class="celda_normal">
|
||||||
<?= $bagStock['date'] ?>
|
<?= $bagStock['date'] ?>
|
||||||
</td>
|
</td>
|
||||||
@ -285,7 +291,10 @@
|
|||||||
<td class="celda_normal openingStock"
|
<td class="celda_normal openingStock"
|
||||||
data-id="<?=$bagStock['date']?> <?=$bagStock['materialCode']?>"
|
data-id="<?=$bagStock['date']?> <?=$bagStock['materialCode']?>"
|
||||||
oninput="openingStockChange(this)"
|
oninput="openingStockChange(this)"
|
||||||
contenteditable="true"><?= $bagStock['opening']?>
|
<?php if ($groupedBagStockDetailsIndex == 0): ?>
|
||||||
|
contenteditable="true"
|
||||||
|
<?php endif; ?>
|
||||||
|
><?= $bagStock['opening']?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="celda_normal receiptStock"
|
<td class="celda_normal receiptStock"
|
||||||
@ -309,7 +318,55 @@
|
|||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } else{?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$date = DateTime::createFromFormat('M-Y', $month);
|
||||||
|
$month = $date->format('m-Y');
|
||||||
|
$startDate = "01-$month";
|
||||||
|
|
||||||
|
?>
|
||||||
|
<th class="celda_normal" colspan="1"><?= $startDate?> </th>
|
||||||
|
|
||||||
|
<?php foreach($bagMaterials as $bagMaterial){ ?>
|
||||||
|
<!-- this will loop till materials present -->
|
||||||
|
|
||||||
|
<td class="celda_normal" style="display:none">
|
||||||
|
<?= $startDate?>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="celda_normal" style="display:none"
|
||||||
|
data-id="<?=$startDate?> <?=$bagMaterial['MaterialCode']?>">
|
||||||
|
<?= $bagMaterial['MaterialCode']?>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="celda_normal" style="display:none">
|
||||||
|
<?= $bagMaterial['customers']?>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="celda_normal openingStock"
|
||||||
|
data-id="<?=$startDate?> <?=$bagMaterial['MaterialCode']?>"
|
||||||
|
oninput="openingStockChange(this)"
|
||||||
|
contenteditable="true">0</td>
|
||||||
|
|
||||||
|
<td class="celda_normal receiptStock"
|
||||||
|
data-id="<?=$startDate?> <?=$bagMaterial['MaterialCode']?>"
|
||||||
|
oninput="openingStockChange(this)"
|
||||||
|
contenteditable="true">0</td>>0</td>
|
||||||
|
|
||||||
|
<td class="celda_normal usedStock"
|
||||||
|
data-id="<?=$startDate?> <?=$bagMaterial['MaterialCode']?>"
|
||||||
|
oninput="usedStockChange(this)"
|
||||||
|
contenteditable="true">0</td>
|
||||||
|
|
||||||
|
<td class="celda_normal balanceStock"
|
||||||
|
data-id="<?=$startDate?> <?=$bagMaterial['MaterialCode']?>"
|
||||||
|
oninput="usedStockChange(this)"
|
||||||
|
contenteditable="true">0</td>
|
||||||
|
<?php } ?>
|
||||||
|
<?php }?>
|
||||||
|
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user