Skip to content

Commit

Permalink
added withholding option in report
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Aug 7, 2020
1 parent 30639e2 commit a67c03e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
23 changes: 22 additions & 1 deletion app/Reports/TaxSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public function setViews()

public function setTables()
{
$taxes = Tax::enabled()->notWithholding()->notRate(0)->orderBy('name')->pluck('name')->toArray();
$withholding = ($this->getSetting('withholding') == 'yes') ? 'withholding' : 'notWithholding';

$taxes = Tax::enabled()->$withholding()->notRate(0)->orderBy('name')->pluck('name')->toArray();

$this->tables = array_combine($taxes, $taxes);
}
Expand Down Expand Up @@ -122,6 +124,25 @@ public function getFields()
return [
$this->getPeriodField(),
$this->getBasisField(),
$this->getWithholdingField(),
];
}

public function getWithholdingField()
{
return [
'type' => 'selectGroup',
'name' => 'withholding',
'title' => trans('taxes.withholding'),
'icon' => 'hand-holding-usd',
'values' => [
'yes' => trans('general.yes'),
'no' => trans('general.no'),
],
'selected' => 'no',
'attributes' => [
'required' => 'required',
],
];
}
}
6 changes: 3 additions & 3 deletions resources/views/common/reports/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@
'data-field' => 'settings',
],
$field['attributes']),
isset($class->model->settings->{$field['name']}) ? $class->model->settings->{$field['name']}: null
isset($report->settings->{$field['name']}) ? $report->settings->{$field['name']}: null
) }}
@elseif ($type == 'selectGroup')
{{ Form::$type($field['name'], $field['title'], $field['icon'], $field['values'], $report->settings->{$field['name']}, array_merge([
{{ Form::$type($field['name'], $field['title'], $field['icon'], $field['values'], isset($report->settings->{$field['name']}) ? $report->settings->{$field['name']} : $field['selected'], array_merge([
'data-field' => 'settings'
],
$field['attributes'])
) }}
@elseif ($type == 'radioGroup')
{{ Form::$type($field['name'], $field['title'], isset($report->settings->{$field['name']}) ? $report->settings->{$field['name']} : 1, $field['enable'], $field['disable'], array_merge([
{{ Form::$type($field['name'], $field['title'], isset($report->settings->{$field['name']}) ? $report->settings->{$field['name']} : true, $field['enable'], $field['disable'], array_merge([
'data-field' => 'settings'
],
$field['attributes'])
Expand Down

0 comments on commit a67c03e

Please sign in to comment.