MaterialCode; $MaterialName = $MD->MaterialName; $MaterialType = $MD->MaterialType; $MaterialCategory = $MD->Category; $UOM = $MD->UOM; $remarks = $MD->Remarks; $HSNcode = $MD->HSNCODE; $openstock = $MD->stock; $date = $MD->stockdate; $reorder = $MD->reorder; $chk = $MD->IsActive; $IsActive = ($chk == 1) ? 'checked' : ''; } } $Average_Price = $avg_price[0]['avg_rate']; $Average_Value = number_format($Average_Price, 2, '.', ''); if (!empty($currentstock)) { $currentstock = $currentstock[0]['remainingqty']; $x = $openstock; $y = $currentstock; $todaydateyear = format_date($date_today, 0, "Y"); $todaydatemonth = format_date($date_today, 0, 'm'); $todaydatedate = format_date($date_today, 0, 'd'); $openstockdateyear = format_date($date, 0, 'Y'); $parts = explode('-', $date); $openstockdatemonth = $parts[1] ?? 0; $openstockdatedate = $parts[2] ?? ''; if ($openstockdateyear == $todaydateyear) { if ($openstockdatemonth <= 03) { $total = $y == '' ? '0' : $y; } else { $total = (int)$x + (int)$y; } } else if ($openstockdateyear < $todaydateyear) { //$total= $y; $total = $y == '' ? '0' : $y; } else if ($openstockdateyear > $todaydateyear) { $total = $x + $y; } } ?> alert("Current Stock Low ");'; } ?>