stock module latest today vadivel J 11-02-2025

This commit is contained in:
vadivelJ96 2025-02-11 12:14:29 +05:30
parent 2eb5ddcc3f
commit 456eb596ee
2 changed files with 40 additions and 5 deletions

View File

@ -1973,7 +1973,37 @@ class StockController extends BaseController
{
$currentMonth = $this->request->getPost('month') ? $this->request->getPost('month') : date('M-Y');
//drier will be processing different method than other stock in case of session stock month and date format for generating
//dummy data and updating the data . be cautious while updating the code..!!
if ($this->request->getMethod() === 'POST') {
$currentMonth = $this->request->getPost('month');
$date = DateTime::createFromFormat('M-Y', $currentMonth); //in M-Y format
$formattedDate = $date->format('Y-m'); //in Y-m format
$session = session ();
$session->set('stock_month',$formattedDate);
} else {
$session = session();
$currentMonth = $session->get('stock_month');
if (empty($currentMonth)) {
$currentMonth = date('M-Y'); // Default to the current month
}else{
$currentMonth = DateTime::createFromFormat('Y-m', $currentMonth); // in Y-m format
$currentMonth = $currentMonth->format('M-Y'); // in M-Y format
}
}
$monthData = $this->getMonthDatesFromInput($currentMonth);
@ -2139,9 +2169,9 @@ class StockController extends BaseController
$month = $this->request->getPost('month');
$date = DateTime::createFromFormat('M-Y', $month);
$date = DateTime::createFromFormat('M-Y', $month); //in M-Y format
$formattedDate = $date->format('Y-m');
$formattedDate = $date->format('Y-m'); //in Y-m format
$month = $formattedDate;

View File

@ -947,7 +947,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="cancelBtn">Cancel</button>
<button type="submit" class="btn btn-primary">Save </button>
</div>
</form>
@ -1704,8 +1704,13 @@
data: { id: batchId },
success: function (response) {
if(response.status == "200"){
alert("Batch file deleted successfully!");
alert("Batch File Deleted Successfully!");
$(this).closest('.batch-container').remove(); // Remove from UI
location.reload(); // Reload the page
} else{
alert("Removed Empty batch file");
// alert("Error deleting batch file: " + response.message);
}
},
error: function (xhr, status, error) {