$value) { if ($key == 0) { $str .= '"'.$value.'"'; }else{ $str .= ', "'.$value.'"'; } } self::$BarLabels = $str; } public static function BarColor($condition, $data){ if ($condition == "all") { $color = ""; $bar = self::$BarLabels; $explodebar = explode(",", $bar); for ($i=0; $i < count($explodebar) ; $i++) { if ($i == 0) { $color .= '"'.$data.'"'; }else{ $color .= ',"'.$data.'"'; } } self::$BarColor = $color; }else{ $color = ""; foreach ($variable as $key => $value) { if ($key == 0) { $color = '"'.$value.'"'; }else{ $color .= ',"'.$value.'"'; } } self::$BarColor = $color; } } public static function BarValue($value){ $nilai = ""; foreach ($value as $key => $n) { if ($key == 0) { $nilai .= '"'.$n.'"'; }else{ $nilai .= ',"'.$n.'"'; } } self::$BarValue = $nilai; } private static function BarScript(){ return " "; } private static function CreateCanvasBar() { return ""; } public static function CreateBar(){ $aa = self::CreateCanvasBar(); $bb = self::BarScript(); return $aa.$bb; } public static function sum($arr){ return array_sum($arr); } public static function average($arr){ $sum = array_sum($arr); $average = $sum / count($arr); return $average; } private static $form_set_style; public static function formStyle($aa = "") { self::$form_set_style = $aa; } public static function formStart() { return ' '; } public static function formInputText($name ,$nameClass, $placeholder="", $value=""){ return '
'; } public static function formInputNumber($name ,$nameClass, $placeholder="", $value=""){ return '
'; } public static function formInputCurrency($currency ,$name, $nameClass, $placeholder="", $value=""){ return '
'; } public static function formInputHidden($nameClass, $value = '') { return ' '; } public static function formInputDate($name, $nameClass, $placeholder="", $value=""){ return '
'; } public static function backDate($aa) { $date = explode("-", $aa); $date = $date[1].'/'.$date[2].'/'.$date[0]; return $date; } // hellper khusus di teplate ini public static function SelectOptionFromDB($table, $value, $show, $golongan, $selected = "") { $table = DB::table($table) ->where('perusahaan', '=', Session::get('accounting-user')['nama_perusahaan']) ->where('golongan_akun', '=', $golongan) ->get(); $option = ""; foreach($table as $key => $nilai){ if($selected != "" && $nilai->$value == $selected){ $option .= ""; }else{ $option .= ""; } } return $option; } public static function rp_to_number($value='') { $data = $value; $data = str_replace("Rp ", "", $data); $data = str_replace(".", "", $data); return $data; } public static function number_to_rp($value='') { $data = number_format($value, 2, ",", "."); $data = str_replace(",00", "", $data); return $data; } }