stock module changes-3 vadivel J 17-12-2024
This commit is contained in:
parent
2417e32e92
commit
4158dfac41
@ -129,7 +129,6 @@ class StockController extends BaseController
|
||||
$data['month'] = $formattedDate;
|
||||
|
||||
return $this->loadViews("CoatingMachineDetail", $this->global, $data, NULL);
|
||||
|
||||
}
|
||||
|
||||
public function addNewCoatingMachineDetails()
|
||||
@ -194,7 +193,6 @@ class StockController extends BaseController
|
||||
// Set flashdata for success message
|
||||
return redirect()->to("/coatingMachineDetails?month=$month")
|
||||
->with('success', $message1 . " " . $message2 . " " . $message3);
|
||||
|
||||
} catch (\Exception $error) {
|
||||
$this->db->transRollback();
|
||||
return redirect()->back()->with('error', ' ' . $error->getMessage());
|
||||
@ -239,7 +237,6 @@ class StockController extends BaseController
|
||||
$message2 = 'And updated gas stock consumption.';
|
||||
|
||||
$message3 = "Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!";
|
||||
|
||||
}
|
||||
// Commit the transaction if all queries succeed
|
||||
|
||||
@ -255,7 +252,6 @@ class StockController extends BaseController
|
||||
// Set flashdata for success message
|
||||
return redirect()->to("/coatingMachineDetails?month=$month")
|
||||
->with('success', $message1 . " " . $message2 . " " . $message3);
|
||||
|
||||
} else {
|
||||
throw new \Exception('Failed to update Coating machine details.');
|
||||
}
|
||||
@ -263,11 +259,6 @@ class StockController extends BaseController
|
||||
$this->db->transRollback();
|
||||
return redirect()->back()->with('error', ' ' . $error->getMessage());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function deleteCoatingMachineDetails()
|
||||
@ -317,7 +308,6 @@ class StockController extends BaseController
|
||||
|
||||
if (!empty($materialCodes)) {
|
||||
$data['igrDetails'] = $this->inwardGateRegister_model->findIgrDetailsForIncomingSilicaSand($materialCodes, $month, $remark);
|
||||
|
||||
} else {
|
||||
$data['igrDetails'] = [];
|
||||
}
|
||||
@ -331,7 +321,6 @@ class StockController extends BaseController
|
||||
$data['remark'] = $remark;
|
||||
|
||||
return $this->loadViews("incomingSilicaSandDetails", $this->global, $data, NULL);
|
||||
|
||||
}
|
||||
|
||||
public function updateIncomingSilicaSandDetails()
|
||||
@ -391,8 +380,6 @@ class StockController extends BaseController
|
||||
} else {
|
||||
$inserts[] = $dbData;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!empty($updates)) {
|
||||
@ -404,10 +391,10 @@ class StockController extends BaseController
|
||||
}
|
||||
|
||||
echo "Data Saved Successfully";
|
||||
|
||||
}
|
||||
|
||||
public function updateLabReport(){
|
||||
public function updateLabReport()
|
||||
{
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
@ -456,7 +443,6 @@ class StockController extends BaseController
|
||||
} else {
|
||||
return redirect()->back()->with('error', 'Error Saving Data..!!');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -545,10 +531,8 @@ class StockController extends BaseController
|
||||
$distinctMaterialCodes[] = $result[$index]['materialCode'];
|
||||
}
|
||||
$bagMaterials = $this->rawmaterialdetails_model->getSelectedBagMaterialCode($distinctMaterialCodes);
|
||||
|
||||
} else {
|
||||
$bagMaterials = $this->rawmaterialdetails_model->getAllBagMaterialCode();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -576,7 +560,6 @@ class StockController extends BaseController
|
||||
$data['month'] = $formattedDate;
|
||||
|
||||
return $this->loadViews("bagStockDetails", $this->global, $data, NULL);
|
||||
|
||||
}
|
||||
|
||||
public function updateBagStockDetails()
|
||||
@ -613,11 +596,9 @@ class StockController extends BaseController
|
||||
|
||||
if (empty($resultExists)) {
|
||||
$inserts[] = $dbData;
|
||||
|
||||
} else {
|
||||
$dbData['id'] = $resultExists['id'];
|
||||
$updates[] = $dbData;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -634,11 +615,9 @@ class StockController extends BaseController
|
||||
echo "Data Updated Successfully";
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo "Data Saved Successfully";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -679,7 +658,6 @@ class StockController extends BaseController
|
||||
$data['month'] = $formattedDate;
|
||||
|
||||
return $this->loadViews("dustAndRoughStockDetails", $this->global, $data, NULL);
|
||||
|
||||
}
|
||||
|
||||
public function updateDustAndRoughStockDetails()
|
||||
@ -713,7 +691,6 @@ class StockController extends BaseController
|
||||
|
||||
if (empty($resultExists)) {
|
||||
$inserts[] = $dbData;
|
||||
|
||||
} else {
|
||||
$updates[] = $dbData;
|
||||
}
|
||||
@ -736,7 +713,6 @@ class StockController extends BaseController
|
||||
}
|
||||
|
||||
echo "Data Saved Successfully";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -825,11 +801,8 @@ class StockController extends BaseController
|
||||
$distinctMaterialCodes[] = $result[$index]['materialCode'];
|
||||
}
|
||||
$resinMaterials = $this->rawmaterialdetails_model->getSelectedResinMaterialCode($distinctMaterialCodes);
|
||||
|
||||
} else {
|
||||
$resinMaterials = $this->rawmaterialdetails_model->getAllResinMaterialCode();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -855,7 +828,6 @@ class StockController extends BaseController
|
||||
$data['month'] = $formattedDate;
|
||||
|
||||
return $this->loadViews("resinStockDetails", $this->global, $data, NULL);
|
||||
|
||||
}
|
||||
|
||||
public function updateResinStockDetails()
|
||||
@ -898,7 +870,6 @@ class StockController extends BaseController
|
||||
$dbData['id'] = $resultExists['id'];
|
||||
$updates[] = $dbData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -919,7 +890,6 @@ class StockController extends BaseController
|
||||
}
|
||||
|
||||
echo "Data Saved Successfully";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -960,9 +930,10 @@ class StockController extends BaseController
|
||||
$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,
|
||||
->select(
|
||||
't_gasStockDetails.*,
|
||||
drier_summary.drierMachineGasconsumption AS drierMachineGasConsumption,
|
||||
drier_summary.driedSand AS sandDried,
|
||||
coating_summary.coatingMachineGasconsumption,
|
||||
coating_summary.coatedSand'
|
||||
)
|
||||
@ -981,10 +952,15 @@ class StockController extends BaseController
|
||||
'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),
|
||||
'(SELECT date,
|
||||
SUM(total_gas_consumption) AS drierMachineGasconsumption,
|
||||
SUM(sand_dried_qty) AS driedSand
|
||||
FROM t_drierMachineDetails
|
||||
WHERE date >= ' . $this->db->escape($startDate) . '
|
||||
AND date <= ' . $this->db->escape($endDate) . '
|
||||
GROUP BY date
|
||||
) AS drier_summary',
|
||||
'drier_summary.date = t_gasStockDetails.date',
|
||||
'left'
|
||||
)
|
||||
|
||||
@ -1108,8 +1084,6 @@ class StockController extends BaseController
|
||||
|
||||
|
||||
$updates[] = $result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!empty($updates)) {
|
||||
@ -1118,7 +1092,6 @@ class StockController extends BaseController
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@ -1181,8 +1154,6 @@ class StockController extends BaseController
|
||||
];
|
||||
|
||||
$opening = $balanceStock;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!empty($inserts)) {
|
||||
@ -1191,7 +1162,6 @@ class StockController extends BaseController
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1256,7 +1226,11 @@ class StockController extends BaseController
|
||||
$data['timeDropdown'] = $this->generateTimeOptions();
|
||||
$data['supplierData'] = $this->supplier_model->supplierlisting();
|
||||
|
||||
$data['drierDetails'] = $this->drierMachineDetails_model->where('date >=', $data['startDate'])->where('date <=', $data['endDate'])->findAll();
|
||||
$data['drierDetails'] = $this->drierMachineDetails_model->where('date >=', $data['startDate'])
|
||||
->where('date <=', $data['endDate'])
|
||||
->orderBy('date','asc')
|
||||
->findAll();
|
||||
|
||||
if (!count($data['drierDetails'])) {
|
||||
//insert empty data
|
||||
$tempInsert = [];
|
||||
@ -1265,7 +1239,10 @@ class StockController extends BaseController
|
||||
}
|
||||
$this->drierMachineDetails_model->insertBatch($tempInsert);
|
||||
|
||||
$data['drierDetails'] = $this->drierMachineDetails_model->where('date >=', $data['startDate'])->where('date <=', $data['endDate'])->findAll();
|
||||
$data['drierDetails'] = $this->drierMachineDetails_model->where('date >=', $data['startDate'])
|
||||
->where('date <=', $data['endDate'])
|
||||
->orderBy('date','asc')
|
||||
->findAll();
|
||||
}
|
||||
|
||||
$data['datefordropdown'] = $currentMonth;
|
||||
@ -1279,12 +1256,35 @@ class StockController extends BaseController
|
||||
|
||||
public function addOrEditdrierMachineDetails()
|
||||
{
|
||||
$drierData = [];
|
||||
$drierData = json_decode($this->request->getPost('drierData'), true);
|
||||
|
||||
|
||||
if (empty($drierData)) {
|
||||
$additionalEntry = $this->request->getPost();
|
||||
if (!empty($additionalEntry)) {
|
||||
$drierData[] = [
|
||||
'Date' => $this->convertToDateWithFlexibleFormats($additionalEntry['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"),
|
||||
'Drier On Time' => $additionalEntry['Drier_On_Time'],
|
||||
'Drier Off Time' => $additionalEntry['Drier_Off_Time'],
|
||||
'Running Hrs' => $additionalEntry['Running_Hrs'],
|
||||
'Supplier Name' => $additionalEntry['Supplier_Name'],
|
||||
'i/p Sand Moisture(%)' => $additionalEntry['i/p_Sand_Moisture(%)'],
|
||||
'Tot Gas Consumption' => $additionalEntry['Tot_Gas_Consumption'],
|
||||
'Gas Per Ton' => $additionalEntry['Gas_Per_Ton'],
|
||||
'i/p Sand Qty' => $additionalEntry['i/p_Sand_Qty'],
|
||||
'Moisture Loss Qty' => $additionalEntry['Moisture_Loss_Qty'],
|
||||
'Sand Dried Qty' => $additionalEntry['Sand_Dried_Qty'],
|
||||
'Qty Per Hrs' => $additionalEntry['Qty_Per_Hrs'],
|
||||
'Dust Qty' => $additionalEntry['Dust_Qty'],
|
||||
'Customer Name' => $additionalEntry['Customer_Name']
|
||||
];
|
||||
} else {
|
||||
|
||||
echo "No data received.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$message1 = '';
|
||||
|
||||
@ -1293,14 +1293,14 @@ class StockController extends BaseController
|
||||
try {
|
||||
foreach ($drierData as $row) {
|
||||
$data = [
|
||||
'date' => DateTime::createFromFormat('d-m-Y', $row['Date'])->format('Y-m-d'),
|
||||
'date' => $this->convertToDateWithFlexibleFormats($row['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"),
|
||||
'drier_on_time' => $row['Drier On Time'],
|
||||
'drier_off_time' => $row['Drier Off Time'],
|
||||
'drier_running_hours' => $row['Running Hrs'],
|
||||
'supplier_name' => $row['Supplier Name'],
|
||||
'input_sand_moisture' => $row['i/p Sand Moisture(%)'],
|
||||
'total_gas_consumption' => $row['Tot Gas Consumption'],
|
||||
'gas_per_ton' => $row['Gas Pre Ton'],
|
||||
'gas_per_ton' => $row['Gas Per Ton'],
|
||||
'input_sand_qty' => $row['i/p Sand Qty'],
|
||||
'moisture_loss_qty' => $row['Moisture Loss Qty'],
|
||||
'sand_dried_qty' => $row['Sand Dried Qty'],
|
||||
@ -1310,7 +1310,7 @@ class StockController extends BaseController
|
||||
];
|
||||
|
||||
// Check if a row with the same date already exists
|
||||
$existingRow = $this->drierMachineDetails_model->where('date', $data['date'])->first();
|
||||
$existingRow = $this->drierMachineDetails_model->where('id', $row['id'] ?? '')->first();
|
||||
|
||||
$inserts = [];
|
||||
$updates = [];
|
||||
@ -1330,7 +1330,6 @@ class StockController extends BaseController
|
||||
}
|
||||
$data['id'] = $existingRow['id'];
|
||||
$updates[] = $data;
|
||||
|
||||
} else {
|
||||
// If not, insert a new row
|
||||
//before inserting the row update gas stock
|
||||
@ -1340,7 +1339,6 @@ class StockController extends BaseController
|
||||
|
||||
|
||||
$inserts[] = $data;
|
||||
|
||||
}
|
||||
|
||||
if (!empty($inserts)) {
|
||||
@ -1358,21 +1356,47 @@ class StockController extends BaseController
|
||||
if ($this->db->transStatus() === false) {
|
||||
throw new \Exception('Transaction failed due to database error.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->db->transCommit();
|
||||
echo "Data successfully saved. $message1";
|
||||
|
||||
if (!empty($additionalEntry)) {
|
||||
return redirect()->back()->with('success', " Data Saved Successfully..!!");
|
||||
}
|
||||
|
||||
echo "Data saved successfully . $message1";
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Rollback the transaction on any failure
|
||||
$this->db->transRollback();
|
||||
echo "Failed to save/Update data: " . $e->getMessage();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function convertToDateWithFlexibleFormats($dateInput, array $inputFormats, string $outputFormat): ?string
|
||||
{
|
||||
// If it's already a DateTime object, just format it
|
||||
if ($dateInput instanceof DateTime) {
|
||||
return $dateInput->format($outputFormat);
|
||||
}
|
||||
|
||||
// If it's a string, attempt to parse it
|
||||
if (is_string($dateInput)) {
|
||||
foreach ($inputFormats as $format) {
|
||||
$date = DateTime::createFromFormat($format, $dateInput);
|
||||
if ($date) {
|
||||
return $date->format($outputFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $dateInput;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function factoryVehicleDieselDetails()
|
||||
{
|
||||
$currentMonth = $this->request->getPost('month') ? $this->request->getPost('month') : date('M-Y');
|
||||
@ -1437,7 +1461,6 @@ class StockController extends BaseController
|
||||
|
||||
$this->global['pageTitle'] = 'Drier Details';
|
||||
$this->loadViews("factoryDieselMachineDetails", $this->global, $data, NULL);
|
||||
|
||||
}
|
||||
|
||||
public function getDieselConsumptionPivot($machineDetails, $startDate, $endDeate)
|
||||
@ -1514,7 +1537,6 @@ class StockController extends BaseController
|
||||
if ($row['machine_id'] == 0) {
|
||||
// Summary data: if machine_id is 0, it indicates summary data. This distinction is used because these records will be stored in a separate table.
|
||||
$this->factoryVehicleDieselStockSummary_model->where('date', $row['date'])->set($row)->update();
|
||||
|
||||
} else {
|
||||
|
||||
// Diesel - factory vehicle data :
|
||||
@ -1524,14 +1546,11 @@ class StockController extends BaseController
|
||||
} else {
|
||||
$this->factoryVehicleDieselDetails_model->insert($row);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo "Data successfully saved.";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1573,7 +1592,6 @@ class StockController extends BaseController
|
||||
|
||||
$this->global['pageTitle'] = 'Power Consumption Details';
|
||||
$this->loadViews("powerConsumptionDetails", $this->global, $data, NULL);
|
||||
|
||||
}
|
||||
|
||||
public function getElectricConsumptionPivot($machineDetails, $startDate, $endDeate)
|
||||
@ -1654,8 +1672,5 @@ class StockController extends BaseController
|
||||
|
||||
|
||||
echo "Data successfully saved.";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -348,7 +348,7 @@ class Ipinvoice_model extends Model
|
||||
->join('ip_invoice_items b', 'a.invoice_id = b.invoice_id', 'left')
|
||||
->join('ip_invoice_item_amounts c', 'b.item_id = c.item_id', 'left')
|
||||
->where('a.invoice_date_created >=', $fiscalYearStartCurrent)
|
||||
->where('a.invoice_status_id', 2)
|
||||
->whereIn('a.invoice_status_id', [2,5])
|
||||
->groupBy("DATE_FORMAT(a.invoice_date_created, '%b')")
|
||||
->orderBy('MONTH(a.invoice_date_created)');
|
||||
|
||||
@ -360,7 +360,7 @@ class Ipinvoice_model extends Model
|
||||
->join('ip_invoice_item_amounts c', 'b.item_id = c.item_id', 'left')
|
||||
->where('a.invoice_date_created >=', $fiscalYearStartLast)
|
||||
->where('a.invoice_date_created <', $fiscalYearStartCurrent)
|
||||
->where('a.invoice_status_id', 2)
|
||||
->whereIn('a.invoice_status_id', [2,5])
|
||||
->groupBy("DATE_FORMAT(a.invoice_date_created, '%b')")
|
||||
->orderBy('MONTH(a.invoice_date_created)');
|
||||
|
||||
@ -425,7 +425,7 @@ class Ipinvoice_model extends Model
|
||||
->join('ip_tax_rates igst', 'igst.tax_rate_id = iit.igst_item_tax_rate_id', 'left')
|
||||
->join('ip_tax_rates tcs', 'tcs.tax_rate_id = tc.tax_rate_id', 'left')
|
||||
->where('icf.invoice_custom_fieldid', $vehicleCustomFieldId)
|
||||
->where('ii.invoice_status_id', 2)
|
||||
->whereIn('ii.invoice_status_id', [2,5])
|
||||
->where('ii.invoice_date_created', date('Y-m-d'))
|
||||
->groupBy('ii.invoice_number, iit.item_description')
|
||||
->orderBy('ii.invoice_number');
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
<?php
|
||||
$datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
?>
|
||||
@ -180,8 +178,6 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
border-right: 2px solid #ddd;
|
||||
color: #0e0b0b;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<div class="content-page">
|
||||
<div class="content">
|
||||
@ -263,13 +259,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Supplier Name</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">i/p Sand Moisture(%)</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Tot Gas Consumption</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Gas Pre Ton</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Gas Per Ton</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">i/p Sand Qty</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Moisture Loss Qty</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Sand Dried Qty</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Qty Per Hrs</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Dust Qty</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Customer Name</th>
|
||||
<th class="celda_encabezado_general" style="display:none;">id</th>
|
||||
|
||||
</tr>
|
||||
|
||||
@ -287,9 +284,10 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<?php
|
||||
$date = DateTime::createFromFormat('Y-m-d', $a['date'])->format('Y-m-d');
|
||||
$currentDate = date('Y-m-d');
|
||||
if ($date === $currentDate) { echo 'style="background: #cef0ad;"'; }
|
||||
?>
|
||||
>
|
||||
if ($date === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>>
|
||||
|
||||
<!-- td:eq(0) date -->
|
||||
<td width="79" height="45" class="celda_normal"><?php echo DateTime::createFromFormat('Y-m-d', $a['date'])->format('d-m-Y'); ?></td>
|
||||
@ -300,7 +298,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<select class="timeDropdown drier_on_time" style="width: 100px;">
|
||||
<option value="">Select</option>
|
||||
<?php foreach ($timeDropdown as $key => $time) { ?>
|
||||
<option value="<?= $time; ?>" <?php if($a['drier_on_time'] == $time){ echo 'selected'; } ?> ><?= $time; ?></option>
|
||||
<option value="<?= $time; ?>" <?php if ($a['drier_on_time'] == $time) {
|
||||
echo 'selected';
|
||||
} ?>><?= $time; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>
|
||||
@ -310,7 +310,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<select class="timeDropdown drier_off_time" style="width: 100px;">
|
||||
<option value="">Select</option>
|
||||
<?php foreach ($timeDropdown as $key => $time) { ?>
|
||||
<option value="<?= $time; ?>" <?php if($a['drier_off_time'] == $time){ echo 'selected'; } ?> ><?= $time; ?></option>
|
||||
<option value="<?= $time; ?>" <?php if ($a['drier_off_time'] == $time) {
|
||||
echo 'selected';
|
||||
} ?>><?= $time; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>
|
||||
@ -325,7 +327,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<select class="timeDropdown supplier_name" style="width: 300px;">
|
||||
<option value="">Select</option>
|
||||
<?php foreach ($supplierData as $key => $value) { ?>
|
||||
<option value="<?= $value->SupplierID; ?>" <?php if($a['supplier_name'] == $value->SupplierID){ echo 'selected'; } ?> ><?= $value->SupplierName; ?></option>
|
||||
<option value="<?= $value->SupplierID; ?>" <?php if ($a['supplier_name'] == $value->SupplierID) {
|
||||
echo 'selected';
|
||||
} ?>><?= $value->SupplierName; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>
|
||||
@ -381,6 +385,11 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<?php echo $a['customer_name']; ?>
|
||||
</td>
|
||||
|
||||
<!-- td:eq(14) id -->
|
||||
<td class="celda_normal" style="display:none;">
|
||||
<?php echo $a['id']??''; ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
@ -467,17 +476,20 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<form action="<?php echo base_url("/addOrEditdrierMachineDetails")?>" method="POST">
|
||||
<!--14 -->
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntryDateId">Date</label>
|
||||
<input type="date" class="form-control" id="additionalEntryDateId" name="additionalEntryDate" value="">
|
||||
<input type="date" class="form-control" id="additionalEntryDateId" name="Date" value="">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntryDrierOnTimeId">Drier On Time</label>
|
||||
|
||||
<select class="timeDropdown drier_on_time" style="width: 100px;"
|
||||
id="additionalEntryDrierOnTimeId" name="additionalEntryDrierOnTime" >
|
||||
<select onchange="calculateMachineRunningHrs()"
|
||||
class="timeDropdown" style="width: 100px;"
|
||||
id="additionalEntryDrierOnTimeId" name="Drier On Time">
|
||||
<option value="">Select</option>
|
||||
<?php foreach ($timeDropdown as $key => $time) { ?>
|
||||
<option value="<?= $time; ?>"> <?= $time; ?></option>
|
||||
@ -487,8 +499,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntryDrierOffTimeId">Drier Off Time</label>
|
||||
|
||||
<select class="timeDropdown drier_on_time" style="width: 100px;"
|
||||
id="additionalEntryDrierOffTimeId" name="additionalEntryDrierOffTime" >
|
||||
<select onchange="calculateMachineRunningHrs()"
|
||||
class="timeDropdown " style="width: 100px;"
|
||||
id="additionalEntryDrierOffTimeId" name="Drier Off Time">
|
||||
<option value="">Select</option>
|
||||
<?php foreach ($timeDropdown as $key => $time) { ?>
|
||||
<option value="<?= $time; ?>"> <?= $time; ?></option>
|
||||
@ -497,7 +510,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntryRunningHrsId">Running hrs</label>
|
||||
<input type="text" class="form-control" id="additionalEntryRunningHrsId" name="additionalEntryRunningHrs" value=""
|
||||
<input type="text" class="form-control" id="additionalEntryRunningHrsId" name="Running Hrs" value=""
|
||||
readonly>
|
||||
</div>
|
||||
</div>
|
||||
@ -505,19 +518,21 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<div class="row mt-2">
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntryInputSandMoistureId">Input Sand Moisture (%)</label>
|
||||
<input type="text" class="form-control" id="additionalEntryInputSandMoistureId" name="additionalEntryInputSandMoisture" value="">
|
||||
<input type="text" class="form-control" id="additionalEntryInputSandMoistureId" name="i/p Sand Moisture(%)" value="">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntryTotalGasConsumptionId">Total Gas Consumption</label>
|
||||
<input type="text" class="form-control" id="additionalEntryTotalGasConsumptionId" name="additionalEntryTotalGasConsumption" value="">
|
||||
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
|
||||
type="text" class="form-control" id="additionalEntryTotalGasConsumptionId" name="Tot Gas Consumption" value="">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntrySandDriedQtyId">Sand Dried Qty</label>
|
||||
<input type="text" class="form-control" id="additionalEntrySandDriedQtyId" name="additionalEntrySandDriedQty" value="">
|
||||
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
|
||||
type="text" class="form-control" id="additionalEntrySandDriedQtyId" name="Sand Dried Qty" value="">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntryGasPerTonId">Gas per Ton</label>
|
||||
<input type="text" class="form-control" id="additionalEntryGasPerTonId" name="additionalEntryGasPerTon" value=""
|
||||
<input type="text" class="form-control" id="additionalEntryGasPerTonId" name="Gas Per Ton" value=""
|
||||
readonly>
|
||||
</div>
|
||||
</div>
|
||||
@ -525,20 +540,21 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<div class="row mt-2">
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntryDustQtyId">Dust Qty</label>
|
||||
<input type="text" class="form-control" id="additionalEntryDustQtyId" name="additionalEntryDustQty" value="">
|
||||
<input type="text" class="form-control" id="additionalEntryDustQtyId" name="Dust Qty" value="">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntryInputSandQtyId">Input sand Quantity</label>
|
||||
<input type="text" class="form-control" id="additionalEntryInputSandQtyId" name="additionalEntryInputSandQty" value="">
|
||||
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
|
||||
type="text" class="form-control" id="additionalEntryInputSandQtyId" name="i/p Sand Qty" value="">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntryMoistureLossQtyId">Moisture Loss Qty</label>
|
||||
<input type="text" class="form-control" id="additionalEntryMoistureLossQtyId" name="additionalEntryMoistureLossQty" value=""
|
||||
<input type="text" class="form-control" id="additionalEntryMoistureLossQtyId" name="Moisture Loss Qty" value=""
|
||||
readonly>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntryQtyPerHoursId">Qty per Hours</label>
|
||||
<input type="text" class="form-control" id="additionalEntryQtyPerHoursId" name="additionalEntryQtyPerHours" value=""
|
||||
<input type="text" class="form-control" id="additionalEntryQtyPerHoursId" name="Qty Per Hrs" value=""
|
||||
readonly>
|
||||
</div>
|
||||
</div>
|
||||
@ -547,7 +563,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntrySupplierNameId">Supplier Name</label>
|
||||
<select class="timeDropdown supplier_name" style="width: 300px;"
|
||||
id="additionalEntrySupplierNameId" name="additionalEntrySupplierName">
|
||||
id="additionalEntrySupplierNameId" name="Supplier Name">
|
||||
<option value="">Select</option>
|
||||
<?php foreach ($supplierData as $key => $value) { ?>
|
||||
<option value="<?= $value->SupplierID; ?>"> <?= $value->SupplierName; ?> </option>
|
||||
@ -556,10 +572,16 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form" for="additionalEntryCustomerNameId">Customer Name</label>
|
||||
<input type="text" class="form-control" id="additionalEntryCustomerNameId" name="additionalEntryCustomerName" value="">
|
||||
<input type="text" class="form-control" id="additionalEntryCustomerNameId" name="Customer Name" value="">
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary float-right" >Add</button>
|
||||
<button type="submit" class="btn btn-primary float-right">Add</button>
|
||||
|
||||
|
||||
<!-- hidden fields -->
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
@ -575,17 +597,12 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.timeDropdown').select2({
|
||||
placeholder: "Select",
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#save').click(function() {
|
||||
|
||||
var alldata = $("#drierTable").tableToJSON();
|
||||
@ -621,6 +638,16 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
error:function(error){
|
||||
|
||||
console.log("error occured", error);
|
||||
},
|
||||
complete:function()
|
||||
{
|
||||
$('#loader').hide();
|
||||
console.log('ajax call is completed..!!');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -675,7 +702,6 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
|
||||
if (drierOnTime != '' && drierOffTime != '') {
|
||||
|
||||
|
||||
const startDate = new Date(`1970-01-01T${convertTo24Hour(drierOnTime)}`);
|
||||
const endDate = new Date(`1970-01-01T${convertTo24Hour(drierOffTime)}`);
|
||||
|
||||
@ -704,8 +730,64 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
});
|
||||
|
||||
|
||||
function convertTo24Hour(time)
|
||||
{
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function gasPerTon(value) {
|
||||
|
||||
let tr = $(value).closest('tr');
|
||||
var totalGasConsumption = tr.find('td:eq(6)').text();
|
||||
var sandDriedQty = tr.find('td:eq(10)').text();
|
||||
if (totalGasConsumption != '' && sandDriedQty != '') {
|
||||
var gasPerTon = parseFloat(totalGasConsumption) / parseFloat(sandDriedQty);
|
||||
|
||||
if (gasPerTon && gasPerTon != NaN && gasPerTon != Infinity)
|
||||
tr.find('td:eq(7)').text(gasPerTon.toFixed(2));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function moistureLossQty(value) {
|
||||
|
||||
let tr = $(value).closest('tr');
|
||||
var inputSandQty = tr.find('td:eq(8)').text();
|
||||
var sandDriedQty = tr.find('td:eq(10)').text();
|
||||
|
||||
if (inputSandQty != '' && sandDriedQty != '') {
|
||||
|
||||
var moistureLossQty = parseFloat(inputSandQty) - parseFloat(sandDriedQty);
|
||||
|
||||
if (moistureLossQty != NaN && moistureLossQty != Infinity)
|
||||
tr.find('td:eq(9)').text(moistureLossQty.toFixed(2));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function qtyPerHrs(value) {
|
||||
|
||||
let tr = $(value).closest('tr');
|
||||
var drierRunninhHrs = tr.find('td:eq(3)').text();
|
||||
var sandDriedQty = tr.find('td:eq(10)').text();
|
||||
|
||||
if (drierRunninhHrs != '' && sandDriedQty != '') {
|
||||
|
||||
var qtyPerHrs = parseFloat(sandDriedQty) / parseFloat(drierRunninhHrs);
|
||||
|
||||
if (qtyPerHrs && qtyPerHrs != NaN && qtyPerHrs != Infinity)
|
||||
tr.find('td:eq(11)').text(qtyPerHrs.toFixed(3));
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function convertTo24Hour(time) {
|
||||
const [timePart, modifier] = time.split(" ");
|
||||
let [hours, minutes] = timePart.split(":");
|
||||
|
||||
@ -725,65 +807,87 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
|
||||
|
||||
|
||||
});
|
||||
function calculateMachineRunningHrs() {
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
let dreierMachineOnTime = $('#additionalEntryDrierOnTimeId').val();
|
||||
let dreierMachineOffTime = $('#additionalEntryDrierOffTimeId').val();
|
||||
|
||||
|
||||
if (dreierMachineOnTime != '' && dreierMachineOffTime != '') {
|
||||
|
||||
function gasPerTon(value) {
|
||||
|
||||
let tr = $(value).closest('tr');
|
||||
var totalGasConsumption = tr.find('td:eq(6)').text();
|
||||
var sandDriedQty = tr.find('td:eq(10)').text();
|
||||
if( totalGasConsumption != '' && sandDriedQty != '')
|
||||
{
|
||||
const startDate = new Date(`1970-01-01T${convertTo24Hour(dreierMachineOnTime)}`);
|
||||
const endDate = new Date(`1970-01-01T${convertTo24Hour(dreierMachineOffTime)}`);
|
||||
|
||||
// Handle the case where end time is on the next day
|
||||
if (endDate < startDate) {
|
||||
endDate.setDate(endDate.getDate() + 1);
|
||||
}
|
||||
|
||||
// Calculate the difference in milliseconds
|
||||
const diffInMs = endDate - startDate;
|
||||
|
||||
// Convert milliseconds to hours and minutes
|
||||
const hours = Math.floor(diffInMs / (1000 * 60 * 60));
|
||||
const minutes = Math.floor((diffInMs % (1000 * 60 * 60)) / (1000 * 60));
|
||||
|
||||
const totalHours = hours + (minutes / 60);
|
||||
|
||||
console.log('working here', 'totalHours', totalHours);
|
||||
|
||||
if (totalHours != NaN && totalHours != Infinity) {
|
||||
$('#additionalEntryRunningHrsId').val(totalHours);
|
||||
additionalEntryGasPerTon();
|
||||
additionalEntryMoistureLossQty();
|
||||
additionalEntryQtyPerHrs();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function additionalEntryGasPerTon() {
|
||||
|
||||
var totalGasConsumption = $('#additionalEntryTotalGasConsumptionId').val();
|
||||
var sandDriedQty = $('#additionalEntrySandDriedQtyId').val();
|
||||
if (totalGasConsumption != '' && sandDriedQty != '') {
|
||||
var gasPerTon = parseFloat(totalGasConsumption) / parseFloat(sandDriedQty);
|
||||
|
||||
if (gasPerTon && gasPerTon != NaN && gasPerTon != Infinity)
|
||||
tr.find('td:eq(7)').text(gasPerTon.toFixed(2));
|
||||
$('#additionalEntryGasPerTonId').val(gasPerTon);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function moistureLossQty(value) {
|
||||
function additionalEntryMoistureLossQty(value) {
|
||||
|
||||
let tr = $(value).closest('tr');
|
||||
var inputSandQty = tr.find('td:eq(8)').text();
|
||||
var sandDriedQty = tr.find('td:eq(10)').text();
|
||||
var inputSandQty = $('#additionalEntryInputSandQtyId').val();
|
||||
var sandDriedQty = $('#additionalEntrySandDriedQtyId').val();
|
||||
|
||||
if(inputSandQty != '' && sandDriedQty != '')
|
||||
{
|
||||
if (inputSandQty != '' && sandDriedQty != '') {
|
||||
|
||||
var moistureLossQty = parseFloat(inputSandQty) - parseFloat(sandDriedQty);
|
||||
|
||||
if(moistureLossQty && moistureLossQty != NaN && moistureLossQty != Infinity)
|
||||
tr.find('td:eq(9)').text(moistureLossQty.toFixed(2));
|
||||
if (moistureLossQty != NaN && moistureLossQty != Infinity)
|
||||
$('#additionalEntryMoistureLossQtyId').val(moistureLossQty);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function qtyPerHrs(value) {
|
||||
function additionalEntryQtyPerHrs(value) {
|
||||
|
||||
let tr = $(value).closest('tr');
|
||||
var drierRunninhHrs = tr.find('td:eq(3)').text();
|
||||
var sandDriedQty = tr.find('td:eq(10)').text();
|
||||
var drierRunninhHrs = $('#additionalEntryRunningHrsId').val();
|
||||
var sandDriedQty = $('#additionalEntrySandDriedQtyId').val();
|
||||
|
||||
if(drierRunninhHrs != '' && sandDriedQty != '')
|
||||
{
|
||||
console.log(drierRunninhHrs);
|
||||
console.log(sandDriedQty);
|
||||
if (drierRunninhHrs != '' && sandDriedQty != '') {
|
||||
|
||||
var qtyPerHrs = parseFloat(sandDriedQty) / parseFloat(drierRunninhHrs);
|
||||
|
||||
console.log(qtyPerHrs);
|
||||
|
||||
if (qtyPerHrs && qtyPerHrs != NaN && qtyPerHrs != Infinity)
|
||||
tr.find('td:eq(11)').text(qtyPerHrs.toFixed(3));
|
||||
$('#additionalEntryQtyPerHoursId').val((qtyPerHrs.toFixed(2)));
|
||||
|
||||
|
||||
|
||||
@ -791,5 +895,4 @@ function qtyPerHrs(value) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -171,13 +171,13 @@
|
||||
<th>Invoice No</th>
|
||||
<th>Client Name</th>
|
||||
<th>Product</th>
|
||||
<th>Rate</th>
|
||||
<th>Quantity</th>
|
||||
<th>Rate</th>
|
||||
<th>Sub Total</th>
|
||||
<th>GST</th>
|
||||
<th>Total</th>
|
||||
<th>Status</th>
|
||||
<th>E-Invoice Number</th>
|
||||
<!-- <th>E-Invoice Number</th> -->
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -205,13 +205,13 @@
|
||||
</td>
|
||||
<td><?php echo $invoice->client_name ?></td>
|
||||
<td><?php echo $invoice->item_name ?></td>
|
||||
<td align="right"><?php echo number_format($invoice->item_price, 2, '.', ',') ?></td>
|
||||
<td align="right"><?php echo number_format($invoice->item_quantity, 2, '.', ',') ?></td>
|
||||
<td align="right"><?php echo number_format($invoice->item_price, 2, '.', ',') ?></td>
|
||||
<td align="right"><?php echo number_format($subtotal, 2, '.', ',') ?></td>
|
||||
<td align="right"><?php echo number_format($cgst_amount + $sgst_amount, 2, '.', ',') ?></td>
|
||||
<td align="right"><?php echo number_format($total, 2, '.', ',') ?></td>
|
||||
<td><?php echo $invoice->status ?></td>
|
||||
<td><?php echo $invoice->e_invoice_number; ?></td>
|
||||
<!-- <td><?php echo $invoice->e_invoice_number; ?></td> -->
|
||||
<td>
|
||||
<a class="edit-button" style="cursor: pointer; display: inline-block;" title="Files Upload" onclick="openInvoiceModal('<?php echo $invoice->invoice_number; ?>', '<?php echo $invoice->client_name; ?>', '<?php echo $invoice->invoice_date_created; ?>', '<?php echo $invoice->invoice_id; ?>')">
|
||||
<i class="fas fa-file-upload text-muted" style="font-size: 18px; vertical-align: middle;"></i>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user