From 1337664841fd0666f616755b7a2f71498b9b70db Mon Sep 17 00:00:00 2001 From: batuhanbas Date: Sat, 18 Jan 2020 18:45:40 +0300 Subject: [PATCH 1/2] report print updated --- public/css/print.css | 20 +++++++++++++------ .../views/partials/reports/table.blade.php | 2 +- .../partials/reports/table/footer.blade.php | 2 +- .../partials/reports/table/rows.blade.php | 8 ++++---- .../profit_loss/content/footer.blade.php | 10 +++++----- .../profit_loss/content/header.blade.php | 10 +++++----- .../profit_loss/table/footer.blade.php | 8 ++++---- .../tax_summary/content/header.blade.php | 2 +- .../tax_summary/table/footer.blade.php | 8 ++++---- 9 files changed, 39 insertions(+), 31 deletions(-) diff --git a/public/css/print.css b/public/css/print.css index e55916445..e707250c1 100644 --- a/public/css/print.css +++ b/public/css/print.css @@ -348,13 +348,25 @@ th, td { */ .rp-border-top-1 { - border-top: 1px solid #3c3f72; + border-top: 1px solid #e5e5e5; } .rp-border-bottom-1 { - border-bottom: 1px solid #3c3f72; + border-bottom: 1px solid #e5e5e5; } +.rp-border-top-1 { + border-top: 1px solid #e5e5e5; +} + +.rp-border-0 { + border: 0 !important; +} + +.rp-border-collapse +{ + border-collapse: collapse; +} .rp-float-left { float: left; @@ -371,7 +383,3 @@ th, td { ========================================================= */ - - - - diff --git a/resources/views/partials/reports/table.blade.php b/resources/views/partials/reports/table.blade.php index cf43132f9..5726f91c8 100644 --- a/resources/views/partials/reports/table.blade.php +++ b/resources/views/partials/reports/table.blade.php @@ -1,5 +1,5 @@
- +
@include($class->views['table.header']) @if (!empty($class->rows[$table])) diff --git a/resources/views/partials/reports/table/footer.blade.php b/resources/views/partials/reports/table/footer.blade.php index 9d804562d..495050780 100644 --- a/resources/views/partials/reports/table/footer.blade.php +++ b/resources/views/partials/reports/table/footer.blade.php @@ -1,5 +1,5 @@ - + @php $total_total = 0; @endphp @foreach($class->totals[$table] as $total) diff --git a/resources/views/partials/reports/table/rows.blade.php b/resources/views/partials/reports/table/rows.blade.php index 5b5396715..eaffc1ea0 100644 --- a/resources/views/partials/reports/table/rows.blade.php +++ b/resources/views/partials/reports/table/rows.blade.php @@ -1,9 +1,9 @@ @php $row_total = 0; @endphp - - + + @foreach($items as $item) @php $row_total += $item; @endphp - + @endforeach - + diff --git a/resources/views/reports/profit_loss/content/footer.blade.php b/resources/views/reports/profit_loss/content/footer.blade.php index 32c03b2a8..02e139b7c 100644 --- a/resources/views/reports/profit_loss/content/footer.blade.php +++ b/resources/views/reports/profit_loss/content/footer.blade.php @@ -1,12 +1,12 @@
-
{{ trans_choice('general.totals', 1) }}
{{ $class->getTableRowList()[$id] }}
{{ $class->getTableRowList()[$id] }}@money($item, setting('default.currency'), true)@money($item, setting('default.currency'), true)@money($row_total, setting('default.currency'), true)@money($row_total, setting('default.currency'), true)
+
- - + + @foreach($class->net_profit as $profit) - + @endforeach - diff --git a/resources/views/reports/profit_loss/content/header.blade.php b/resources/views/reports/profit_loss/content/header.blade.php index 8773e9d89..2f8335c02 100644 --- a/resources/views/reports/profit_loss/content/header.blade.php +++ b/resources/views/reports/profit_loss/content/header.blade.php @@ -1,12 +1,12 @@
-
{{ trans('reports.net_profit') }}
{{ trans('reports.net_profit') }}@money($profit, setting('default.currency'), true)@money($profit, setting('default.currency'), true) + @money(array_sum($class->net_profit), setting('default.currency'), true)
+
- - + + @foreach($class->dates as $date) - + @endforeach - diff --git a/resources/views/reports/profit_loss/table/footer.blade.php b/resources/views/reports/profit_loss/table/footer.blade.php index 11400788f..e92f826ad 100644 --- a/resources/views/reports/profit_loss/table/footer.blade.php +++ b/resources/views/reports/profit_loss/table/footer.blade.php @@ -1,11 +1,11 @@ - - + + @php $total_total = 0; @endphp @foreach($class->totals[$table] as $date => $total) @php $total_total += $total; @endphp - + @endforeach - + diff --git a/resources/views/reports/tax_summary/content/header.blade.php b/resources/views/reports/tax_summary/content/header.blade.php index f53aef113..018a553f6 100644 --- a/resources/views/reports/tax_summary/content/header.blade.php +++ b/resources/views/reports/tax_summary/content/header.blade.php @@ -1,5 +1,5 @@
-
{{ $date }}{{ $date }} + {{ trans_choice('general.totals', 1) }}
{{ trans_choice('general.totals', 1) }}
{{ trans_choice('general.totals', 1) }}@money($total, setting('default.currency'), true)@money($total, setting('default.currency'), true)@money($total_total, setting('default.currency'), true)@money($total_total, setting('default.currency'), true)
+
diff --git a/resources/views/reports/tax_summary/table/footer.blade.php b/resources/views/reports/tax_summary/table/footer.blade.php index 742048303..7dbb0dc2b 100644 --- a/resources/views/reports/tax_summary/table/footer.blade.php +++ b/resources/views/reports/tax_summary/table/footer.blade.php @@ -1,11 +1,11 @@ - - + + @php $total_total = 0; @endphp @foreach($class->totals[$table] as $total) @php $total_total += $total; @endphp - + @endforeach - + From 7efc4cf7b9af1c582f44ef2b7e74b1d4f0cbf401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Sat, 18 Jan 2020 19:24:29 +0300 Subject: [PATCH 2/2] Reports create page get dynamic field and save. --- app/Http/Requests/Common/Report.php | 4 - .../assets/js/components/AkauntingSelect.vue | 4 + resources/assets/js/plugins/form.js | 14 ++++ resources/assets/js/views/common/reports.js | 40 ++++++++-- .../views/common/reports/create.blade.php | 4 +- .../partials/form/checkbox_group.blade.php | 2 +- .../views/partials/form/date_group.blade.php | 42 +++++------ .../views/partials/form/email_group.blade.php | 2 +- .../partials/form/invoice_text.blade.php | 2 +- .../views/partials/form/money_group.blade.php | 2 +- .../form/multi_select_add_new_group.blade.php | 2 +- .../form/multi_select_group.blade.php | 2 +- .../partials/form/number_group.blade.php | 2 +- .../partials/form/password_group.blade.php | 2 +- .../views/partials/form/radio_group.blade.php | 4 +- .../form/select_add_new_group.blade.php | 2 +- .../partials/form/select_group.blade.php | 50 +++++++------ .../form/select_group_add_new_group.blade.php | 74 ++++++++++--------- .../form/select_group_group.blade.php | 38 +++++----- .../views/partials/form/text_group.blade.php | 2 +- .../partials/form/textarea_group.blade.php | 2 +- .../views/partials/reports/fields.blade.php | 24 +++++- 22 files changed, 192 insertions(+), 128 deletions(-) diff --git a/app/Http/Requests/Common/Report.php b/app/Http/Requests/Common/Report.php index 0609c666c..d8f131fda 100644 --- a/app/Http/Requests/Common/Report.php +++ b/app/Http/Requests/Common/Report.php @@ -18,10 +18,6 @@ class Report extends FormRequest 'name' => 'required|string', 'description' => 'required|string', 'class' => 'required|string', - 'group' => 'required|string', - 'period' => 'required|string', - 'basis' => 'required|string', - 'chart' => 'required|string', ]; } } diff --git a/resources/assets/js/components/AkauntingSelect.vue b/resources/assets/js/components/AkauntingSelect.vue index 00a035229..9417a06c0 100644 --- a/resources/assets/js/components/AkauntingSelect.vue +++ b/resources/assets/js/components/AkauntingSelect.vue @@ -281,6 +281,10 @@ + + diff --git a/resources/assets/js/plugins/form.js b/resources/assets/js/plugins/form.js index 2fc637f90..0e04d91d9 100644 --- a/resources/assets/js/plugins/form.js +++ b/resources/assets/js/plugins/form.js @@ -42,6 +42,20 @@ export default class Form { continue; } + if (form_element.getAttribute('data-field')) { + if (!this[form_element.getAttribute('data-field')]) { + var field = {}; + + this[form_element.getAttribute('data-field')] = field; + } + + if (!this[form_element.getAttribute('data-field')][name]) { + this[form_element.getAttribute('data-field')][name] = ''; + } + + continue; + } + if (type == 'radio') { if (!this[name]) { this[name] = (form_element.getAttribute('value') ? 1 : 0) || 0; diff --git a/resources/assets/js/views/common/reports.js b/resources/assets/js/views/common/reports.js index 5f1b68e36..bcd084f29 100644 --- a/resources/assets/js/views/common/reports.js +++ b/resources/assets/js/views/common/reports.js @@ -28,28 +28,54 @@ const app = new Vue({ data: function () { return { form: new Form('report'), - bulk_action: new BulkAction('reports') + bulk_action: new BulkAction('reports'), + report_fields: '', } }, methods: { onChangeClass(class_name) { - axios.get(url + '/common/reports/groups', { + axios.get(url + '/common/reports/fields', { params: { class: class_name } }) .then(response => { - let options = response.data.data; + let form = this.form; + let html = response.data.html; - this.$children.forEach(select => { - if (select.name == 'group') { - select.selectOptions = options; - } + this.report_fields = Vue.component('add-new-component', (resolve, reject) => { + resolve({ + template : '
' + html + '
', + + mixins: [ + Global + ], + + created: function() { + this.form = form; + }, + + data: function () { + return { + form: {}, + } + }, + + watch: { + form: function (form) { + this.$emit("change", form); + } + }, + }) }); }) .catch(error => { }); + }, + + onChangeReportFields(event) { + this.form = event; } } }); diff --git a/resources/views/common/reports/create.blade.php b/resources/views/common/reports/create.blade.php index 8187819f7..05a8055da 100644 --- a/resources/views/common/reports/create.blade.php +++ b/resources/views/common/reports/create.blade.php @@ -22,7 +22,9 @@ {{ Form::textareaGroup('description', trans('general.description'), null, null, ['rows' => '3', 'required' => 'required']) }} - + {{ Form::hidden('report', 'invalid', ['data-field' => 'settings']) }} + + diff --git a/resources/views/partials/form/checkbox_group.blade.php b/resources/views/partials/form/checkbox_group.blade.php index b746f6226..f1af46eeb 100644 --- a/resources/views/partials/form/checkbox_group.blade.php +++ b/resources/views/partials/form/checkbox_group.blade.php @@ -12,7 +12,7 @@ {{ Form::checkbox($name, $item->$id, null, [ 'id' => 'checkbox-' . $name . '-' . $item->$id, 'class' => 'custom-control-input', - 'v-model' => !empty($attributes['v-model']) ? $attributes['v-model'] : 'form.' . $name + 'v-model' => !empty($attributes['v-model']) ? $attributes['v-model'] : !empty($attributes['data-field']) ? 'form.' . $attributes['data-field'] . '.'. $name : 'form.' . $name ]) }}
{{ trans('reports.net') }}
{{ trans('reports.net') }}@money($total, setting('default.currency'), true)@money($total, setting('default.currency'), true)@money($total_total, setting('default.currency'), true)@money($total_total, setting('default.currency'), true)