Created
February 4, 2018 16:07
-
-
Save GaneshKandu/0955f522d1389359007d54aa1440d496 to your computer and use it in GitHub Desktop.
GST Calculator Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include 'gst.php'; | |
//adding gst | |
$return = gst::add(500,5); | |
print_r($return); | |
//removing gst | |
$return = gst::remove(500,5); | |
print_r($return); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
GST is an Indirect Tax which has replaced many Indirect Taxes in India. The Goods and Service Tax Act was passed in the Parliament on 29th March 2017. The Act came into effect on 1st July 2017. | |
*/ | |
class gst{ | |
/** | |
* | |
* Cal. add gst | |
* | |
* @param int $cost | |
* @param int $per | |
* @return array | |
* | |
*/ | |
public static function add($cost,$per){ | |
$output = array(); | |
$output['GST_PRICE'] = (($cost*$per)/100); | |
$output['NET_PRICE'] = $cost + $output['GST_PRICE']; | |
return $output; | |
} | |
/** | |
* | |
* Cal. remove gst | |
* | |
* @param int $cost | |
* @param int $per | |
* @return array | |
* | |
*/ | |
public static function remove($cost,$per){ | |
$output = array(); | |
$output['GST_PRICE'] = $cost - ($cost * ( 100 / ( 100 + $per ))); | |
$output['NET_PRICE'] = $cost - $output['GST_PRICE']; | |
return $output; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment