Skip to content

GitLab

  • Menu
    • Projects Groups Snippets
      Help
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S sistempos_finaltask
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Mujahid Rofiq
  • sistempos_finaltask
  • Merge requests
  • !161

Merged
Created 1 year ago by Mujahid Rofiq@MujahidRMaintainer

update fungsionalitas create data transfer

  • Overview 1
  • Commits 1
  • Changes 4

Created by: arneyva

  • Mujahid Rofiq
    Mujahid Rofiq @MujahidR · 1 year ago
    Author Maintainer

    Merged by: arneyva at 2024-05-13 15:28:20 UTC

  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
Compare
  • main (base)

and
  • latest version
    ef2bcf35
    1 commit, 8 months ago

4 files
+ 84
- 46

    Preferences

    File browser
    Compare changes
a‎pp‎
Http/Con‎trollers‎
Adjus‎tment‎
AdjustmentCo‎ntroller.php‎ +3 -3
Tran‎sfer‎
TransferCon‎troller.php‎ +3 -2
Mod‎els‎
Produ‎ct.php‎ +10 -0
resources/views/t‎emplates/transfer‎
create.b‎lade.php‎ +68 -41
app/Http/Controllers/Adjustment/AdjustmentController.php
+ 3
- 3
  • View file @ ef2bcf35

  • Edit in single-file editor

  • Edit in Web IDE


Show all unchanged lines Show 20 lines
$product_price = $product_variant_data['price'];
$product_cost = $product_variant_data['cost'];
$item['qty'] = $stock->qty;
$item['code'] = $product_variant_data['code'];
$item['name'] = '['.$product_variant_data['name'].']'.$Product_data['name'];
$item['qty'] = $stock->qty;
$item['product_variant_id'] = $variant_id;
//product is_service
Show 20 lines Show all unchanged lines Show 20 lines
$cost = 0;
}
$item['Unit_cost'] = $cost;
$item['Unit_cost'] = $cost; //harga sek diinput di form produk
$item['fix_cost'] = $product_cost;
$item['Unit_price'] = $price;
$item['fix_price'] = $product_price;
if ($Product_data->TaxNet !== 0.0) {
//Exclusive
if ($Product_data['tax_method'] == '1') {
if ($Product_data['tax_method'] == 'Exclusive') {
$tax_price = $price * $Product_data['TaxNet'] / 100;
$tax_cost = $cost * $Product_data['TaxNet'] / 100;
Show 20 lines Show all unchanged lines
app/Http/Controllers/Transfer/TransferController.php
+ 3
- 2
  • View file @ ef2bcf35

  • Edit in single-file editor

  • Edit in Web IDE


Show all unchanged lines Show 20 lines
$transferValue->statut = $request->transfer['statut'];
$transferValue->notes = $request->transfer['notes'];
$transferValue->GrandTotal = $request['GrandTotal'];
$transferValue->GrandTotal = Auth::user()->id;
$transferValue->user_id = Auth::user()->id;
$transferValue->save();
$data = $request['details'];
dd($data);
foreach ($data as $key => $value) {
$unit = Unit::where('id', $value['purchase_unit_id'])->first();
if ($request->transfer['statut'] === 'completed') {
Show 20 lines Show all unchanged lines Show 20 lines
$orderDetails['discount_method'] = $value['discount_method'];
$orderDetails['total'] = $value['subtotal'];
TransferDetail::insert($transferDetails);
dd($transferValue);
// dd($transferValue);
DB::commit();
return redirect()->route('transfer.index')->with('success', 'Transfer created successfully');
Show 20 lines Show all unchanged lines
app/Models/Product.php
+ 10
- 0
  • View file @ ef2bcf35

  • Edit in single-file editor

  • Edit in Web IDE


Show all unchanged lines Show 20 lines
{
return $this->hasMany(ProductWarehouse::class, 'product_id', 'id');
}
public function unitPurchase()
{
return $this->belongsTo('App\Models\Unit', 'unit_purchase_id');
}
public function unitSale()
{
return $this->belongsTo('App\Models\Unit', 'unit_sale_id');
}
}
resources/views/templates/transfer/create.blade.php
+ 68
- 41
  • View file @ ef2bcf35

  • Edit in single-file editor

  • Edit in Web IDE


Show all unchanged lines Show 20 lines
</div>
{{-- --}}
<div class="card-body">
<form action="{{ route('adjustment.store') }}" method="POST">
<form action="{{ route('transfer.store') }}" method="POST">
@csrf
<div class="row">
<div class="col-md-4 mb-3">
<label class="form-label" for="selectWarehouse">From Warehouse/Outlet *</label>
<select class="form-select" id="selectWarehouse" name="from_warehouse_id" required>
<select class="form-select" id="selectWarehouse" name="transfer[from_warehouse_id]"
required>
<option selected disabled value="">Choose...</option>
@foreach ($warehouse as $wh)
<option value="{{ $wh->id }}">{{ $wh->name }}</option>
Show 20 lines Show all unchanged lines Show 20 lines
</div>
<div class="col-md-4 mb-3">
<label class="form-label" for="selectToWarehouse">To Warehouse/Outlet *</label>
<select class="form-select" id="selectToWarehouse" name="to_warehouse_id" required>
<select class="form-select" id="selectToWarehouse" name="transfer[to_warehouse_id]"
required>
<option selected disabled value="">Choose...</option>
@foreach ($warehouse as $wh)
<option value="{{ $wh->id }}">{{ $wh->name }}</option>
Show 20 lines Show all unchanged lines Show 20 lines
</div>
<div class="col-md-4 mb-3">
<label class="form-label" for="exampleInputdate">Date *</label>
<input type="date" class="form-control" id="exampleInputdate" name="date"
<input type="date" class="form-control" id="exampleInputdate" name="transfer[date]"
value="{{ date('Y-m-d') }}">
</div>
<div class="col-md-12 mb-3">
Show 20 lines Show all unchanged lines Show 20 lines
<tbody>
<tr>
<td>Order Tax</td>
<th>1 %</th>
<th></th>
</tr>
<tr>
<td>Discount</td>
<th>Rp 10000</th>
<th></th>
</tr>
<tr>
<td>Shipping</td>
<th>Rp 10000</th>
<th></th>
</tr>
<tr>
<td>Grand Total</td>
<th>Rp 10000</th>
<th><input type="number" id="grandTotal" name="GrandTotal" readonly></th>
</tr>
</table>
</div>
<div class="col-md-12 mb-3">
<div class="row">
<div class="col-md-4 mb-3">
<label class="form-label" for="codebaseproduct">Order Tax *</label>
<label class="form-label" for="tax_rate">Order Tax *</label>
<div class="form-group input-group">
<input type="text" class="form-control" id="codebaseproduct" required
placeholder="input tax" name="code"
value="{{ Session::get('code') }}">
<input type="number" class="form-control" id="tax_rate" required
placeholder="input tax" name="transfer[tax_rate]"
value="{{ Session::get('tax_rate') }}">
<span class="input-group-text" id="basic-addon1">%</span>
</div>
@error('code')
@error('tax_rate')
<div class="alert alert-right alert-warning alert-dismissible fade show mb-3"
role="alert" style="padding: 1px 1px 1px 1px; margin-top: 3px">
<span style="margin-left: 3px"> {{ $message }}</span>
Show 20 lines Show all unchanged lines Show 20 lines
</div>
@enderror
</div>
<input type="number" class="form-control" id="tax_rate" required
placeholder="input tax" name="transfer[TaxNet]"
value="{{ Session::get('tax_rate') }}">
<div class="col-md-4 mb-3">
<label class="form-label" for="codebaseproduct">Discount *</label>
<label class="form-label" for="discount">Discount *</label>
<div class="form-group input-group">
<input type="text" class="form-control" id="codebaseproduct" required
placeholder="input discount" name="code"
value="{{ Session::get('code') }}">
<input type="number" class="form-control" id="discount" required
placeholder="input discount" name="transfer[discount]"
value="{{ Session::get('discount') }}">
<span class="input-group-text" id="basic-addon1">Rp. </span>
</div>
@error('code')
@error('discount')
<div class="alert alert-right alert-warning alert-dismissible fade show mb-3"
role="alert" style="padding: 1px 1px 1px 1px; margin-top: 3px">
<span style="margin-left: 3px"> {{ $message }}</span>
Show 20 lines Show all unchanged lines Show 20 lines
@enderror
</div>
<div class="col-md-4 mb-3">
<label class="form-label" for="codebaseproduct">Shipping *</label>
<label class="form-label" for="shipping">Shipping *</label>
<div class="form-group input-group">
<input type="text" class="form-control" id="codebaseproduct" required
placeholder="input shipping" name="code"
value="{{ Session::get('code') }}">
<input type="number" class="form-control" id="shipping" required
placeholder="input shipping" name="transfer[shipping]"
value="{{ Session::get('shipping') }}">
<span class="input-group-text" id="basic-addon1">Rp. </span>
</div>
@error('code')
@error('shipping')
<div class="alert alert-right alert-warning alert-dismissible fade show mb-3"
role="alert" style="padding: 1px 1px 1px 1px; margin-top: 3px">
<span style="margin-left: 3px"> {{ $message }}</span>
Show 20 lines Show all unchanged lines Show 20 lines
</div>
<div class="col-md-6 mb-3">
<label class="form-label" for="brand">Status</label>
<select class="form-select select2" id="brand" required name="brand_id"
<select class="form-select select2" id="brand" required name="transfer[statut]"
data-placeholder="Select a Brand ">
<option selected disabled value="">Choose...</option>
{{-- @foreach ($brand as $item)
<option value="{{ $item->id }}"
{{ old('brand_id') == $item->id ? 'selected' : '' }}>
{{ $item->name }}
</option>
@endforeach --}}
<option value="sent">Sent</option>
<option value="completed">Completed</option>
</select>
@error('brand_id')
@error('statut')
<div class="alert alert-right alert-warning alert-dismissible fade show mb-3"
role="alert" style="padding: 1px 1px 1px 1px; margin-top: 3px">
<span style="margin-left: 3px"> {{ $message }}</span>
Show 20 lines Show all unchanged lines Show 20 lines
</div>
<div class="col-md-6 mb-3">
<label class="form-label" for="validationDefault05">Description</label>
<input type="text" class="form-control" id="validationDefault05" name="notes"
required placeholder="a few words...">
<input type="text" class="form-control" id="validationDefault05"
name="transfer[notes]" required placeholder="a few words...">
</div>
</div>
<div class="form-group mt-2">
Show 20 lines Show all unchanged lines Show 20 lines
$('#product-table-body').on('click', '.delete-row', function() {
$(this).closest('tr')
.remove(); // Menghapus baris tabel yang berisi tombol delete yang diklik
updateGrandTotal();
});
// Event listener untuk perubahan pada pilihan gudang
$('#selectWarehouse').on('change', function() {
Show 20 lines Show all unchanged lines Show 20 lines
row += '<td>' + data.qty + '</td>';
row +=
'<td><input type="number" class="form-control" name="details[' +
data
.id + '][quantity]" value="0" min="0"></td>';
row += '<td><select class="form-select" name="details[' + data.id +
'][type]"><option value="add">Add</option><option value="sub">Subtract</option></select></td>';
row += '<td><input type="hidden" name="details[' + data.id +
'][product_id]" value="' + data.id + '"></td>';
row += '<td><input type="hidden" name="details[' + data.id +
'][product_variant_id]" value="' + (variantId || '') +
data.id + '_' + variantId +
'][quantity]" value="0" min="0"></td>';
// row += '<td>' + '$ 0' + '</td>';
row += '<td class="item-price">0</td>';
row += '<td>' + '$' + data.tax_cost + '</td>';
// row += '<td>' + '$' + data.Total_cost + '</td>';
row += '<td class="item-total">' + data.Total_cost + '</td>';
row += '<td><input type="hidden" name="details[' + data.id + '_' +
variantId + '][product_id]" value="' + data.id + '"></td>';
row += '<td><input type="hidden" name="details[' + data.id + '_' +
variantId + '][product_variant_id]" value="' + (variantId ||
'') +
'"></td>';
row +=
'<td><button type="button" class="btn btn-danger btn-sm delete-row">Delete</button></td>'; // Tombol delete ditambahkan di sini
Show 20 lines Show all unchanged lines Show 20 lines
// Masukkan baris ke dalam tbody
$('#product-table-body').append(row);
updateGrandTotal();
}
});
}
});
$('#product-table-body').on('change', '.item-quantity', function() {
var row = $(this).closest('tr');
var quantity = parseFloat($(this).val());
var price = parseFloat(row.find('.item-total').text());
var totalCost = quantity * price;
row.find('.item-price').text(totalCost.toFixed(2));
updateGrandTotal();
});
});
function updateGrandTotal() {
var grandTotal = 0;
$('#product-table-body tr').each(function() {
var price = parseFloat($(this).find('.item-price').text());
if (!isNaN(price)) {
grandTotal += price;
}
});
$('#grandTotal').val(grandTotal.toFixed(2));
}
</script>
@endpush
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Milestone
No milestone
None
None
Time tracking
No estimate or time spent
0
Labels
None
Lock merge request
Unlocked
1
1 participant
Mujahid Rofiq
Reference: MujahidR/sistempos_finaltask!161
Source branch: dev-eth

Menu

Projects Groups Snippets
Help