0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
lib
/
[
Home
]
File: config.php
<?php define('BASE_DIR',dirname(__FILE__).'/..'); define('DATE_FORMAT',"d-m-Y"); define('DF_PICKER',"d-m-Y"); date_default_timezone_set("Asia/Kolkata"); include_once(BASE_DIR."/common_model.php"); include_once BASE_DIR."/model/defaults_mdl.php"; define("SHOW_UC_IN_ACCS", "36,37,40"); define("SHOW_DEBIT_WISE_PROJECT", "38,39,40"); define("ADD_CUSTOM_USER", FALSE); //$server_ip ="http://192.168.0.9/cpms"; $server_ip =getBaseUrl(); // $server_ip ="http://".$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].dirname($_SERVER["REQUEST_URI"].'?').'/'; // echo $server_ip; $ACCOUNTS_ID = 36; @session_start(); $username_global=@$_SESSION['username']; //define('BASE_DIR',dirname(__FILE__)); $arr_file_type = array( "image/bmp" => "bmp","application/msword" => "doc","application/pdf" => "pdf", "image/gif" => "gif","image/jpeg" => "jpeg", "image/png" => "png", "image/pjpeg" => "jpeg","application/vnd.ms-powerpoint"=>"pps","application/mspowerpoint"=>"ppt"); //-----division--------- //$division_array[1]="Administration"; $division_array[2]="BioTechnology; $division_array[3]=Construction; $division_array[4]="EDs Office"; $division_array[5]="Surface Water Division"; $division_array[6]=TEED; $division_array[7]=WMA; $division_array[8]=GWD; $division_array[9]=IHD; $division_array[10]=Library; $division_array[11]=ESD; $division_array[12]=WRM;$division_array[13]=MOS;$division_array[14]=RSC;$division_array[15]=CWAL; //---------------Account Head----------------- $acc_head[1]="Income"; $acc_head[2]="Expenses"; $acc_head[3]="Discount Paid"; $acc_head[4]="Discount Received";$acc_head[5]="Project Fund"; $acc_head[6]="Salary"; $acc_head_count=6; //----Month--------- $month[1]="January"; $month[2]="February"; $month[3]="March"; $month[4]="April"; $month[5]="May"; $month[6]="June"; $month[7]="July"; $month[8]="August"; $month[9]="September"; $month[10]="October"; $month[11]="November"; $month[12]="December"; //----user status $status_array_count=1; $status_array[0]="Disable";$status_array[1]="Enable"; //----Fund Type - Spelling change allowed, but order change not allowed //$fund_array_count=2; //$fund_array[0]="Plan";$fund_array[1]="External";$fund_array[2]="Consultancy"; $fund_array_count = 3; $fund_array[0] = "Plan"; $fund_array[1] = "External"; $fund_array[2] = "Consultancy"; //--fund generated percentage $planned_per=10;$external_per=20;$consultancy_per=20; // financial year var $fin_year_from = "-04-01"; $fin_year_to = "-03-31"; function getBaseUrl() { // output: /myproject/index.php $currentPath = $_SERVER['PHP_SELF']; // output: Array ( [dirname] => /myproject [basename] => index.php [extension] => php [filename] => index ) $pathInfo = pathinfo($currentPath); // output: localhost $hostName = $_SERVER['HTTP_HOST']; // output: http:// $protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https://'?'https://':'http://'; // return: http://localhost/myproject/ return $protocol.$hostName.dirname($pathInfo['dirname'])."/"; } function getFisc(){ $day = date("d"); $month = date("m"); $year = date("Y"); $date = mktime(12, 0, 0, $month, $day, $year); $targetMonth = 3; $difference = $month - $targetMonth; if($difference <= 0) { $difference += 12; } $sameDateInMarch = strtotime("- " . $difference . " months", $date); $arr = new stdClass(); $start = date("Y-m-t", $sameDateInMarch); // print($start); $arr->today = date("Y-m-d"); $arr->start = date("Y-m-d",strtotime($start . "+1 days")); return $arr; } function isShowUcInAccounts(){ $arr = explode(",", SHOW_UC_IN_ACCS); return in_array($_SESSION['user_id'], $arr); } function isShowDebitWiseReportInAccounts(){ $arr = explode(",", SHOW_DEBIT_WISE_PROJECT); return in_array($_SESSION['user_id'], $arr); } function ordinal($number){ $ends = array('th','st','nd','rd','th','th','th','th','th','th'); if (($number %100) >= 11 && ($number%100) <= 13) $abbreviation = $number. 'th'; else $abbreviation = $number. $ends[$number % 10]; return $abbreviation; } function moneyFormatIndia($num){ $num = $num<0 ? $num *-1 : $num; $explrestunits = "" ; $num= number_format((float)$num, 2, '.', ''); $ex = explode(".",$num); $num = $ex[0]; if(strlen($num)>3){ $lastthree = substr($num, strlen($num)-3, strlen($num)); $restunits = substr($num, 0, strlen($num)-3); // extracts the last three digits $restunits = (strlen($restunits)%2 == 1)?"0".$restunits:$restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping. $expunit = str_split($restunits, 2); for($i=0; $i<sizeof($expunit); $i++){ // creates each of the 2's group and adds a comma to the end if($i==0) { $explrestunits .= (int)$expunit[$i].","; // if is first value , convert into integer }else{ $explrestunits .= $expunit[$i].","; } } $thecash = $explrestunits.$lastthree; } else { $thecash = $num; } return $thecash.".".$ex[1]; // writes the final format where $currency is the currency symbol. } // function getUcName($fund_type){ $arr = array( 1=>"ACC3", 2=>"ACC5", 3=>"ACC5", 4=>"ACC4", 5=>"ACC3", ); return $arr[$fund_type]; } function convert_number_to_words($number) { $hyphen = ' '; $conjunction = ' and '; $separator = ', '; $negative = 'negative '; $decimal = ' point '; $dictionary = array( 0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten', 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen', 16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen', 19 => 'nineteen', 20 => 'twenty', 30 => 'thirty', 40 => 'fourty', 50 => 'fifty', 60 => 'sixty', 70 => 'seventy', 80 => 'eighty', 90 => 'ninety', 100 => 'hundred', 1000 => 'thousand', 1000000 => 'lakh', 1000000000 => 'crore', 1000000000000 => 'trillion', 1000000000000000 => 'quadrillion', 1000000000000000000 => 'quintillion' ); if (!is_numeric($number)) { return false; } if (($number >= 0 && (int) $number < 0) || (int) $number < 0 - PHP_INT_MAX) { // overflow trigger_error( 'convert_number_to_words only accepts numbers between -' . PHP_INT_MAX . ' and ' . PHP_INT_MAX, E_USER_WARNING ); return false; } if ($number < 0) { return $negative . convert_number_to_words(abs($number)); } $string = $fraction = null; $dec = substr(strrchr($number, "."), 1); if($dec >0){ $number = number_format($number, 2, '.', ''); if (strpos($number, '.') !== false) { list($number, $fraction) = explode('.', $number); } } switch (true) { case $number < 21: $string = $dictionary[$number]; break; case $number < 100: $tens = ((int) ($number / 10)) * 10; $units = $number % 10; $string = $dictionary[$tens]; if ($units) { $string .= $hyphen . $dictionary[$units]; } break; case $number < 1000: $hundreds = $number / 100; $remainder = $number % 100; $string = $dictionary[$hundreds] . ' ' . $dictionary[100]; if ($remainder) { $string .= $conjunction . convert_number_to_words($remainder); } break; default: $baseUnit = pow(1000, floor(log($number, 1000))); $numBaseUnits = (int) ($number / $baseUnit); $remainder = $number % $baseUnit; $string = convert_number_to_words($numBaseUnits) . ' ' . $dictionary[$baseUnit]; if ($remainder) { $string .= $remainder < 100 ? $conjunction : $separator; $string .= convert_number_to_words($remainder); } break; } if (null !== $fraction && is_numeric($fraction)) { // echo "$fraction + "; $string .= $decimal; $words = array(); foreach (str_split((string) $fraction) as $number) { $words[] = $dictionary[$number]; } $string .= implode(' ', $words); } return $string; } function moneyFormatNoDecimals($num){ $explrestunits = "" ; $number = number_format($num, 2, '.', ''); $split = explode(".", $number); $num = $split[0]; $dec = $split[1]; if(strlen($num)>3){ $lastthree = substr($num, strlen($num)-3, strlen($num)); $restunits = substr($num, 0, strlen($num)-3); // extracts the last three digits $restunits = (strlen($restunits)%2 == 1)?"0".$restunits:$restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping. $expunit = str_split($restunits, 2); for($i=0; $i<sizeof($expunit); $i++){ // creates each of the 2's group and adds a comma to the end if($i==0) { $explrestunits .= (int)$expunit[$i].","; // if is first value , convert into integer }else{ $explrestunits .= $expunit[$i].","; } } $thecash = $explrestunits.$lastthree; } else { $thecash = $num; } return $thecash.".$dec"; // writes the final format where $currency is the currency symbol. } ?>