From 946a433390edbced5a625360e83a8dbcdde93b65 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Tue, 10 Jul 2018 12:01:25 +0530 Subject: [PATCH] current value depending on financial year --- application/views/editOldRawmaterial.php | 46 +++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/application/views/editOldRawmaterial.php b/application/views/editOldRawmaterial.php index 5b3462a6..fd1f3c31 100755 --- a/application/views/editOldRawmaterial.php +++ b/application/views/editOldRawmaterial.php @@ -16,6 +16,11 @@ $IsActive = ''; $openstock=''; $date=''; $reorder=''; +$total = 0; + +$date_today = date("Y-m-d"); + +//print_r($materialDetails); if(!empty($materialDetails)) { @@ -51,6 +56,8 @@ if(!empty($materialDetails)) } } + + if(!empty($currentstock)) { @@ -58,7 +65,44 @@ if(!empty($currentstock)) $x = $openstock; $y = $currentstock; - $total= $x + $y; + // $total= $x + $y; + + $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; + } + + }