mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 03:01:32 +00:00
248 lines
12 KiB
PHP
Executable File
248 lines
12 KiB
PHP
Executable File
@extends('layouts.main')
|
|
|
|
@push('styles')
|
|
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
|
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
|
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
|
@endpush
|
|
|
|
@section('content')
|
|
<div class="row bg-title">
|
|
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
|
<h4 class="page-title">{{ __('fixed_assets.fixed_assets') }}</h4>
|
|
</div>
|
|
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
|
<ol class="breadcrumb">
|
|
<li><a href="{{ route('home') }}">{{ __('fixed_assets.dashboard') }}</a></li>
|
|
<li><a href="{{ route('fixed_assets.index') }}">{{ __('fixed_assets.fixed_assets') }}</a></li>
|
|
<li class="active">{{ __('fixed_assets.edit') }}</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
|
|
@include('flash::message')
|
|
|
|
@include('finance::fixed_assets.menu')
|
|
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<div class="white-box">
|
|
{{ Form::model($fixed_asset, ['method' => 'PUT', 'route' => ['fixed_assets.update',$fixed_asset], 'data-toggle' => 'validator']) }}
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
{{ Form::label('name', __('fixed_assets.asset_name')) }}
|
|
{{ Form::text('name', $fixed_asset->name, ['class'=>'form-control compulsory','required']) }}
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('serial_number', __('fixed_assets.serial_number')) }}
|
|
{{ Form::text('serial_number', $fixed_asset->serial_number , ['class'=>'form-control']) }}
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('cost_price', __('fixed_assets.cost_price')) }}
|
|
{{ Form::number('cost_price', $fixed_asset->cost_price , ['class'=>'form-control', 'readonly','onkeyup'=>'get_balance()']) }}
|
|
</div>
|
|
|
|
<div class="form-group"> @php $acquisition_date = \Carbon\Carbon::parse($fixed_asset->acquisition_date)->format('d-m-Y'); @endphp
|
|
{{ Form::label('acquisition_date', __('fixed_assets.acquisition_date')) }}
|
|
<div class="input-group">
|
|
{{ Form::text('acquisition_date', $acquisition_date, ['class' => 'form-control compulsory', 'required','readonly'=>'true','id'=>'datepicker-autoclose']) }}
|
|
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('depreciation', __('fixed_assets.depreciation')) }}
|
|
{{ Form::number('depreciation', $fixed_asset->depreciation , ['class'=>'form-control', 'step' => 'any']) }}
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('item_condition',__('fixed_assets.item_condition')) }}
|
|
<br>
|
|
<div>
|
|
{{ Form::radio('item_condition', 1, false, ["required"]) }} New
|
|
{{ Form::radio('item_condition', 0, false, ["required"]) }} Used
|
|
</div>
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('supplier', __('fixed_assets.supplier')) }}
|
|
{{ Form::select('supplier', $suppliers, $fixed_asset->supplier_id, ['class'=>'form-control compulsory', 'required']) }}
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('fixed_asset_account', __('fixed_assets.fixed_asset_account')) }}
|
|
{{ Form::select('fixed_asset_account', $fixed_asset_chart_of_accounts, $fixed_asset->fixed_asset_account_id, ['class'=>'form-control compulsory', 'required']) }}
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
{{ Form::label('warranty_expiration_date',__('fixed_assets.warranty_expiry')) }}
|
|
<div class="input-group">
|
|
{{ Form::text('warranty_expiration_date',$fixed_asset->warranty_expiration_date,['class' => 'form-control compulsory', 'required','readonly'=>'true','id'=>'datepicker-autoclose2']) }}
|
|
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('edit_payment_type', 'Edit payment options') }}
|
|
<br>
|
|
<div>
|
|
{{ Form::radio('edit_payment_type', 1, false, ["required", "id" => "edit_payment"]) }} Yes
|
|
{{ Form::radio('edit_payment_type', 0, false, ["required", "id" => "do_not_edit_payment"]) }} No
|
|
</div>
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
|
|
@php
|
|
$payment_type = array(''=>'-select-','cash'=>'Cash / EFT / CHEQUE', 'bill'=>'Bill', 'asset_exists'=>'Already Existing Asset');
|
|
|
|
$balance = 0;
|
|
$payable_account_id = 14; //default payable
|
|
|
|
$bill = \Streamline\Models\HospitalBill::where(['item_ids' => $fixed_asset->id, 'bill_type' => 'ASSETS'])->first();
|
|
|
|
if ($bill) {
|
|
$balance = (int)$bill->total_amount;
|
|
$payable_account_id = $bill->payable_account;
|
|
}
|
|
@endphp
|
|
<div id="edit_payment_type_div" style="display: none;">
|
|
@if($fixed_asset->payment_type != null)
|
|
<div class="form-group">
|
|
{{ Form::label('payment_type', 'Payment Type') }}
|
|
{{ Form::select('payment_type', $payment_type, $fixed_asset->payment_type, ['class'=>'form-control compulsory', 'required', 'id'=>'payment_type']) }}
|
|
</div>
|
|
|
|
<div id="cash_div" @if($fixed_asset->payment_type != "cash") style="display: none" @endif>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('bank_account_id', __('fixed_assets.bank_account')) }}
|
|
{{ Form::select('bank_account_id', $bank_chart_of_accounts, $fixed_asset->bank_account_id, ['class'=>'form-control']) }}
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('amount_paid', 'Amount Paid') }}
|
|
{{ Form::number('amount_paid', $fixed_asset->cost_price-$balance, ['class'=>'form-control compulsory', 'required', 'id'=>'amount_paid', 'onkeyup'=>'get_balance()']) }}
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('balance', 'balance') }}
|
|
{{ Form::number('balance', $balance, ['class'=>'form-control', 'readonly', 'id'=>'balance']) }}
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="bill_div" @if($fixed_asset->payment_type != "bill") style="display: none" @endif>
|
|
<div class="form-group">
|
|
{{ Form::label('payable_account', 'Payable Account') }}
|
|
{{ Form::select('payable_account', $payable_accounts, $payable_account_id, ['class'=>'form-control']) }}
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('description', __('fixed_assets.description')) }}
|
|
{{ Form::textArea('description', $fixed_asset->description , ['class'=>'form-control', 'rows' => 4]) }}
|
|
</div>
|
|
@else
|
|
<div class="alert alert-info">Can not edit payment type</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
{{ Form::button(__('fixed_assets.update'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
|
|
{{ Form::button(__('fixed_assets.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
|
|
</div>
|
|
{{ Form::close() }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
|
|
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
|
|
|
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
|
|
|
<!-- data time piker dependency -->
|
|
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
|
<!-- -->
|
|
|
|
<script>
|
|
window.onload = function(){
|
|
var fixed_asset = {!! json_encode($fixed_asset) !!};
|
|
console.log(fixed_asset);
|
|
$('#datepicker-autoclose').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true,
|
|
format: 'dd-mm-yyyy',
|
|
setDate: fixed_asset.acquisition_date,
|
|
readOnly: true
|
|
});
|
|
$('#datepicker-autoclose2').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true,
|
|
format: 'dd-mm-yyyy',
|
|
setDate: fixed_asset.warranty_expiration_date,
|
|
readOnly: true
|
|
});
|
|
}
|
|
|
|
$('.table').DataTable({
|
|
dom: 'Bfrtip',
|
|
buttons: [
|
|
'copy', 'csv', 'excel', 'pdf', 'print'
|
|
]
|
|
});
|
|
|
|
$('#payment_type').change(function() {
|
|
if (this.value === 'cash') {
|
|
$('#cash_div').show();
|
|
$('#bill_div').hide();
|
|
} else if (this.value === 'bill') {
|
|
$('#cash_div').hide()
|
|
$('#bill_div').show()
|
|
} else {
|
|
$('#cash_div').hide()
|
|
$('#bill_div').hide()
|
|
}
|
|
});
|
|
|
|
$('#edit_payment,#do_not_edit_payment').click(function(){
|
|
if($('#edit_payment').is(':checked')) {
|
|
$('#edit_payment_type_div').show();
|
|
$("#cost_price").removeAttr("readonly");
|
|
}
|
|
|
|
if($('#do_not_edit_payment').is(':checked')) {
|
|
$('#edit_payment_type_div').hide();
|
|
}
|
|
});
|
|
|
|
function get_balance() {
|
|
var bill_div = $('#bill_div');
|
|
let cost_price = $('#cost_price').val();
|
|
let amount_paid = $('#amount_paid').val();
|
|
let balance = parseInt(cost_price) - parseInt(amount_paid);
|
|
$('#balance').val(balance);
|
|
|
|
(balance > 0) ? bill_div.show(): bill_div.hide();
|
|
}
|
|
</script>
|
|
@endpush |