/
home
/
sjslayjy
/
public_html
/
scm
/
resources
/
views
/
dashboard
/
shortClosedPO
/
Upload File
HOME
@extends('dashboard.layouts.app') @section('title','Order') @section('style') <style type="text/css"> span.close-now { background: red; width: 25px; height: 25px; display: block; text-align: center; border-radius: 50%; padding: 3px; color: #fff; margin-top: 30px; } </style> @endsection @section('content') <div class="main-content"> <div class="main-content-inner"> <div class="breadcrumbs ace-save-state" id="breadcrumbs"> <ul class="breadcrumb"> <li> <i class="ace-icon fa fa-home home-icon"></i> <a href="#">Home</a> </li> <li class="active">Purchase Order Details</li> </ul> </div> <div class="page-content"> <div class="row"> <div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title">Purchase Order Details</h3> </div> <div class="panel-body"> <div class="row grid-margin"> <div class="col-md-3"> <label><b>Short Close Number</b></label> <p>{{ $short_close->short_close_no }}</p> </div> <div class="col-md-3"> <label><b>Basic Amount</b></label> <p>{{ $short_close->stc_basic_amount }}</p> </div> <div class="col-md-3"> <label><b>Tax Amount</b></label> <p>{{ $short_close->gst_amount }}</p> </div> <div class="col-md-3"> <label><b>Total Amount</b></label> <p>{{ $short_close->stc_total_amount }}</p> </div> <div class="col-md-3"> <label><b>Status</b></label> <span class="badge badge-info" title="PO Current Status">{{ $short_close->approval_status }}</span> </div> </div> <div class="row grid-margin"> <div class="table-header"> Items </div> <div> <table class="table table-striped table-bordered"> <thead> <tr> <th>S.N.</th> <th>Pr. No</th> <th>PO No</th> <th> Item Code</th> <th> Description</th> <th> UoM</th> <th> Qty</th> <th> Rate</th> <th> Amount</th> <th> GST Tax(%)</th> <th> Tax Amount </th> <th> Total Amount</th> </tr> </thead> <tbody id="tbody"> @php $total_amount = 0; @endphp @foreach($all_pos as $item=>$i) <tr> <td>{{$item+1}}</td> <td>{{getModelById('PurchaseRequest',$i->pr_id)->pr_number}}</td> <td>{{getModelById('PurchaseOrder',$i->po_id)->po_number}}</td> <td>{{$i->code}}</td> <td>{{$i->description}}</td> <td>{{getTableById('units',$i->uom)->name}}</td> <td>{{$i->stc_qty}}</td> <td>{{$i->rate}}</td> <td>{{(float)$i->rate*(float)$i->stc_qty}}</td> <td>{{$i->gst}}</td> <td>{{(float)$i->stc_qty*(float)$i->rate*(float)$i->gst/100}}</td> <td>{{(float)$i->rate*(float)$i->stc_qty+((float)$i->stc_qty*(float)$i->rate*(float)$i->gst/100)}}</td> </tr> @php $total_amount += (float)$i->rate*(float)$i->stc_qty+(float)$i->stc_qty*(float)$i->rate*(float)$i->gst/100; @endphp @endforeach </tbody> <tr> <th colspan="11" style="border-top:1px solid; border-right:1px solid; text-align:right; height:30px; padding-right: 5px;">Total Amount:</th> <td style="border-top:1px solid; text-align:center; height:30px; padding-left: 10px;"><i style="float: left; font-size: 16px;">{{$total_amount}}</td> </tr> </table> </div> </div> </div> </div> </div> </div> </div> @section('script') {{ Html::script("assets/js/jquery.dataTables.min.js")}} {{ Html::script("assets/js/jquery.dataTables.bootstrap.min.js")}} {{ Html::script("assets/js/dataTables.buttons.min.js")}} {{ Html::script("assets/js/buttons.flash.min.js")}} {{ Html::script("assets/js/buttons.html5.min.js")}} {{ Html::script("assets/js/buttons.print.min.js")}} {{ Html::script("assets/js/buttons.colVis.min.js")}} {{ Html::script("assets/js/dataTables.select.min.js")}} {{ Html::script("assets/js/ace-elements.min.js")}} {{ Html::script("assets/js/ace.min.js")}} <script type="text/javascript"> var itemCodes = {}; itemCodes.items = []; localStorage.setItem('itemCodes', JSON.stringify(itemCodes)); function addselectedItem(){ var code = $('#Code').val(); var html = ""; if(code != ""){ var url = window.location.origin+"/user/get-item" var data = {}; data.code = code; $('#loaderAction').show(); $.ajax({ type: "POST", url: url, data: $('#makePurchaseRequestForm').serialize(), success:function(res){ var itemCodes = JSON.parse(localStorage.getItem('itemCodes')); // console.log(itemCodes); var is_added = false; $.each(itemCodes.items,function(key,val){ if(val.code == code){ is_added = true; } }); if(is_added == false){ $.each(res.item,function(key,val){ html +=`<tr id="item_`+val.id+`"> <td>`+val.code+`</td> <td>`+val.description+`</td> <td>`+val.make+`</td> <td><input type="text" id="input_`+val.id+`" onkeypress="return onlyCurrency(event)" onblur="check_zero(this)" data-id="id_`+val.pr_id+`_`+val.id+`" name="item_qty[`+val.id+`]" onkeyup="getvalue(this,`+val.id+`)" value="0" style="width:100px;" /> </td> <td>300</td> <td>1000</td> <td><button type="button" class="btn btn-sm btn-danger" onclick="deleteItem(`+val.id+`)"><i class="fa fa-trash"></i></button></td> </tr>`; itemCodes.items.push(val); }); localStorage.setItem('itemCodes',JSON.stringify(itemCodes)); $('#tbody').append(html); }else{ swal('Error','Selected Item Alredy added !! !!!','warning'); } }, error:function(error){ console.log(error); }, dataType: 'json' }); }else{ swal('Error','Please Enter Item Code !', 'error'); } } function deleteItem(id){ // alert(id); var itemCodes = JSON.parse(localStorage.getItem('itemCodes')); var items = itemCodes.items; $(items).each(function (index){ if(items[index].id == id){ items.splice(index,1); // This will remove the object that first name equals to Test1 $('#item_'+id).remove(); return false; // This will stop the execution of jQuery each loop. } }); itemCodes.items = items; localStorage.setItem('itemCodes',JSON.stringify(itemCodes)); } function onlyCurrency(event){ if(event.which == 8 || event.which == 0){ return true; } if(event.which < 46 || event.which > 59) { return false; //event.preventDefault(); } // prevent if not number/dot if(event.which == 46 && $(this).val().indexOf('.') != -1) { return false; //event.preventDefault(); } // preven } function check_zero(t){ var qty = $(t).val(); if(qty == "" || qty == null){ $(t).val(0); } } function getvalue(t,id){ var item_qty = $(t).val(); if(item_qty != "" && item_qty != null){ var item_qty = parseInt(item_qty); addCartValueInKey(id,'item_qty',item_qty); }else{ addCartValueInKey(id,'item_qty',0); } } function addCartValueInKey(id,key,value){ var itemCodes = JSON.parse(localStorage.getItem('itemCodes')); $.each(itemCodes.items,function(k,val){ if(parseInt(val.id) == id){ itemCodes.items[k][key] = value; } }); localStorage.setItem('itemCodes',JSON.stringify(itemCodes)); } $('#makePurchaseRequestForm').submit(function(){ var itemCodes = JSON.parse(localStorage.getItem('itemCodes')); if(itemCodes.items.length < 1){ swal('Error','Please Added atleast one item !! !!!','error'); }else if(!is_valid()){ swal('Error','Quantity can not be zero. please check!!','error'); }else{ var url = $('#makePurchaseRequestForm').attr('action'); var data = {}; data._token = $('meta[name="_token"]').attr('content'); data.pr_date = $('#pr_date').val(); data.items = itemCodes.items; $.ajax({ url: url, method: 'POST', data: data, dataType:'json', success: function(data){ if(data.success == true){ swal('Success','Purchase Request Added Successfully !','success'); window.location.reload(); } }, error:function(error){ console.log(data); } }); } return false; }); function is_valid(){ var itemCodes = JSON.parse(localStorage.getItem('itemCodes')); var check = true; $.each(itemCodes.items,function(key,val){ if(val.item_qty == 0 ){ check = false; $('#input_'+val.id).css({'border:border': '1px solid #D5D5D5','border-color':'#bf0606'}); return false; }else{ $('#input_'+val.id).css({'border:border': '1px solid #D5D5D5','border-color':'#b5b5b5'}); } }); if(check == false){ return false }else{ return true; } } </script> @endsection @endsection