MaterialCode; $MaterialName = $MD->MaterialName; $MaterialType = $MD->MaterialType; $MaterialCategory = $MD->Category; $UOM = $MD->UOM; $Assetcode = $MD->assetcode; $costcenter = $MD->CostCenterCode; $remarks = $MD->Remarks; $conversionfactor = $MD->ConversionFactorUnit; $conversionfactorUOM = $MD->ConversionFactorUOM; $RMCode = $MD->RMCode; $HSNcode = $MD->HSNCODE; $openstock=$MD->stock; //$openstockdate=new DateTime($MD->stockdate); //$date = $openstockdate->format('d-m-Y'); $date=$MD->stockdate; $reorder=$MD->reorder; $chk = $MD->IsActive; if($chk == 1) { $IsActive = 'checked'; } else { $IsActive = ''; } } } $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 = date('Y', strtotime($date_today)); $todaydatemonth = date('m', strtotime($date_today)); $todaydatedate = date('d', strtotime($date_today)); $openstockdateyear = date('Y', strtotime($date)); $parts = explode('-',$date); $openstockdatemonth = $parts[1]; $openstockdatedate = $parts[2]; if($openstockdateyear==$todaydateyear) { if($openstockdatemonth<=03) { $total= $y==''?'0':$y; } else { $total= $x + $y; } } else if($openstockdateyear<$todaydateyear) { //$total= $y; $total= $y==''?'0':$y; } else if($openstockdateyear>$todaydateyear) { $total= $x + $y; } } if( $total <= $reorder){ echo ''; } ?>