public function listBox($id)
 {
     $unique = PayrollHeading::distinctDeductions();
     if ($id != '') {
         $unique = array(0);
     }
     $deductions = self::orderBy('desc')->whereNotIn('id', $unique)->get();
     $rows = array('0' => '');
     foreach ($deductions as $deduction) {
         $rows[$deduction->id] = $deduction->desc;
     }
     return $rows;
 }
 public function listBox($id)
 {
     $unique = PayrollHeading::distinctCompensations();
     if ($id != '') {
         $unique = array(0);
     }
     $compensations = self::activeCompensation()->whereNotIn('id', $unique)->orderBy('code')->get();
     $rows = array('0' => '');
     foreach ($compensations as $compensation) {
         $rows[$compensation->id] = $compensation->code;
     }
     return $rows;
 }
Beispiel #3
0
 function headings_save($id = '')
 {
     $data['page_name'] = '<b>Save Heading</b>';
     $data['msg'] = '';
     $data['row'] = PayrollHeading::blankRecord();
     if (Input::get('op')) {
         $info = array('type' => Input::get('type'), 'line' => Input::get('line'), 'additional_compensation_id' => Input::get('additional_compensation_id'), 'deduction_id' => Input::get('deduction_id'), 'caption' => Input::get('caption'));
         $data['row'] = $row = PayrollHeading::find($id);
         if ($row === NULL) {
             PayrollHeading::insert($info);
         } else {
             PayrollHeading::where('id', '=', $id)->update($info);
         }
         return Redirect::to('payroll/report/headings');
     }
     $data['compensations'] = AdditionalCompensation::listBox($id);
     $data['deductions'] = DeductionInformation::listBox($id);
     $data['main_content'] = 'report/headings_save';
     return View::make('includes/template', $data);
 }