Пример #1
0
 public function select_coa($data, $parent = 0)
 {
     static $i = 1;
     $tab = str_repeat('   ', $i);
     if (isset($data[$parent])) {
         $out = '';
         $i++;
         foreach ($data[$parent] as $item) {
             $out .= '<optgroup label="' . $tab . $item->no_coa . ' ' . $item->nm_coa . '">';
             $coas = ref_coa_ledger::where('grup_coa', $item->id_coa)->get();
             if (count($coas) > 0) {
                 foreach ($coas as $coa) {
                     $out .= '<option value="' . $coa->id_coa_ledger . '">' . $tab . $coa->no_coa_ledger . ' ' . $coa->nm_coa_ledger . '</option>';
                 }
             }
             $out .= '</optgroup>';
             $anak = $this->select_coa($data, $item->id_coa);
             if ($anak) {
                 $out .= $anak;
                 $i--;
             }
         }
         return $out;
     } else {
         return false;
     }
 }