452 lines
26 KiB
PHP
452 lines
26 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
|
<head>
|
|
@include('layout.header')
|
|
<link rel="stylesheet" href="{{url(env("APP_URL").'storage/assets/libs/lightgallery/lightgallery.css')}}" >
|
|
<style>
|
|
.center {
|
|
height:100%;
|
|
display:flex;
|
|
align-items:center;
|
|
justify-content:center;
|
|
|
|
}
|
|
.form-input {
|
|
width:50%;
|
|
padding:0px 0px 0px 0;
|
|
}
|
|
.form-input img {
|
|
width:100%;
|
|
display:none;
|
|
margin-bottom:10px;
|
|
}
|
|
.form-input input {
|
|
display:none;
|
|
}
|
|
|
|
.form-input label {
|
|
height:25px;
|
|
background:#cdcdcd26;
|
|
color:#c9c9c9;
|
|
cursor:pointer;
|
|
width: 75px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.modal .table .select2-selection__rendered {
|
|
line-height: 31px !important;
|
|
}
|
|
.modal .table .select2-container .select2-selection--single {
|
|
height: 35px !important;
|
|
}
|
|
.modal .table .select2-selection__arrow {
|
|
height: 34px !important;
|
|
}
|
|
|
|
#purchase_detail .select2-container {
|
|
width: 100% !important;
|
|
}
|
|
|
|
#purchase_detail .select2-container .select2-selection--single, #purchase_detail .select2-selection--multiple
|
|
{
|
|
min-height: 36px !important;
|
|
width: 100% !important;
|
|
}
|
|
#purchase_detail .select2-selection__arrow,
|
|
{
|
|
height: 36px !important;
|
|
}
|
|
#purchase_detail .select2-container--default .select2-selection--single .select2-selection__rendered
|
|
{
|
|
line-height: 28px !important;
|
|
position: relative;
|
|
top: -11px !important;
|
|
left: -20px !important;
|
|
}
|
|
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="row" id="x" style="display: none;">
|
|
<div class="col-12">
|
|
<span class="d-flex align-items-center purchase-popup">
|
|
<i class="typcn typcn-delete-outline" id="bannerClose"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="container-scroller">
|
|
@include('layout.navbar')
|
|
<!-- partial -->
|
|
@include('layout.breadscrum')
|
|
<div class="container-fluid page-body-wrapper">
|
|
|
|
@include('layout.sidebar')
|
|
|
|
<!-- partial -->
|
|
<div class="main-panel">
|
|
<div class="content-wrapper">
|
|
<div class="row">
|
|
<div class="col-md-12 grid-margin stretch-card">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h4 class="card-title"><i class="mdi mdi-dots-vertical menu-icon"></i> {{__('Goods Receive')}}</h4>
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<form method="get" action="{{url('/inventory/stock-in/search')}}">
|
|
<div class="row">
|
|
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
|
|
<div class="input-group">
|
|
<input type="text" class="form-control" value="{{isset($_GET['kword']) ? $_GET['kword'] : ''}}" name="kword" id="kword" placeholder="{{__('GRN-Number or supplier name')}}">
|
|
<input id="start-invoice-date" value="{{isset($_GET['received_date']) ? $_GET['received_date'] : ''}}" name="received_date" class="form-control" onfocus="(this.type='date')" onblur="(this.type='text')" placeholder="From date" type="text">
|
|
<input id="end-invoice-date" value="{{isset($_GET['received_date_to']) ? $_GET['received_date_to'] : ''}}" name="received_date_to" class="form-control" onfocus="(this.type='date')" onblur="(this.type='text')" placeholder="To date" type="text">
|
|
<div class="input-group-append">
|
|
<button class="btn btn-sm rounded-0 btn-inverse-secondary px-3" type="submit"><i class="fa fa-search"></i> {{__('general.btn_search')}}</button>
|
|
@if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['add_medicine']))
|
|
<button class="btn btn-info rounded-0 waves-effect px-3 ml-2" type="button" data-action="new" data-toggle="modal" data-target="#modal-medicine-purchase" data-backdrop="static"><i class="typcn typcn-plus"></i> {{__('general.btn_add_new')}}</button>
|
|
@endif
|
|
<button type="button" class="btn btn-white rounded-0 dropdown-toggle ml-4" data-toggle="dropdown" aria-expanded="true">{{__('report.btn_action')}}</button>
|
|
<div class="dropdown-menu" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 44px, 0px);" x-placement="bottom-start">
|
|
<button type="button" data-toggle="modal" data-target="#print_preview_modal" data-backdrop="static" class="dropdown-item font-14">{{__('report.btn_action_print')}}</button>
|
|
<button type="submit" value="true" name="export" class="dropdown-item font-14">{{__('report.btn_action_export')}}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form> <hr class="my-3 d-none">
|
|
|
|
<div class="col-sm-12 p-0 mb-1 mt-3">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-hover table-striped" id="department_dt">
|
|
<thead>
|
|
<tr class="bg-gradient-light">
|
|
<th class="py-2" width="50px">{{__('physician.table_no')}}</th>
|
|
<th class="py-2 text-center" width="100px">{{__('physician.table_action')}}</th>
|
|
<th class="py-2" width="200px">{{__('GRN-Number')}}</th>
|
|
<th class="py-2" width="150px">{{__('PO-Number')}}</th>
|
|
<th class="py-2">{{__('Supplier')}}</th>
|
|
<th class="py-2" width="250px">{{__('Received Date')}}</th>
|
|
<th class="py-2" width="250px">{{__('Total Amount')}}</th>
|
|
<th class="py-2 text-center" width="100px">{{__('physician.table_status')}}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($medicinePurchases as $k=>$medicinePurchase)
|
|
<tr>
|
|
<td class="py-1 text-center">{{($k+1) + (($_GET['page'] ?? 1) * 20) - 20}}</td>
|
|
<td class="py-1 text-center">
|
|
<div class="btn-group" role="group">
|
|
{{-- <a href="{{url('inventory/stock-in/'.$medicinePurchase->id.'?print')}}" class="btn btn-sm btn-info mr-2" title="{{__('sample.btn_print')}}">--}}
|
|
{{-- <i class="mdi mdi-printer"></i>--}}
|
|
{{-- </a>--}}
|
|
@if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_medicine']))
|
|
<button type="button" class="btn btn-sm btn-inverse-primary mr-2" title="{{__('general.btn_edit')}}" data-action="edit" data-uid="{{$medicinePurchase->id}}" data-toggle="modal" data-target="#modal-medicine-purchase" data-backdrop="static">
|
|
<i class="typcn typcn-edit"></i>
|
|
</button>
|
|
@endif
|
|
@if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['delete_medicine']))
|
|
<button type="button" class="btn btn-sm btn-inverse-danger " title="{{__('general.btn_delete')}}" onclick="delete_data({{$medicinePurchase->id}})"><i class="mdi mdi-close-circle"></i></button>
|
|
@endif
|
|
|
|
</div>
|
|
</td>
|
|
<td class="py-1">{{$medicinePurchase->grn_number}}</td>
|
|
<td class="py-1">{{$medicinePurchase->po_number}}</td>
|
|
<td class="py-1">{{$medicinePurchase->supplier->name_en}}</td>
|
|
<td class="py-1">{{date('d-m-Y',strtotime($medicinePurchase->received_date))}}</td>
|
|
<td class="py-1">{{$medicinePurchase->net_amount}}</td>
|
|
<td class="py-1 text-center">
|
|
<i class="mdi {{$medicinePurchase->record_status_id == 1 ? 'mdi-check-circle text-primary' : 'mdi-checkbox-blank-circle-outline'}}"></i>
|
|
</td>
|
|
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="float-right mt-3">
|
|
{!! $medicinePurchases->links('pagination.custom') !!}
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Modal Laboratory -->
|
|
<div class="modal fade modal-primary" id="modal-medicine-purchase">
|
|
<div class="modal-dialog modal-semi-xxl modal-dialog-scrollable">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h6 class="modal-title new">{{__('New Supplier')}}</h6>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true" class="mdi mdi-close"></span></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form method="POST" action="#" id="form-stock-in" enctype="multipart/form-data" onkeydown="return event.key != 'Enter';">
|
|
@csrf
|
|
<input type="hidden" class="form-control" name="uid" id="data-id" value="0" />
|
|
<div class="form-vertical">
|
|
|
|
<div class="row">
|
|
<div class="col-sm-12 col-md-3">
|
|
<div class="form-group mb-1">
|
|
<label class="font-weight-medium" for="lab-name-en">{{__('GRN-Number')}}</label>
|
|
<input type="text" class="form-control clearable rounded-0" id="grn-number" name="grn_number" placeholder="{{__('Good Received Note Number')}}">
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-12 col-md-3">
|
|
<div class="form-group mb-1">
|
|
<label class="font-weight-medium" for="lab-name-en">{{__('PO-Number')}}</label>
|
|
<input type="text" class="form-control clearable rounded-0" id="po-number" name="po_number" placeholder="{{__('Purchase Order Number')}}">
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-12 col-md-3">
|
|
<div class="form-group mb-1">
|
|
<label class="font-weight-medium" for="lab-name-en">{{__('Supplier')}} <span class="text-danger">*</span></label>
|
|
<select class="form-control clearable rounded-0 select2" id="supplier" name="supplier" style=" width: 100% !important;">
|
|
<option></option>
|
|
@foreach($suppliers as $supplier)
|
|
<option value="{{$supplier->id}}">{{$supplier->name_en}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-12 col-md-3">
|
|
<div class="form-group mb-1">
|
|
<label class="font-weight-medium" for="lab-name-en">{{__('Received Date')}} <span class="text-danger">*</span></label>
|
|
<input type="date" class="form-control clearable rounded-0" id="received-date" name="received_date">
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-sm-12 py-0 px-4">
|
|
<div class="row">
|
|
<table class="table table-bordered " id="purchase_detail">
|
|
<thead>
|
|
<tr class="bg-light">
|
|
<td style="width:15%" class="p-1">@lang('Medical Item Group')</td>
|
|
<td style="width:25%" class="p-1">@lang('Medical Item')</td>
|
|
<td class="p-1">@lang('Lot No.')</td>
|
|
<td class="p-1">@lang('Expiry Date')</td>
|
|
<td class="p-1">@lang('Medical Item Unit') </td>
|
|
<td class="p-1">Quantity</td>
|
|
<td class="p-1">@lang('Unit Price')</td>
|
|
<td class="p-1">@lang('Total Amount')</td>
|
|
<td class="p-1 text-center">
|
|
<button type="button" onclick="addPurchasedMedicalItem()" class="btn rounded-0 btn-md btn-light"><i class="mdi mdi-plus-circle text-info" ></i></button>
|
|
</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="purchase_detail_body"></tbody>
|
|
</table>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-sm-6 p-0 mt-3">
|
|
<div class="form-group">
|
|
<textarea class="form-control" rows="2" placeholder="Description..." id="note" name="note"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-6" style="float:right">
|
|
<table class="table" style="width:70%;float:right;margin-right:60px;">
|
|
<tr>
|
|
<td><h5>Total:</h5></td>
|
|
<td>
|
|
<p style="float:right;font-weight:bold;font-size:16px;color:navy" id="total_">0.00</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<div class="col-sm-10 text-left text-muted" style="font-size:10px !important;">
|
|
<span id="creator"></span> <span id="creator-time"></span><br>
|
|
<span id="modifier"></span> <span id="modifier-time"></span>
|
|
</div>
|
|
<button type="button" class="btn btn-info rounded-0" id="btnSave"><i class="fa fa-floppy-o"></i> <span class="save">{{__('lang.save')}}</span><span class="update" style="display: none">{{__('lang.update')}}</span></button>
|
|
<button type="button" class="btn btn-light rounded-0" data-dismiss='modal'>{{__('lang.cancel')}}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@include('modal.stock_in_print')
|
|
|
|
@include('layout.footer')
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@include('layout.common_script')
|
|
|
|
<script>
|
|
|
|
$('.select2-container').width('150px !important')
|
|
|
|
var save_url = "{{url('inventory/stock-in/save')}}";
|
|
var update_url = "{{url('inventory/stock-in/update')}}";
|
|
var delete_url = "{{url('inventory/stock-in/delete')}}";
|
|
|
|
var get_url = "{{url('inventory/stock-in/get')}}";
|
|
|
|
var inventory_base_url = "{{url('inventory')}}";
|
|
|
|
let modal_add_title = "{{__('New Goods Receive')}}";
|
|
let modal_edit_title = "{{__('Edit Goods Receive')}}";
|
|
|
|
</script>
|
|
<script src="{{url(env("APP_URL").'storage/assets/js/admin/medicine_purchase.js?time='.time())}}"></script>
|
|
|
|
<script>
|
|
|
|
function getMedicalItemByGroupId(id, rowid) {
|
|
var div_data = "";
|
|
$("#medicine_name" + rowid).html("<option value=''></option>");
|
|
$.ajax({
|
|
url: inventory_base_url+'/medicine/group/'+id,
|
|
type: "GET",
|
|
dataType: 'json',
|
|
success: function (res) {
|
|
if(res.success) {
|
|
$.each(res.data, function (i, obj) {
|
|
var sel = "";
|
|
div_data += "<option value='" + obj.id + "'>" + obj.medicine.name + " (" + Number(obj.available_quantity).toFixed(0) + ")</option>";
|
|
});
|
|
$("#medicine_name" + rowid).html("<option value=''>Select</option>");
|
|
$('#medicine_name' + rowid).append(div_data);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function addPurchasedMedicalItem(purchaseDetail = null) {
|
|
var table = document.getElementById("purchase_detail_body");
|
|
var table_len = table.rows.length;
|
|
var id = table_len + 1
|
|
|
|
var opt = "<?php foreach($medicineGroups as $item){ ?>";
|
|
opt += "<option value='<?php echo $item->id ?>'><?php echo $item->name_en ?></option>";
|
|
opt += "<?php } ?>";
|
|
|
|
var medicalItemUnitOpt = "<?php foreach($medicineUnits as $item){ ?>";
|
|
medicalItemUnitOpt += "<option value='<?php echo $item->id ?>'><?php echo $item->name_en ?></option>";
|
|
medicalItemUnitOpt += "<?php } ?>";
|
|
|
|
var row_ = "<tr id='row_" + id + "'>" +
|
|
'<td class="p-2">' +
|
|
'<select class="form-control form-control-sm clearable rounded-0" id="cate_' + id + '" name="category_id[]" onchange=getMedicalItemByGroupId(this.value,' + id + ') required>' +
|
|
'<option value="">Chose</option>' + opt +
|
|
'</select>' +
|
|
'</td>' +
|
|
'<td class="p-2">' +
|
|
'<select name="drug_name[]" id="medicine_name' + id + '" class="form-control clearable form-control-sm rounded-0" required></select>' +
|
|
'</td>' +
|
|
'<td class="p-2">' +
|
|
' <input type="text" class="form-control-sm form-control rounded-0 lotno" name="lotno[]" id="lotno_' + id + '" value="0">' +
|
|
'</td>' +
|
|
'<td class="p-2">' +
|
|
' <input type="date" class="form-control-sm clearable rounded-0 form-control" id="exp_' + id + '" data-date-format="dd-mm-yyyy" data-language="en" placeholder="dd-mm-yyyy" autocomplete="off" name="expiry_date[]" required>' +
|
|
'</td>' +
|
|
'<td class="p-2">' +
|
|
'<select class="form-control form-control-sm clearable rounded-0" id="unit_' + id + '" name="medicine_unit_id[]" required>' +
|
|
'<option value="">Chose</option>' + medicalItemUnitOpt +
|
|
'</select>' +
|
|
'</td>' +
|
|
'<td class="p-2">' +
|
|
' <input type="number" class="form-control-sm form-control rounded-0 qty" name="quantity[]" id="qty_' + id + '" value="1" onblur="calculatePurchasedPrice()" onchange="calculatePurchasedPrice()" required step="any" min="0.00">' +
|
|
'</td>' +
|
|
'<td class="p-2">' +
|
|
' <input type="number" class="form-control-sm form-control rounded-0 unit-price" name="purchase_price[]" value="0" id="pur_price_' + id + '" onblur="calculatePurchasedPrice()" onchange="calculatePurchasedPrice()" required step="any" min="0.00">' +
|
|
'</td>' +
|
|
'<td class="p-2">' +
|
|
' <input type="text" readonly id="subtotal_' + id + '" class="form-control-sm form-control rounded-0" name="amount[]" step="any" min="0.00" value="0">' +
|
|
'</td>' +
|
|
'<td style="margin-top:20px;" class="p-2">' +
|
|
' <button type="button" onclick="removePurchasedMedicalItem(' + id + ')" class="btn rounded-0 btn-md btn-danger"><i class="mdi mdi-trash-can text-white"></i></button>' +
|
|
'</td>' +
|
|
'</tr>';
|
|
|
|
|
|
table.insertRow(table_len).outerHTML = row_;
|
|
|
|
if (purchaseDetail != null) {
|
|
$('#cate_' + id).val(purchaseDetail.medicine_group_id);
|
|
$('#exp_' + id).val(purchaseDetail.expiry_date)
|
|
$('#unit_' + id).val(purchaseDetail.medicine_unit_id)
|
|
$('#lotno_' + id).val(purchaseDetail.lotno)
|
|
$('#qty_' + id).val(purchaseDetail.quantity)
|
|
$('#pur_price_' + id).val(purchaseDetail.unit_price)
|
|
$('#subtotal_' + id).val(purchaseDetail.unit_price * purchaseDetail.quantity)
|
|
$('#medicine_name' + id).empty().append('<option selected value = "'+purchaseDetail.medicine_item_id+'">'+purchaseDetail.medicine_item.medicine.name+'</option>');
|
|
}
|
|
|
|
$("#medicine_name"+id).select2();
|
|
$("#unit_"+id).select2();
|
|
|
|
}
|
|
|
|
function removePurchasedMedicalItem(id)
|
|
{
|
|
$("#row_"+id).remove();
|
|
calculatePurchasedPrice();
|
|
}
|
|
|
|
function calculatePurchasedPrice()
|
|
{
|
|
var total=0;
|
|
var price=[];
|
|
var qty=[];
|
|
var sum=0;
|
|
|
|
$(".unit-price").each(function () {
|
|
var pr=$(this).val();
|
|
if(pr=="NaN" || pr==null || pr==""){
|
|
pr=parseFloat("0");
|
|
}
|
|
price.push(pr);
|
|
});
|
|
|
|
$(".qty").each(function () {
|
|
var q=$(this).val();
|
|
if(q=="NaN" || q==null || q==""){
|
|
q=parseFloat("0");
|
|
}
|
|
qty.push(q);
|
|
});
|
|
|
|
for(var i=0; i<price.length; i++)
|
|
{
|
|
var sum=(price[i]*qty[i]);
|
|
total+=sum;
|
|
$("input[name='amount[]']:eq("+i+")").val(sum.toFixed(2));
|
|
}
|
|
var amount= total
|
|
//console.log('Riel', new Intl.NumberFormat('en-IN', { maximumSignificantDigits: 3 }).format(total))
|
|
$("#total_").html("$ "+amount.toFixed(2));
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|