update perbaikan pos, return, dan report profit nlost
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 4m17s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 15s
Build, Push and Deploy / deploy-staging (push) Successful in 41s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-05-14 22:19:01 +07:00
parent 1dfc06635d
commit 2fabdf8fc9
48 changed files with 1700 additions and 3030 deletions

Binary file not shown.

View File

@@ -18,15 +18,18 @@ public function index(Request $request)
$branchId = $user->branch_id ?? $user->active_branch_id; $branchId = $user->branch_id ?? $user->active_branch_id;
$baseQuery = SaleDetails::query() $baseQuery = SaleDetails::query()
->whereHas('product', fn ($q) => $q->where('business_id', $user->business_id)) ->whereHas('product', fn ($q) =>
$q->where('business_id', $user->business_id)
)
->when(moduleCheck('MultiBranchAddon') && $branchId, function ($q) use ($branchId) { ->when(moduleCheck('MultiBranchAddon') && $branchId, function ($q) use ($branchId) {
$q->whereHas('sale', fn ($q) => $q->where('branch_id', $branchId)); $q->whereHas('sale', fn ($q) =>
$q->where('branch_id', $branchId)
);
}) })
->when($request->filled('search'), function ($q) use ($request) { ->when($request->filled('search'), function ($q) use ($request) {
$q->whereHas('product', function ($q) use ($request) { $q->whereHas('product', function ($q) use ($request) {
$q->where('productName', 'like', "%{$request->search}%") $q->where('productName', 'like', "%{$request->search}%")
->orWhere('productCode', 'like', "%{$request->search}%") ->orWhere('productCode', 'like', "%{$request->search}%");
->orWhere('hsn_code', 'like', "%{$request->search}%");
}); });
}); });
@@ -39,11 +42,11 @@ public function index(Request $request)
->sum('lossProfit'); ->sum('lossProfit');
$product_lossProfits = $baseQuery $product_lossProfits = $baseQuery
->with('product:id,productName,productCode,hsn_code') ->with('product:id,productName,productCode')
->select( ->select(
'product_id', 'product_id',
DB::raw('SUM(CASE WHEN "lossProfit" > 0 THEN "lossProfit" ELSE 0 END) AS profit'), DB::raw('SUM(CASE WHEN lossProfit > 0 THEN lossProfit ELSE 0 END) AS profit'),
DB::raw('SUM(CASE WHEN "lossProfit" < 0 THEN "lossProfit" ELSE 0 END) AS loss') DB::raw('SUM(CASE WHEN lossProfit < 0 THEN lossProfit ELSE 0 END) AS loss')
) )
->groupBy('product_id') ->groupBy('product_id')
->paginate($request->per_page ?? 20) ->paginate($request->per_page ?? 20)
@@ -51,13 +54,17 @@ public function index(Request $request)
if ($request->ajax()) { if ($request->ajax()) {
return response()->json([ return response()->json([
'data' => view('business::reports.product-loss-profit.datas', compact('product_lossProfits'))->render(), 'data' => view(
'loss' => currency_format($loss, currency: business_currency()), 'business::reports.product-loss-profit.datas',
'profit' => currency_format($profit, currency: business_currency()) compact('product_lossProfits')
)->render()
]); ]);
} }
return view('business::reports.product-loss-profit.index', compact('product_lossProfits', 'profit', 'loss')); return view(
'business::reports.product-loss-profit.index',
compact('product_lossProfits', 'profit', 'loss')
);
} }
@@ -71,35 +78,25 @@ public function exportCsv()
return Excel::download(new ExportProductLossProfit, 'product-lossProfit.csv'); return Excel::download(new ExportProductLossProfit, 'product-lossProfit.csv');
} }
public function exportPdf(Request $request) public function exportPdf()
{ {
$user = auth()->user(); $branchId = moduleCheck('MultiBranchAddon') ? auth()->user()->branch_id ?? auth()->user()->active_branch_id : null;
$branchId = $user->branch_id ?? $user->active_branch_id;
$baseQuery = SaleDetails::query() $product_lossProfits = SaleDetails::with('product:id,productName,productCode')
->whereHas('product', fn ($q) => ->whereHas('product', function ($q) {
$q->where('business_id', $user->business_id) $q->where('business_id', auth()->user()->business_id);
)
->when(moduleCheck('MultiBranchAddon') && $branchId, function ($q) use ($branchId) {
$q->whereHas('sale', fn ($q) => $q->where('branch_id', $branchId));
}) })
->when($request->filled('search'), function ($q) use ($request) { ->when($branchId, function ($q) use ($branchId) {
$q->whereHas('product', function ($q) use ($request) { $q->whereHas('sale', function ($sale) use ($branchId) {
$q->where('productName', 'like', "%{$request->search}%") $sale->where('branch_id', $branchId);
->orWhere('productCode', 'like', "%{$request->search}%")
->orWhere('hsn_code', 'like', "%{$request->search}%");
}); });
}); })
$product_lossProfits = $baseQuery
->with('product:id,productName,productCode,hsn_code')
->select( ->select(
'product_id', 'product_id',
DB::raw('SUM(CASE WHEN "lossProfit" > 0 THEN "lossProfit" ELSE 0 END) AS profit'), DB::raw('SUM(CASE WHEN lossProfit > 0 THEN lossProfit ELSE 0 END) as profit'),
DB::raw('SUM(CASE WHEN "lossProfit" < 0 THEN "lossProfit" ELSE 0 END) AS loss') DB::raw('SUM(CASE WHEN lossProfit < 0 THEN lossProfit ELSE 0 END) as loss')
) )
->groupBy('product_id') ->groupBy('product_id')
->limit($request->per_page ?? 20)
->get(); ->get();
return PdfService::render('business::reports.product-loss-profit.pdf', compact('product_lossProfits'), 'product-loss-profit-report.pdf'); return PdfService::render('business::reports.product-loss-profit.pdf', compact('product_lossProfits'), 'product-loss-profit-report.pdf');

File diff suppressed because it is too large Load Diff

View File

@@ -40,212 +40,65 @@ public function store(Request $request)
'warehouse_id' => 'nullable|exists:warehouses,id', 'warehouse_id' => 'nullable|exists:warehouses,id',
'type' => 'nullable|string|in:sale,purchase', 'type' => 'nullable|string|in:sale,purchase',
'id' => 'required|integer', 'id' => 'required|integer',
'name' => 'nullable|string', 'name' => 'required|string',
'quantity' => 'required|numeric', 'quantity' => 'required|numeric',
'price' => 'required|numeric', 'price' => 'required|numeric',
'product_code' => 'nullable|string', 'product_code' => 'nullable|string',
'product_unit_id' => 'nullable|integer', 'product_unit_id' => 'nullable|integer',
'product_unit_name' => 'nullable|string', 'product_unit_name' => 'nullable|string',
'product_image' => 'nullable|string', 'product_image' => 'nullable|string',
'profit_percent' => 'nullable|numeric',
'sales_price' => 'nullable|numeric', 'sales_price' => 'nullable|numeric',
'whole_sale_price' => 'nullable|numeric', 'whole_sale_price' => 'nullable|numeric',
'dealer_price' => 'nullable|numeric', 'dealer_price' => 'nullable|numeric',
'expire_date' => 'nullable|date', 'expire_date' => 'nullable|date',
'product_type' => 'nullable|in:single,variant,combo', 'product_type' => 'nullable|in:single,variant,combo',
'variant_name' => 'nullable|string', 'variant_name' => 'nullable|string',
'serial_numbers' => 'nullable|array', 'vat_percent' => 'nullable|numeric',
'serial_numbers.*' => 'string',
'has_serial' => 'nullable|boolean',
'price_without_tax' => 'required_without:serial_numbers|numeric|nullable',
'customer_type' => 'nullable|string'
]); ]);
$incomingSerials = $request->serial_numbers ?? []; // Check for existing item in cart by type
$existingCartItem = Cart::search(
// Serial Mode fn($item) => $item->id == $request->id &&
if (!empty($incomingSerials)) { $item->options->type == $request->type &&
// Sale match ($request->type) {
if ($request->type === 'sale') { 'purchase' => $item->options->batch_no == $request->batch_no,
'sale' => $item->options->stock_id == $request->stock_id,
$stocks = Stock::where('business_id', auth()->user()->business_id) default => false,
->where('product_id', $request->id)
->where(function ($query) use ($incomingSerials) {
foreach ($incomingSerials as $serial) {
$query->orWhereJsonContains('serial_numbers', $serial);
} }
})->get(); )->first();
// Map serial → stock
$serialStockMap = [];
foreach ($stocks as $stock) {
foreach ($incomingSerials as $serial) {
if (in_array($serial, $stock->serial_numbers ?? [])) {
$serialStockMap[$stock->id][] = $serial;
}
}
}
// Add or merge cart per stock
foreach ($serialStockMap as $stockId => $serialsForStock) {
$resolvedStock = $stocks->firstWhere('id', $stockId);
$qty = count($serialsForStock);
$customerType = $request->customer_type ?? 'Retailer';
// Determine price based on customer type
$price = round($resolvedStock->productSalePrice ?? 0, 2);
if ($customerType === 'Dealer') {
$price = round($resolvedStock->productDealerPrice ?? 0, 2);
} elseif ($customerType === 'Wholesaler') {
$price = round($resolvedStock->productWholeSalePrice ?? 0, 2);
}
$existingCartItem = Cart::search(function ($item) use ($request, $stockId) {
return $item->id == $request->id &&
$item->options->type === 'sale' &&
$item->options->stock_id == $stockId;
})->first();
if ($existingCartItem) { if ($existingCartItem) {
$newQty = $existingCartItem->qty + $request->quantity;
$existingSerials = $existingCartItem->options->serial_numbers ?? []; Cart::update($existingCartItem->rowId, ['qty' => $newQty]);
// Remove already existing serials from incoming
$newSerials = array_diff($serialsForStock, $existingSerials);
$duplicates = array_intersect($existingSerials, $newSerials);
if (!empty($duplicates)) {
return response()->json([
'success' => false,
'message' => 'Serial already exists in cart',
'duplicates' => array_values($duplicates),
], 422);
}
$mergedSerials = array_values(array_unique(
array_merge($existingSerials, $serialsForStock)
));
Cart::update($existingCartItem->rowId, [
'qty' => count($mergedSerials),
'options' => $existingCartItem->options->merge([
'serial_numbers' => $mergedSerials,
]),
]);
} else { } else {
// Add new item to cart
Cart::add([ $mainItemData = [
'id' => $request->id,
'name' => $request->name,
'qty' => $qty,
'price' => $price,
'options' => [
'type' => 'sale',
'product_code' => $request->product_code,
'product_unit_id' => $request->product_unit_id,
'product_unit_name' => $request->product_unit_name,
'product_image' => $request->product_image,
'product_type' => $request->product_type,
'variant_name' => $request->variant_name,
'stock_id' => $resolvedStock->id,
'warehouse_id' => $resolvedStock->warehouse_id,
'sales_price' => $resolvedStock->productSalePrice,
'whole_sale_price' => $resolvedStock->productWholeSalePrice,
'dealer_price' => $resolvedStock->productDealerPrice,
'serial_numbers' => $serialsForStock,
'has_serial' => $request->has_serial ?? 1,
'price_without_tax' => $resolvedStock->price_without_tax,
]
]);
}
}
}
// Purchase
else {
Cart::add([
'id' => $request->id,
'name' => $request->name,
'qty' => count($incomingSerials),
'price' => round($request->price, 2),
'options' => [
'type' => 'purchase',
'product_code' => $request->product_code,
'product_unit_id' => $request->product_unit_id,
'product_unit_name' => $request->product_unit_name,
'product_image' => $request->product_image,
'product_type' => $request->product_type,
'variant_name' => $request->variant_name,
'stock_id' => null,
'warehouse_id' => $request->warehouse_id,
'serial_numbers' => $incomingSerials,
'batch_no' => $request->batch_no,
'expire_date' => $request->expire_date,
'purchase_price' => $request->purchase_price,
'profit_percent' => $request->profit_percent,
'sales_price' => $request->sales_price,
'whole_sale_price' => $request->whole_sale_price,
'dealer_price' => $request->dealer_price,
'has_serial' => $request->has_serial ?? 1,
'price_without_tax' => $request->price_without_tax,
]
]);
}
return response()->json([
'success' => true,
'message' => 'Serial product added successfully.'
]);
}
// Normal product ( without serial)
$existingCartItem = Cart::search(function ($item) use ($request) {
return $item->id == $request->id &&
$item->options->type == $request->type;
})->first();
if ($existingCartItem) {
Cart::update($existingCartItem->rowId, [
'qty' => $existingCartItem->qty + $request->quantity
]);
} else {
Cart::add([
'id' => $request->id, 'id' => $request->id,
'name' => $request->name, 'name' => $request->name,
'qty' => $request->quantity, 'qty' => $request->quantity,
'price' => round($request->price, 2), 'price' => $request->price,
'options' => [ 'options' => [
'type' => $request->type, 'type' => $request->type,
'product_code' => $request->product_code, 'product_code' => $request->product_code,
'product_unit_id' => $request->product_unit_id, 'product_unit_id' => $request->product_unit_id,
'product_unit_name' => $request->product_unit_name, 'product_unit_name' => $request->product_unit_name,
'product_image' => $request->product_image,
'product_type' => $request->product_type,
'variant_name' => $request->variant_name,
'stock_id' => $request->stock_id, 'stock_id' => $request->stock_id,
'batch_no' => $request->batch_no, 'batch_no' => $request->batch_no,
'product_image' => $request->product_image,
'expire_date' => $request->expire_date, 'expire_date' => $request->expire_date,
'purchase_price' => $request->purchase_price, 'purchase_price' => $request->purchase_price,
'profit_percent' => $request->profit_percent,
'sales_price' => $request->sales_price, 'sales_price' => $request->sales_price,
'whole_sale_price' => $request->whole_sale_price, 'whole_sale_price' => $request->whole_sale_price,
'dealer_price' => $request->dealer_price, 'dealer_price' => $request->dealer_price,
'product_type' => $request->product_type,
'warehouse_id' => $request->warehouse_id, 'warehouse_id' => $request->warehouse_id,
'has_serial' => $request->has_serial ?? 0, 'variant_name' => $request->variant_name,
'price_without_tax' => $request->price_without_tax, 'vat_percent' => $request->vat_percent,
] ]
]); ];
Cart::add($mainItemData);
} }
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Item added to cart successfully.' 'message' => 'Item added to cart successfully.'
@@ -255,45 +108,20 @@ public function store(Request $request)
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
$cart = Cart::get($id); $cart = Cart::get($id);
if (!$cart) { if (!$cart) {
return response()->json([ return response()->json(['success' => false, 'message' => __('Item not found in cart')]);
'success' => false,
'message' => __('Item not found in cart')
]);
} }
$qty = $request->qty ?? $cart->qty; $qty = $request->qty ?? $cart->qty;
if ($qty < 0) { if ($qty < 0) {
return response()->json([ return response()->json(['success' => false, 'message' => __('Enter a valid quantity')]);
'success' => false,
'message' => __('Enter a valid quantity')
]);
}
// incoming serial
$incomingSerials = $request->serial_numbers ?? null;
if (is_array($incomingSerials)) {
$existingSerials = $incomingSerials;
} else {
$existingSerials = $cart->options->serial_numbers ?? [];
}
// normalize to array
if (!is_array($existingSerials)) {
$existingSerials = !empty($existingSerials) ? [$existingSerials] : [];
}
$hasSerial = $cart->options->has_serial ?? 0;
if ($hasSerial) {
$qty = count($existingSerials);
} }
Cart::update($id, [ Cart::update($id, [
'qty' => $qty, 'qty' => $qty,
'price' => round($request->price ?? $cart->price, 2), 'price' => $request->price ?? $cart->price,
'options' => [ 'options' => [
'type' => $cart->options->type, 'type' => $cart->options->type,
'expire_date' => $request->expire_date ?? $cart->options->expire_date, 'expire_date' => $request->expire_date ?? $cart->options->expire_date,
@@ -303,7 +131,6 @@ public function update(Request $request, $id)
'product_unit_id' => $cart->options->product_unit_id, 'product_unit_id' => $cart->options->product_unit_id,
'product_unit_name' => $cart->options->product_unit_name, 'product_unit_name' => $cart->options->product_unit_name,
'product_image' => $cart->options->product_image, 'product_image' => $cart->options->product_image,
'profit_percent' => $cart->options->profit_percent,
'sales_price' => $cart->options->sales_price, 'sales_price' => $cart->options->sales_price,
'discount' => $request->discount ?? $cart->options->discount, 'discount' => $request->discount ?? $cart->options->discount,
'whole_sale_price' => $cart->options->whole_sale_price, 'whole_sale_price' => $cart->options->whole_sale_price,
@@ -312,9 +139,7 @@ public function update(Request $request, $id)
'product_type' => $cart->options->product_type, 'product_type' => $cart->options->product_type,
'warehouse_id' => $cart->options->warehouse_id, 'warehouse_id' => $cart->options->warehouse_id,
'variant_name' => $cart->options->variant_name, 'variant_name' => $cart->options->variant_name,
'price_without_tax' => $cart->options->price_without_tax, 'vat_percent' => $cart->options->vat_percent,
'has_serial' => $hasSerial,
'serial_numbers' => $existingSerials,
] ]
]); ]);

View File

@@ -3,17 +3,16 @@
namespace Modules\Business\App\Http\Controllers; namespace Modules\Business\App\Http\Controllers;
use App\Events\MultiPaymentProcessed; use App\Events\MultiPaymentProcessed;
use App\Http\Controllers\Controller;
use App\Models\Branch;
use App\Models\Party;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\Sale; use App\Models\Sale;
use App\Models\SaleReturn; use App\Models\Party;
use App\Models\SaleReturnDetails;
use App\Models\Stock; use App\Models\Stock;
use App\Services\VatTransactionService; use App\Models\Branch;
use App\Models\SaleReturn;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\SaleReturnDetails;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
class SaleReturnController extends Controller class SaleReturnController extends Controller
{ {
@@ -85,67 +84,47 @@ public function create(Request $request)
return view('business::sale-returns.create', compact('sale', 'discount_per_unit_factor', 'avg_rounding_amount', 'payment_types')); return view('business::sale-returns.create', compact('sale', 'discount_per_unit_factor', 'avg_rounding_amount', 'payment_types'));
} }
public function store(Request $request) public function store(Request $request)
{ {
// split-array structure from front-end request
$products = [];
for ($index = 0; $index < count($request->products); $index += 3) {
$products[] = [
'detail_id' => $request->products[$index]['detail_id'] ?? null,
'return_qty' => $request->products[$index + 1]['return_qty'] ?? 0,
'serial_numbers' => $request->products[$index + 2]['serial_numbers'] ?? '[]',
];
}
$request->merge(['products' => $products]);
$request->validate([ $request->validate([
'sale_id' => 'required|exists:sales,id', 'sale_id' => 'required|exists:sales,id',
'products' => 'required|array|min:1', 'return_qty' => 'required|array',
'products.*.detail_id' => 'required|exists:sale_details,id',
'products.*.return_qty' => 'required|integer',
'products.*.serial_numbers' => 'nullable|string',
]); ]);
$business_id = auth()->user()->business_id; $business_id = auth()->user()->business_id;
DB::beginTransaction(); DB::beginTransaction();
try { try {
// Load sale with details and product info $sale = Sale::with('details:id,sale_id,product_id,price,discount,lossProfit,quantities,productPurchasePrice,stock_id,expire_date', 'details.product:id,product_type', 'details.product.combo_products')
$sale = Sale::with(
'details:id,sale_id,product_id,price,discount,lossProfit,quantities,productPurchasePrice,stock_id,expire_date,serial_numbers',
'details.product:id,product_type,has_serial',
'details.product.combo_products'
)
->where('business_id', $business_id) ->where('business_id', $business_id)
->findOrFail($request->sale_id); ->findOrFail($request->sale_id);
$old_sale_due = $sale->dueAmount; // Calculate total discount factor with itemwise discount
// Calculate discount factors
$total_discount = $sale->discountAmount; $total_discount = $sale->discountAmount;
$total_sale_amount = $sale->details->sum(fn($detail) => $detail->price * $detail->quantities); $total_sale_amount = $sale->details->sum(fn($detail) => $detail->price * $detail->quantities);
$discount_per_unit_factor = $total_sale_amount > 0 ? $total_discount / $total_sale_amount : 0; $discount_per_unit_factor = $total_sale_amount > 0 ? $total_discount / $total_sale_amount : 0;
$rounding_amount_per_unit = $sale->details->sum('quantities') > 0 ? $sale->rounding_amount / $sale->details->sum('quantities') : 0; $rounding_amount_per_unit = $sale->details->sum('quantities') > 0 ? $sale->rounding_amount / $sale->details->sum('quantities') : 0;
// Create sale return record
$sale_return = SaleReturn::create([ $sale_return = SaleReturn::create([
'return_date' => now(),
'business_id' => $business_id, 'business_id' => $business_id,
'sale_id' => $request->sale_id, 'sale_id' => $request->sale_id,
'invoice_no' => $sale->invoiceNumber, 'invoice_no' => $sale->invoiceNumber,
'return_date' => now(),
]); ]);
$sale_return_detail_data = [];
$total_return_amount = 0; $total_return_amount = 0;
$total_return_discount = 0; $total_return_discount = 0;
$total_return_vat = 0;
$total_loss_profit_adjustment = 0; $total_loss_profit_adjustment = 0;
foreach ($request->products as $indextem) { foreach ($sale->details as $key => $detail) {
$requested_qty = $request->return_qty[$key];
$detail = $sale->details->where('id', $indextem['detail_id'])->first(); if ($requested_qty <= 0) {
if (!$detail) continue; // skip if detail not found continue;
}
$requested_qty = (int) ($indextem['return_qty'] ?? 0);
if ($requested_qty <= 0) continue;
if ($requested_qty > $detail->quantities) { if ($requested_qty > $detail->quantities) {
return response()->json([ return response()->json([
@@ -153,78 +132,63 @@ public function store(Request $request)
], 400); ], 400);
} }
$return_serials = !empty($indextem['serial_numbers']) ? json_decode($indextem['serial_numbers'], true) : []; $product = $detail->product;
// Include SaleDetails discount in return calculation // Include SaleDetails discount in return calculation
$unit_discount = $detail->price * $discount_per_unit_factor; $unit_discount = $detail->price * $discount_per_unit_factor;
$indextem_cart_discount = $detail->discount ?? 0; $item_cart_discount = $detail->discount ?? 0;
$total_discount_per_unit = $unit_discount + $indextem_cart_discount; $total_discount_per_unit = $unit_discount + $item_cart_discount;
// Calculate VAT for the item
$item_vat_percent = $detail->product->vat->rate ?? 0;
$item_vat_amount = ($detail->price * $item_vat_percent) / 100;
$return_discount = $total_discount_per_unit * $requested_qty; $return_discount = $total_discount_per_unit * $requested_qty;
$return_amount = ($detail->price - $total_discount_per_unit + $rounding_amount_per_unit) * $requested_qty; $return_amount = ($detail->price - $total_discount_per_unit + $rounding_amount_per_unit + $item_vat_amount) * $requested_qty;
$total_return_amount += $return_amount; $total_return_amount += $return_amount;
$total_return_discount += $return_discount; $total_return_discount += $return_discount;
$total_return_vat += ($item_vat_amount * $requested_qty);
$product = $detail->product;
// Combo products
if ($product && $product->product_type === 'combo') { if ($product && $product->product_type === 'combo') {
$combo_total_purchase = 0;
$combo_total_sale = $detail->price * $requested_qty;
foreach ($product->combo_products as $comboItem) { foreach ($product->combo_products as $comboItem) {
$stock = Stock::find($comboItem->stock_id); $stock = Stock::find($comboItem->stock_id);
if (!$stock) { if (!$stock) {
return response()->json([ return response()->json([
'message' => __("Stock not found for combo item '{$comboItem->product->productName}'"), 'message' => __("Stock not found for combo item '{$comboItem->product->productName}'"),
], 400); ], 400);
} }
// increase stock by combo component quantity * returned qty
$restore_qty = $comboItem->quantity * $requested_qty; $restore_qty = $comboItem->quantity * $requested_qty;
$stock->increment('productStock', $restore_qty); $stock->increment('productStock', $restore_qty);
$combo_total_purchase += $comboItem->purchase_price * $restore_qty;
} }
// loss/profit adjustment for combo
$loss_profit_adjustment = ($combo_total_sale - $combo_total_purchase) - $return_discount;
$total_loss_profit_adjustment += $loss_profit_adjustment;
} }
// Single / variant products
else { else {
$stock = Stock::where('id', $detail->stock_id)->first(); $stock = Stock::where('id', $detail->stock_id)->first();
if (!$stock) return response()->json(['error' => 'Stock not found.'], 404); if (!$stock) {
return response()->json(['error' => 'Stock not found.'], 404);
if ($product->has_serial) {
// Validate serial count
if (count($return_serials) !== $requested_qty) {
return response()->json([
'message' => 'Serial count must match return quantity'
], 400);
} }
$sold_serials = is_array($detail->serial_numbers) ? $detail->serial_numbers : json_decode($detail->serial_numbers ?? '[]', true);
$indexnvalid = array_diff($return_serials, $sold_serials);
if (!empty($indexnvalid)) {
return response()->json(['message' => 'Invalid serial detected'], 400);
}
// Restore stock
$stock->increment('productStock', $requested_qty); $stock->increment('productStock', $requested_qty);
// Restore serials to stock $loss_profit_adjustment = (($detail->price - $stock->productPurchasePrice) * $requested_qty) - $return_discount;
$stock_serials = $stock->serial_numbers ?? [];
$stock->update([
'serial_numbers' => array_values(array_unique(array_merge($stock_serials, $return_serials)))
]);
// Remove serials from sale detail
$detail->update([
'serial_numbers' => array_values(array_diff($sold_serials, $return_serials))
]);
} else {
$stock->increment('productStock', $requested_qty);
}
}
$loss_profit_adjustment = $detail->lossProfit * ($requested_qty / $detail->quantities);
$total_loss_profit_adjustment += $loss_profit_adjustment; $total_loss_profit_adjustment += $loss_profit_adjustment;
}
// Update sale detail // Update sale details
$detail->quantities -= $requested_qty; $detail->quantities -= $requested_qty;
$detail->lossProfit -= $loss_profit_adjustment; $detail->lossProfit -= $loss_profit_adjustment;
$detail->timestamps = false; $detail->timestamps = false;
@@ -236,21 +200,22 @@ public function store(Request $request)
'sale_return_id' => $sale_return->id, 'sale_return_id' => $sale_return->id,
'return_qty' => $requested_qty, 'return_qty' => $requested_qty,
'return_amount' => $return_amount, 'return_amount' => $return_amount,
'serial_numbers' => $return_serials ?? null,
]); ]);
$previous_returned_qty = SaleReturnDetails::where('sale_detail_id', $detail->id)->sum('return_qty'); // Record VAT transaction for the return
$totalQty = $detail->quantities + $previous_returned_qty; if (class_exists('App\Services\VatTransactionService')) {
$totalQty = $detail->quantities + $requested_qty; // Original quantity before this return decrement
VatTransactionService::productReturnVatCalculation($detail, $requested_qty, $returnDetail, $totalQty); \App\Services\VatTransactionService::productReturnVatCalculation($detail, $requested_qty, $returnDetail, $totalQty);
}
} }
if ($total_return_amount <= 0) { if ($total_return_amount <= 0) {
return response()->json("You cannot return an empty product.", 400); return response()->json("You cannot return an empty product.", 400);
} }
// Remaining refund / party logic
$remaining_refund = $total_return_amount; $remaining_refund = $total_return_amount;
// Adjust Due
$new_due = $sale->dueAmount; $new_due = $sale->dueAmount;
if ($remaining_refund > 0) { if ($remaining_refund > 0) {
if ($remaining_refund >= $sale->dueAmount) { if ($remaining_refund >= $sale->dueAmount) {
@@ -262,6 +227,7 @@ public function store(Request $request)
} }
} }
// Adjust Paid (refund part)
$new_paid = $sale->paidAmount; $new_paid = $sale->paidAmount;
if ($remaining_refund > 0) { if ($remaining_refund > 0) {
if ($remaining_refund >= $sale->paidAmount) { if ($remaining_refund >= $sale->paidAmount) {
@@ -273,49 +239,53 @@ public function store(Request $request)
} }
} }
// total sale amount
$new_total_amount = max(0, $sale->totalAmount - $total_return_amount); $new_total_amount = max(0, $sale->totalAmount - $total_return_amount);
$sale->update([ $sale->update([
'change_amount' => 0, 'change_amount' => 0,
'dueAmount' => $new_due, 'dueAmount' => $new_due,
'paidAmount' => $new_paid, 'paidAmount' => $new_paid,
'totalAmount' => $new_total_amount, 'totalAmount' => $new_total_amount,
'actual_total_amount' => $new_total_amount, 'actual_total_amount' => $new_total_amount,
'vat_amount' => max(0, $sale->vat_amount - $total_return_vat),
'discountAmount' => max(0, $sale->discountAmount - $total_return_discount), 'discountAmount' => max(0, $sale->discountAmount - $total_return_discount),
'lossProfit' => $sale->lossProfit - $total_loss_profit_adjustment, 'lossProfit' => $sale->lossProfit - $total_loss_profit_adjustment,
]); ]);
// Party refund logic // Party Refund Logic
$due_reduction = $old_sale_due - $new_due; $party = Party::find($sale->party_id);
if ($due_reduction > 0) { if ($party) {
Party::where('business_id', $business_id)
->where('id', $sale->party_id)
->decrement('due', $due_reduction);
}
$party = Party::where('business_id', $business_id)->find($sale->party_id); // use leftover refund after due/paid adjustments
$refund_amount = $remaining_refund;
if ($party && $remaining_refund > 0) {
// Reduce party due
if ($party->due > 0) { if ($party->due > 0) {
if ($party->due >= $refund_amount) {
if ($party->due >= $remaining_refund) { $party->decrement('due', $refund_amount);
$party->decrement('due', $remaining_refund); $refund_amount = 0;
$remaining_refund = 0;
} else { } else {
$remaining_refund -= $party->due; $refund_amount -= $party->due;
$party->update(['due' => 0]); $party->update(['due' => 0]);
} }
} }
if ($remaining_refund > 0) { // Add leftover refund to wallet
$party->increment('wallet', $remaining_refund); if ($refund_amount > 0) {
$party->increment('wallet', $refund_amount);
} }
} }
// Payment event $payments = $request->payments;
$payments = $request->payments ?? [];
if (isset($payments['main'])) {
$mainPayment = $payments['main'];
$mainPayment['amount'] = $request->receive_amount ?? 0;
$payments = [$mainPayment];
}
$payments = collect($payments)->map(function ($payment) use ($total_return_amount) { $payments = collect($payments)->map(function ($payment) use ($total_return_amount) {
$payment['amount'] = $total_return_amount; $payment['amount'] = $total_return_amount;
return $payment; return $payment;
@@ -325,22 +295,20 @@ public function store(Request $request)
$payments, $payments,
$sale_return->id, $sale_return->id,
'sale_return', 'sale_return',
$total_return_amount, $total_return_amount ?? 0,
)); ));
$tax_invoice = moduleCheck('TaxInvoiceAddon') && invoice_setting($sale->business_id) == 'standard_a4';
$invoice_route = $tax_invoice ? route('business.sales.tax.invoice', $sale->id) : route('business.sales.invoice', $sale->id);
DB::commit(); DB::commit();
return response()->json([ return response()->json([
'message' => __('Sale returned successfully.'), 'message' => __('Sale returned successfully.'),
'redirect' => route('business.sale-returns.index'), 'redirect' => route('business.sale-returns.index'),
'secondary_redirect_url' => $invoice_route, 'secondary_redirect_url' => route('business.sales.invoice', $sale->id),
]); ]);
} catch (\Exception $e) { } catch (\Exception $e) {
DB::rollback(); DB::rollback();
return response()->json(['message' => __('Something went wrong!') . ' ' . $e->getMessage()], 500); return response()->json(['message' => __('Something went wrong!')], 500);
} }
} }
} }

View File

@@ -20,23 +20,7 @@ class="bulk_cart_upload_form">
<div class="bulk-upload-container w-100"> <div class="bulk-upload-container w-100">
<div class="d-flex justify-content-between align-items-center w-100"> <div class="d-flex justify-content-between align-items-center w-100">
<div class="bulk-input w-100"> <div class="bulk-input w-100">
<div class="row align-items-center"> <input class="form-control" type="file" name="file" required>
<div class="col-lg-12">
<div class="custom-upload-wrapper">
<div class="custom-file-box">
<div class="custom-file-content">
<svg width="30" height="30" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 5V19M5 12H19" stroke="#4B5563" stroke-width="2.0" stroke-linecap="round"/>
</svg>
<span class="custom-upload-text">{{ __('Add File') }}</span>
</div>
<p class="preview-file d-none"></p>
<input type="file" name="file" class="preview-file-input" required>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
<div class="d-flex align-items-center justify-content-center gap-2 flex-wrap"> <div class="d-flex align-items-center justify-content-center gap-2 flex-wrap">

View File

@@ -19,23 +19,7 @@
<div class="bulk-upload-container w-100"> <div class="bulk-upload-container w-100">
<div class="d-flex justify-content-between align-items-center w-100"> <div class="d-flex justify-content-between align-items-center w-100">
<div class="bulk-input w-100"> <div class="bulk-input w-100">
<div class="row align-items-center"> <input class="form-control w-100" type="file" name="file" required>
<div class="col-lg-12">
<div class="custom-upload-wrapper">
<div class="custom-file-box">
<div class="custom-file-content">
<svg width="30" height="30" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 5V19M5 12H19" stroke="#4B5563" stroke-width="2.0" stroke-linecap="round"/>
</svg>
<span class="custom-upload-text">{{ __('Add File') }}</span>
</div>
<p class="preview-file d-none"></p>
<input type="file" name="file" class="preview-file-input" required>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
<div class="d-flex align-items-center justify-content-center gap-2 flex-wrap"> <div class="d-flex align-items-center justify-content-center gap-2 flex-wrap">

View File

@@ -2,13 +2,7 @@
@php @php
$modules = product_setting()->modules ?? []; $modules = product_setting()->modules ?? [];
@endphp @endphp
<tr <tr data-row_id="{{ $cart->rowId }}" data-update_route="{{ route('business.carts.update', $cart->rowId) }}" data-destroy_route="{{ route('business.carts.destroy', $cart->rowId) }}">
data-row_id="{{ $cart->rowId }}"
data-product_id="{{ $cart->id }}"
data-has_serial="{{ $cart->options->has_serial ?? 0 }}"
data-serials='@json($cart->options->serial_numbers ?? [])'
data-update_route="{{ route('business.carts.update', $cart->rowId) }}"
data-destroy_route="{{ route('business.carts.destroy', $cart->rowId) }}">
<td class='text-start '> <td class='text-start '>
<img class="table-img" src="{{ asset($cart->options->product_image ?? 'assets/images/products/box.svg') }}"> <img class="table-img" src="{{ asset($cart->options->product_image ?? 'assets/images/products/box.svg') }}">
</td> </td>
@@ -23,9 +17,9 @@
@if (is_module_enabled($modules, 'show_product_expire_date')) @if (is_module_enabled($modules, 'show_product_expire_date'))
<td> <td>
@if (isset($modules['expire_date_type']) && ($modules['expire_date_type'] == 'dmy' || is_null($modules['expire_date_type']))) @if (isset($modules['expire_date_type']) && ($modules['expire_date_type'] == 'dmy' || is_null($modules['expire_date_type'])))
<input type="month" name="expire_date" value="{{ date('Y-m', strtotime($cart->options->expire_date ?? '')) }}" class="form-control expire_date">
@else
<input type="date" name="expire_date" value="{{ date('Y-m-d', strtotime($cart->options->expire_date ?? '')) }}" class="form-control expire_date"> <input type="date" name="expire_date" value="{{ date('Y-m-d', strtotime($cart->options->expire_date ?? '')) }}" class="form-control expire_date">
@else
<input type="month" name="expire_date" value="{{ date('Y-m', strtotime($cart->options->expire_date ?? '')) }}" class="form-control expire_date">
@endif @endif
</td> </td>
@endif @endif
@@ -34,27 +28,13 @@
<input type="number" step="any" value="{{ $cart->price }}" class="custom-number-input price" placeholder="{{ __('0') }}"> <input type="number" step="any" value="{{ $cart->price }}" class="custom-number-input price" placeholder="{{ __('0') }}">
</td> </td>
@endusercan @endusercan
@if (moduleCheck('SerialCodeAddon'))
<td class="serial-cell serial-option">
<button type="button" class="serial-cell-button" @if(($cart->options->has_serial ?? 0) != 1) disabled @endif data-bs-toggle="modal" data-bs-target="#serialModal">
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 7H18" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round"/>
<path d="M23 7H23.0105" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M23 14H23.0105" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M23 21H23.0105" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4 14H18" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round"/>
<path d="M4 21H18" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round"/>
</svg>
</button>
</td>
@endif
<td class='text-start'> <td class='text-start'>
<div class="d-flex align-items-center justify-content-center gap-2"> <div class="d-flex align-items-center justify-content-center gap-2">
<button class="incre-decre minus-btn" @if(($cart->options->has_serial ?? 0) == 1) disabled @endif> <button class="incre-decre minus-btn">
<i class="fas fa-minus icon"></i> <i class="fas fa-minus icon"></i>
</button> </button>
<input type="number" step="any" value="{{ $cart->qty }}" class="dynamic-width cart-qty" @if(($cart->options->has_serial ?? 0) == 1) disabled readonly @endif> <input type="number" step="any" value="{{ $cart->qty }}" class="dynamic-width cart-qty" placeholder="{{ __('0') }}">
<button class="incre-decre plus-btn" @if(($cart->options->has_serial ?? 0) == 1) disabled @endif> <button class="incre-decre plus-btn">
<i class="fas fa-plus icon"></i> <i class="fas fa-plus icon"></i>
</button> </button>
</div> </div>

View File

@@ -97,9 +97,6 @@
@usercan('purchases.price') @usercan('purchases.price')
<th class="border table-background">{{ __('Purchase Price') }}</th> <th class="border table-background">{{ __('Purchase Price') }}</th>
@endusercan @endusercan
@if (moduleCheck('SerialCodeAddon'))
<th class="border table-background serial-option">{{ __('Serial') }}</th>
@endif
<th class="border table-background">{{ __('Qty') }}</th> <th class="border table-background">{{ __('Qty') }}</th>
<th class="border table-background">{{ __('Sub Total') }}</th> <th class="border table-background">{{ __('Sub Total') }}</th>
<th class="border table-background">{{ __('Action') }}</th> <th class="border table-background">{{ __('Action') }}</th>
@@ -150,23 +147,6 @@
<h6 class="fw-bold" id="sub_total"> <h6 class="fw-bold" id="sub_total">
{{ currency_format(0, currency: business_currency()) }}</h6> {{ currency_format(0, currency: business_currency()) }}</h6>
</div> </div>
<div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ __('Discount') }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2">
<div class="d-flex d-flex align-items-center gap-2">
<select name="discount_type" class="form-select discount_type"
id='form-ware'>
<option value="flat">{{ __('Flat') }}
({{ business_currency()->symbol }})
</option>
<option value="percent">{{ __('Percent (%)') }}</option>
</select>
</div>
<input type="number" step="any" name="discountAmount" id="discount_amount"
min="0" class="form-control right-start-input"
placeholder="{{ __('0') }}">
</div>
</div>
<div class="row save-amount-container align-items-center mb-2"> <div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat'}}</h6> <h6 class="payment-title col-6">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat'}}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2"> <div class="col-6 w-100 d-flex justify-content-between gap-2">
@@ -186,6 +166,23 @@ class="form-control right-start-input" placeholder="{{ __('0') }}"
readonly> readonly>
</div> </div>
</div> </div>
<div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ __('Discount') }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2">
<div class="d-flex d-flex align-items-center gap-2">
<select name="discount_type" class="form-select discount_type"
id='form-ware'>
<option value="flat">{{ __('Flat') }}
({{ business_currency()->symbol }})
</option>
<option value="percent">{{ __('Percent (%)') }}</option>
</select>
</div>
<input type="number" step="any" name="discountAmount" id="discount_amount"
min="0" class="form-control right-start-input"
placeholder="{{ __('0') }}">
</div>
</div>
<div class="shopping-crg-grid mb-2"> <div class="shopping-crg-grid mb-2">
<h6 class="payment-title">{{ __('Shipping Charge') }}</h6> <h6 class="payment-title">{{ __('Shipping Charge') }}</h6>
<div class=""> <div class="">
@@ -255,30 +252,25 @@ class="btn btn-category w-100">{{ __('Category') }}</a>
</div> </div>
</div> </div>
@include('business::purchases.product-modal')
<input type="hidden" id="get_product" value="{{ route('business.products.prices') }}"> <input type="hidden" id="get_product" value="{{ route('business.products.prices') }}">
<input type="hidden" id="purchase-cart" value="{{ route('business.purchases.cart') }}"> <input type="hidden" id="purchase-cart" value="{{ route('business.purchases.cart') }}">
<input type="hidden" id="clear-cart" value="{{ route('business.carts.remove-all') }}"> <input type="hidden" id="clear-cart" value="{{ route('business.carts.remove-all') }}">
<input type="hidden" id="get-product-variants" value="{{ route('business.products.variants') }}"> <input type="hidden" id="get-product-variants" value="{{ route('business.products.variants') }}">
<input type="hidden" id="has-serial-code-addon" value="{{ moduleCheck('SerialCodeAddon') }}">
<input type="hidden" id="check-serial-exist" value="{{ route('business.products.check-serial') }}">
<input type="hidden" id="profit_option" value="{{ $profit_option }}">
@endsection @endsection
@push('modal') @push('modal')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::serial-code-modal')
@endif
@include('business::purchases.calculator') @include('business::purchases.calculator')
@include('business::purchases.category-search') @include('business::purchases.category-search')
@include('business::purchases.brand-search') @include('business::purchases.brand-search')
@include('business::purchases.supplier-create') @include('business::purchases.supplier-create')
@include('business::purchases.bulk-upload.index') @include('business::purchases.bulk-upload.index')
@include('business::purchases.product-modal')
@endpush @endpush
@push('js') @push('js')
<script src="{{ asset('assets/js/custom/purchase.js') }}?v={{ time() }}"></script> <script src="{{ asset('assets/js/custom/purchase.js') }}"></script>
<script src="{{ asset('assets/js/custom/math.min.js') }}"></script> <script src="{{ asset('assets/js/custom/math.min.js') }}"></script>
<script src="{{ asset('assets/js/custom/calculator.js') }}"></script> <script src="{{ asset('assets/js/custom/calculator.js') }}"></script>
<script src="{{ asset('assets/js/choices.min.js') }}"></script> <script src="{{ asset('assets/js/choices.min.js') }}"></script>

View File

@@ -65,57 +65,19 @@
<i class="far fa-ellipsis-v"></i> <i class="far fa-ellipsis-v"></i>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
@usercan('purchases.read') @usercan('purchases.read')
<li> <li>
<a target="_blank" href="{{ route('business.purchases.invoice', $purchase->id) }}"> <a target="_blank" href="{{ route('business.purchases.invoice', $purchase->id) }}">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <img src="{{ asset('assets/images/icons/Invoic.svg') }}" alt="">
<path d="M2.66602 12.4331V5.37211C2.66602 3.46944 2.66602 2.5181 3.2518 1.92702C3.83759 1.33594 4.7804 1.33594 6.66602 1.33594H9.33268C11.2183 1.33594 12.1611 1.33594 12.7469 1.92702C13.3327 2.5181 13.3327 3.46944 13.3327 5.37211V12.4331C13.3327 13.4409 13.3327 13.9448 13.0247 14.1431C12.5214 14.4673 11.7434 13.7875 11.3521 13.5408C11.0287 13.3369 10.8671 13.2349 10.6877 13.2291C10.4938 13.2227 10.3293 13.3205 9.97995 13.5408L8.70602 14.3442C8.36235 14.5609 8.19055 14.6693 7.99935 14.6693C7.80815 14.6693 7.63635 14.5609 7.29268 14.3442L6.01877 13.5408C5.69545 13.3369 5.53379 13.2349 5.35437 13.2291C5.1605 13.2227 4.99597 13.3205 4.6466 13.5408C4.25532 13.7875 3.47726 14.4673 2.97398 14.1431C2.66602 13.9448 2.66602 13.4409 2.66602 12.4331Z" stroke="#4B5563" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M10.6673 4H5.33398" stroke="#4B5563" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M6.66732 6.66406H5.33398" stroke="#4B5563" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M9.66602 6.58333C9.11375 6.58333 8.66602 6.97507 8.66602 7.45833C8.66602 7.9416 9.11375 8.33333 9.66602 8.33333C10.2183 8.33333 10.666 8.72507 10.666 9.20833C10.666 9.6916 10.2183 10.0833 9.66602 10.0833M9.66602 6.58333C10.1014 6.58333 10.4718 6.8268 10.6091 7.16667M9.66602 6.58333V6M9.66602 10.0833C9.23062 10.0833 8.86022 9.83987 8.72295 9.5M9.66602 10.0833V10.6667" stroke="#4B5563" stroke-width="1.25" stroke-linecap="round"/>
</svg>
{{ __('Invoice') }} {{ __('Invoice') }}
</a> </a>
</li> </li>
@endusercan @endusercan
@usercan('purchases.read')
@php
$useTaxInvoice = moduleCheck('TaxInvoiceAddon') && invoice_setting($purchase->business_id) == 'standard_a4';
@endphp
@if($useTaxInvoice)
<li>
<a target="_blank" href="{{ route('business.purchases.tax.invoice', $purchase->id) }}">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_40008374_151568)">
<path d="M15.012 1.5C14.177 1.5 13.5 3.51472 13.5 6H15.012C15.7407 6 16.105 6 16.3306 5.74841C16.5562 5.49682 16.5169 5.1655 16.4384 4.50286C16.2311 2.75357 15.6707 1.5 15.012 1.5Z" stroke="#4D4D4D" stroke-width="1.25"/>
<path d="M13.5 6.0407V13.9844C13.5 15.1181 13.5 15.685 13.1535 15.9081C12.5873 16.2728 11.7121 15.5081 11.2718 15.2305C10.9081 15.0011 10.7263 14.8864 10.5244 14.8798C10.3063 14.8726 10.1212 14.9826 9.72817 15.2305L8.295 16.1343C7.90838 16.3781 7.7151 16.5 7.5 16.5C7.28491 16.5 7.09159 16.3781 6.705 16.1343L5.27185 15.2305C4.90811 15.0011 4.72624 14.8864 4.5244 14.8798C4.30629 14.8726 4.1212 14.9826 3.72815 15.2305C3.28796 15.5081 2.41265 16.2728 1.84646 15.9081C1.5 15.685 1.5 15.1181 1.5 13.9844V6.0407C1.5 3.90019 1.5 2.82994 2.15901 2.16497C2.81802 1.5 3.87868 1.5 6 1.5H15" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M7.5 6C6.67157 6 6 6.50368 6 7.125C6 7.7463 6.67157 8.25 7.5 8.25C8.32845 8.25 9 8.7537 9 9.375C9 9.9963 8.32845 10.5 7.5 10.5M7.5 6C8.1531 6 8.7087 6.31305 8.91465 6.75M7.5 6V5.25M7.5 10.5C6.84689 10.5 6.29127 10.1869 6.08535 9.75M7.5 10.5V11.25" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round"/>
</g>
<defs>
<clipPath id="clip0_40008374_151568">
<rect width="18" height="18" fill="white"/>
</clipPath>
</defs>
</svg>
{{ __('Tax Invoice') }}
</a>
</li>
@endif
@endusercan
@usercan('purchase-returns.read') @usercan('purchase-returns.read')
<li> <li>
<a <a
href="{{ route('business.purchase-returns.create', ['purchase_id' => $purchase->id]) }}"> href="{{ route('business.purchase-returns.create', ['purchase_id' => $purchase->id]) }}">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <i class="fal fa-undo-alt"></i>
<path d="M2.25 9.75V6H15.75V9.75C15.75 12.5784 15.75 13.9927 14.8713 14.8713C13.9927 15.75 12.5784 15.75 9.75 15.75H8.25C5.42157 15.75 4.00736 15.75 3.12868 14.8713C2.25 13.9927 2.25 12.5784 2.25 9.75Z" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M2.25 6L2.89904 4.55769C3.40241 3.4391 3.65408 2.87981 4.16423 2.5649C4.67438 2.25 5.32875 2.25 6.6375 2.25H11.3625C12.6712 2.25 13.3256 2.25 13.8358 2.5649C14.3459 2.87981 14.5976 3.4391 15.1009 4.55769L15.75 6" stroke="#4B5563" stroke-linecap="round"/>
<path d="M9 6V2.25" stroke="#4B5563" stroke-linecap="round"/>
<path d="M6.375 10.125H10.5C11.3284 10.125 12 10.7966 12 11.625C12 12.4534 11.3284 13.125 10.5 13.125H9.75M7.5 8.625L6 10.125L7.5 11.625" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
{{ __('Purchase Return') }} {{ __('Purchase Return') }}
</a> </a>
</li> </li>
@@ -147,13 +109,19 @@
data-url="{{ route('business.view-payment', ['type' => 'purchase', 'id' => $purchase->id]) }}" data-url="{{ route('business.view-payment', ['type' => 'purchase', 'id' => $purchase->id]) }}"
class="view-payment-btn" data-bs-toggle="modal" class="view-payment-btn" data-bs-toggle="modal"
data-bs-target="#view-payment-modal"> data-bs-target="#view-payment-modal">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="18" height="18" viewBox="0 0 18 18" fill="none"
<path d="M3 13.9844V6.0407C3 3.90019 3 2.82994 3.65901 2.16497C4.31802 1.5 5.37868 1.5 7.5 1.5H10.5C12.6213 1.5 13.6819 1.5 14.341 2.16497C15 2.82994 15 3.90019 15 6.0407V13.9844C15 15.1181 15 15.685 14.6535 15.9081C14.0873 16.2728 13.2121 15.5081 12.7718 15.2305C12.4081 15.0011 12.2263 14.8864 12.0244 14.8798C11.8063 14.8726 11.6212 14.9826 11.2282 15.2305L9.795 16.1343C9.40838 16.3781 9.2151 16.5 9 16.5C8.7849 16.5 8.59162 16.3781 8.205 16.1343L6.77185 15.2305C6.40811 15.0011 6.22624 14.8864 6.0244 14.8798C5.80629 14.8726 5.6212 14.9826 5.22815 15.2305C4.78796 15.5081 3.91265 16.2728 3.34646 15.9081C3 15.685 3 15.1181 3 13.9844Z" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/> xmlns="http://www.w3.org/2000/svg">
<path d="M12 4H6" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/> <path
<path d="M11 7H6" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/> d="M3 13.9844V6.0407C3 3.90019 3 2.82994 3.65901 2.16497C4.31802 1.5 5.37868 1.5 7.5 1.5H10.5C12.6213 1.5 13.6819 1.5 14.341 2.16497C15 2.82994 15 3.90019 15 6.0407V13.9844C15 15.1181 15 15.685 14.6535 15.9081C14.0873 16.2728 13.2121 15.5081 12.7718 15.2305C12.4081 15.0011 12.2263 14.8864 12.0244 14.8798C11.8063 14.8726 11.6212 14.9826 11.2282 15.2305L9.795 16.1343C9.40838 16.3781 9.2151 16.5 9 16.5C8.7849 16.5 8.59162 16.3781 8.205 16.1343L6.77185 15.2305C6.40811 15.0011 6.22624 14.8864 6.0244 14.8798C5.80629 14.8726 5.6212 14.9826 5.22815 15.2305C4.78796 15.5081 3.91265 16.2728 3.34646 15.9081C3 15.685 3 15.1181 3 13.9844Z"
<path d="M9 10H6" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/> stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round" />
<path d="M12 4.5H6" stroke="#4B5563" stroke-linecap="round"
stroke-linejoin="round" />
<path d="M7.5 7.5H6" stroke="#4B5563" stroke-linecap="round"
stroke-linejoin="round" />
<path
d="M10.875 7.40625C10.2537 7.40625 9.75 7.84695 9.75 8.39063C9.75 8.9343 10.2537 9.375 10.875 9.375C11.4963 9.375 12 9.8157 12 10.3594C12 10.9031 11.4963 11.3438 10.875 11.3438M10.875 7.40625C11.3648 7.40625 11.7815 7.68015 11.936 8.0625M10.875 7.40625V6.75M10.875 11.3438C10.3852 11.3438 9.96847 11.0699 9.81405 10.6875M10.875 11.3438V12"
stroke="#4B5563" stroke-linecap="round" />
</svg> </svg>
{{ __('View Payment') }} {{ __('View Payment') }}
</a> </a>
</li> </li>
@@ -161,10 +129,7 @@ class="view-payment-btn" data-bs-toggle="modal"
@usercan('purchases.read') @usercan('purchases.read')
<li> <li>
<a href="{{ route('business.purchases.edit', $purchase->id) }}"> <a href="{{ route('business.purchases.edit', $purchase->id) }}">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <i class="fal fa-edit"></i>
<path d="M12.1606 3.73679L13.2119 2.68547C13.7925 2.10484 14.7339 2.10484 15.3145 2.68547C15.8951 3.2661 15.8951 4.20748 15.3145 4.78811L14.2632 5.83943M12.1606 3.73679L8.23515 7.66222C7.4512 8.4462 7.05919 8.83815 6.79228 9.31582C6.52535 9.7935 6.2568 10.9214 6 12C7.07857 11.7432 8.2065 11.4746 8.68418 11.2077C9.16185 10.9408 9.5538 10.5488 10.3378 9.76485L14.2632 5.83943M12.1606 3.73679L14.2632 5.83943" stroke="#4B5563" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M15.75 9C15.75 12.1819 15.75 13.773 14.7615 14.7615C13.773 15.75 12.1819 15.75 9 15.75C5.81802 15.75 4.22703 15.75 3.23851 14.7615C2.25 13.773 2.25 12.1819 2.25 9C2.25 5.81802 2.25 4.22703 3.23851 3.23851C4.22703 2.25 5.81802 2.25 9 2.25" stroke="#4B5563" stroke-width="1.2" stroke-linecap="round"/>
</svg>
{{ __('Edit') }} {{ __('Edit') }}
</a> </a>
</li> </li>
@@ -173,12 +138,7 @@ class="view-payment-btn" data-bs-toggle="modal"
<li> <li>
<a href="{{ route('business.purchases.destroy', $purchase->id) }}" <a href="{{ route('business.purchases.destroy', $purchase->id) }}"
class="confirm-action" data-method="DELETE"> class="confirm-action" data-method="DELETE">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <i class="fal fa-trash-alt"></i>
<path d="M14.625 4.125L14.1602 11.6438C14.0414 13.5648 13.9821 14.5253 13.5006 15.2159C13.2625 15.5573 12.956 15.8455 12.6005 16.062C11.8816 16.5 10.9192 16.5 8.99452 16.5C7.06734 16.5 6.10372 16.5 5.38429 16.0612C5.0286 15.8443 4.722 15.5556 4.48401 15.2136C4.00266 14.5219 3.94459 13.5601 3.82846 11.6364L3.375 4.125" stroke="#4B5563" stroke-width="1.2" stroke-linecap="round"/>
<path d="M6.75 8.79688H11.25" stroke="#4B5563" stroke-width="1.2" stroke-linecap="round"/>
<path d="M7.875 11.7422H10.125" stroke="#4B5563" stroke-width="1.2" stroke-linecap="round"/>
<path d="M2.25 4.125H15.75M12.0416 4.125L11.5297 3.0688C11.1896 2.3672 11.0195 2.01639 10.7261 1.79761C10.6611 1.74908 10.5922 1.7059 10.5201 1.66852C10.1953 1.5 9.80542 1.5 9.02572 1.5C8.22645 1.5 7.82685 1.5 7.49662 1.67559C7.42343 1.71451 7.35359 1.75943 7.28783 1.80988C6.99109 2.03753 6.82533 2.40116 6.49381 3.12844L6.03955 4.125" stroke="#4B5563" stroke-width="1.2" stroke-linecap="round"/>
</svg>
{{ __('Delete') }} {{ __('Delete') }}
</a> </a>
</li> </li>

View File

@@ -98,9 +98,6 @@ class='dashboard-btn d-flex align-items-center gap-1'>
@usercan('purchases.price') @usercan('purchases.price')
<th class="border table-background">{{ __('Purchase Price') }}</th> <th class="border table-background">{{ __('Purchase Price') }}</th>
@endusercan @endusercan
@if (moduleCheck('SerialCodeAddon'))
<th class="border table-background serial-option">{{ __('Serial') }}</th>
@endif
<th class="border table-background">{{ __('Qty') }}</th> <th class="border table-background">{{ __('Qty') }}</th>
<th class="border table-background">{{ __('Sub Total') }}</th> <th class="border table-background">{{ __('Sub Total') }}</th>
<th class="border table-background">{{ __('Action') }}</th> <th class="border table-background">{{ __('Action') }}</th>
@@ -153,23 +150,6 @@ class="form-control receive_amount"
<h6>{{ __('Sub Total') }}</h6> <h6>{{ __('Sub Total') }}</h6>
<h6 class="fw-bold" id="sub_total">{{ currency_format(0) }}</h6> <h6 class="fw-bold" id="sub_total">{{ currency_format(0) }}</h6>
</div> </div>
<div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ __('Discount') }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2">
<div class="d-flex d-flex align-items-center gap-2">
<select name="discount_type" class="form-select discount_type" id='form-ware'>
<option value="flat" @selected($purchase->discount_type == 'flat')>{{ __('Flat') }}
({{ business_currency()->symbol }})
</option>
<option value="percent" @selected($purchase->discount_type == 'percent')>{{ __('Percent (%)') }}</option>
</select>
</div>
<input type="number" step="any" name="discountAmount"
value="{{ $purchase->discount_type == 'percent' ? $purchase->discount_percent : $purchase->discountAmount }}"
id="discount_amount" min="0" class="form-control right-start-input" placeholder="{{ __('0') }}">
</div>
</div>
<div class="row save-amount-container align-items-center mb-2"> <div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6> <h6 class="payment-title col-6">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2"> <div class="col-6 w-100 d-flex justify-content-between gap-2">
@@ -189,6 +169,23 @@ class="form-control receive_amount"
</div> </div>
</div> </div>
<div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ __('Discount') }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2">
<div class="d-flex d-flex align-items-center gap-2">
<select name="discount_type" class="form-select discount_type" id='form-ware'>
<option value="flat" @selected($purchase->discount_type == 'flat')>{{ __('Flat') }}
({{ business_currency()->symbol }})
</option>
<option value="percent" @selected($purchase->discount_type == 'percent')>{{ __('Percent (%)') }}</option>
</select>
</div>
<input type="number" step="any" name="discountAmount"
value="{{ $purchase->discount_type == 'percent' ? $purchase->discount_percent : $purchase->discountAmount }}"
id="discount_amount" min="0" class="form-control right-start-input" placeholder="{{ __('0') }}">
</div>
</div>
<div class="shopping-crg-grid mb-2"> <div class="shopping-crg-grid mb-2">
<h6 class="">{{ __('Shipping Charge') }}</h6> <h6 class="">{{ __('Shipping Charge') }}</h6>
<div class=""> <div class="">
@@ -256,30 +253,22 @@ class="btn btn-category w-100">{{ __('Category') }}</a>
</div> </div>
</div> </div>
@include('business::purchases.product-modal')
<input type="hidden" id="get_product" value="{{ route('business.products.prices') }}"> <input type="hidden" id="get_product" value="{{ route('business.products.prices') }}">
<input type="hidden" value="{{ route('business.purchases.cart') }}" id="purchase-cart"> <input type="hidden" value="{{ route('business.purchases.cart') }}" id="purchase-cart">
<input type="hidden" value="{{ route('business.carts.remove-all') }}" id="clear-cart"> <input type="hidden" value="{{ route('business.carts.remove-all') }}" id="clear-cart">
<input type="hidden" id="get-product-variants" value="{{ route('business.products.variants') }}"> <input type="hidden" id="get-product-variants" value="{{ route('business.products.variants') }}">
<input type="hidden" id="has-serial-code-addon" value="{{ moduleCheck('SerialCodeAddon') }}">
<input type="hidden" id="check-serial-exist" value="{{ route('business.products.check-serial') }}">
<input type="hidden" id="profit_option" value="{{ $profit_option }}">
@endsection @endsection
@push('modal') @push('modal')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::serial-code-modal')
@endif
@include('business::purchases.calculator') @include('business::purchases.calculator')
@include('business::purchases.category-search') @include('business::purchases.category-search')
@include('business::purchases.brand-search') @include('business::purchases.brand-search')
@include('business::purchases.product-modal')
@include('business::purchases.supplier-create')
@include('business::purchases.bulk-upload.index')
@endpush @endpush
@push('js') @push('js')
<script src="{{ asset('assets/js/custom/purchase.js') }}?v={{ time() }}"></script> <script src="{{ asset('assets/js/custom/purchase.js') }}"></script>
<script src="{{ asset('assets/js/custom/math.min.js') }}"></script> <script src="{{ asset('assets/js/custom/math.min.js') }}"></script>
<script src="{{ asset('assets/js/custom/calculator.js') }}"></script> <script src="{{ asset('assets/js/custom/calculator.js') }}"></script>
<script src="{{ asset('assets/js/choices.min.js') }}"></script> <script src="{{ asset('assets/js/choices.min.js') }}"></script>

View File

@@ -4,10 +4,6 @@
{{ __('Purchase List') }} {{ __('Purchase List') }}
@endsection @endsection
@php
$modules = product_setting()->modules ?? [];
@endphp
@section('main_content') @section('main_content')
<div class="erp-table-section"> <div class="erp-table-section">
<div class="container-fluid"> <div class="container-fluid">

View File

@@ -6,7 +6,7 @@
@section('main_content') @section('main_content')
@if (invoice_setting($purchase->business_id) == '3_inch_80mm' && moduleCheck('ThermalPrinterAddon')) @if (invoice_setting() == '3_inch_80mm' && moduleCheck('ThermalPrinterAddon'))
@include('thermalprinteraddon::purchases.3_inch_80mm') @include('thermalprinteraddon::purchases.3_inch_80mm')
@else @else
@include('business::purchases.invoices.a4-size') @include('business::purchases.invoices.a4-size')

View File

@@ -1,46 +1,33 @@
@php
$isBusinessRoute = request()->routeIs('business.purchases.*');
$business_id = $purchase->business_id;
$vat_amount = $purchase->vat_amount;
@endphp
<div class="invoice-container"> <div class="invoice-container">
<div class="invoice-content p-4 position-relative"> <div class="invoice-content p-4 position-relative">
<div class="row d-print-none py-2 d-flex align-items-start justify-content-between border-bottom print-container"> <div class="row d-print-none py-2 d-flex align-items-start justify-content-between border-bottom print-container">
<div class="col-md-3 d-flex align-items-center p-2"> <div class="col-md-6 d-flex align-items-center p-2">
<span class="Money-Receipt">{{ __('Purchase Invoice') }}</span> <span class="Money-Receipt">{{ __('Purchase Invoice') }}</span>
</div> </div>
@if($isBusinessRoute) <div class="col-md-6 d-flex justify-content-end align-items-end">
<div class="col-md-9 d-flex justify-content-start justify-content-md-end align-items-end"> <div class="d-flex gap-2 ">
<div class="d-flex gap-2 flex-wrap "> <form action="{{ route('business.purchases.mail', ['purchase_id' => $purchase->id]) }}" method="POST"
<a href="javascript:void(0)" class="pdf-btn print-btn share-btn" data-bs-toggle="modal" data-bs-target="#shareModalDues"> class="ajaxform_instant_reload">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.8303 3.75H6.96224C4.50701 3.75 3.27939 3.75 2.51665 4.48223C1.75391 5.21447 1.75391 6.39298 1.75391 8.75V12.0833C1.75391 14.4403 1.75391 15.6188 2.51665 16.3511C3.27939 17.0833 4.50701 17.0833 6.96224 17.0833H10.4678C12.923 17.0833 14.1506 17.0833 14.9133 16.3511C15.4075 15.8767 15.5815 15.2149 15.6428 14.1667" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
<path d="M13.4723 5.83073V3.20869C13.4723 3.04597 13.6097 2.91406 13.7792 2.91406C13.8605 2.91406 13.9386 2.9451 13.9962 3.00035L17.9396 6.7861C18.1362 6.97475 18.2465 7.23061 18.2465 7.4974C18.2465 7.76418 18.1362 8.02005 17.9396 8.20869L13.9962 11.9944C13.9386 12.0497 13.8605 12.0807 13.7792 12.0807C13.6097 12.0807 13.4723 11.9488 13.4723 11.7861V9.16406H10.9298C7.39583 9.16406 6.09375 12.0807 6.09375 12.0807V9.9974C6.09375 7.69621 8.03696 5.83073 10.434 5.83073H13.4723Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
</svg>
{{__('Share')}}
</a>
<form action="{{ route('business.purchases.mail', ['purchase_id' => $purchase->id]) }}" method="POST" class="ajaxform_instant_reload">
@csrf @csrf
<button type="submit" class="btn custom-print-btn submit-btn"><img class="w-10 h-10" src="{{ asset('assets/img/email.svg') }}"><span class="pl-1">{{__('Email')}}</span> </button> <button type="submit" class="btn custom-print-btn"><img class="w-10 h-10"
src="{{ asset('assets/img/email.svg') }}"><span class="pl-1">{{__('Email')}}</span> </button>
</form> </form>
<a target="_blank" href="{{ route('business.purchases.pdf', ['purchase_id' => $purchase->id]) }}" class="pdf-btn print-btn"> <a target="blank" href="{{ route('business.purchases.pdf', ['purchase_id' => $purchase->id]) }}"
class="pdf-btn print-btn">
<img class="w-10 h-10" src="{{ asset('assets/img/pdf.svg') }}"> <img class="w-10 h-10" src="{{ asset('assets/img/pdf.svg') }}">
{{__('PDF')}} {{__('PDF')}}</a>
</a> <a class="print-btn-2 print-btn" onclick="window.print()"><img class="w-10 h-10"
<a class="print-btn-2 print-btn" onclick="window.print()"><img class="w-10 h-10" src="{{ asset('assets/img/print.svg') }}">{{ __('Print') }}</a> src="{{ asset('assets/img/print.svg') }}">{{ __('Print') }}</a>
</div> </div>
</div> </div>
@endif
</div> </div>
<div class="d-flex justify-content-between align-items-center gap-3 print-logo-container"> <div class="d-flex justify-content-between align-items-center gap-3 print-logo-container">
{{-- Left Side: Logo and Content --}} {{-- Left Side: Logo and Content --}}
<div class="d-flex align-items-center gap-2 logo"> <div class="d-flex align-items-center gap-2 logo">
@if ((get_business_option('business-settings', $business_id)['show_a4_invoice_logo'] ?? 0) == 1 ) @if ((get_business_option('business-settings')['show_a4_invoice_logo'] ?? 0) == 1 )
<img class="invoice-logo" src="{{ Storage::url(get_business_option('business-settings', $business_id)['a4_invoice_logo'] ?? 'assets/images/default.svg') ?? '' }}"> <img class="invoice-logo" src="{{ asset(get_business_option('business-settings')['a4_invoice_logo'] ?? 'assets/images/default.svg') ?? '' }}">
@endif @endif
</div> </div>
@@ -109,9 +96,8 @@
</div> </div>
</div> </div>
{{-- PURCHASE + RETURN --}}
@if (!$purchase_returns->isEmpty()) @if (!$purchase_returns->isEmpty())
{{-- purchases portion --}} {{-- purchases --}}
<div class="custom-invoice-table"> <div class="custom-invoice-table">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@@ -121,48 +107,34 @@
<th class="head-black text-center">{{ __('Quantity') }}</th> <th class="head-black text-center">{{ __('Quantity') }}</th>
@usercan('purchases.price') @usercan('purchases.price')
<th class="head-black text-end">{{ __('Unit Price') }}</th> <th class="head-black text-end">{{ __('Unit Price') }}</th>
<th class="head-black text-end">{{ __('Price (exc.)') }}</th>
@endusercan @endusercan
<th class="head-black text-end">{{ __('Total Price') }}</th> <th class="head-black text-end">{{ __('Total Price') }}</th>
</tr> </tr>
</thead> </thead>
@php @php
$subtotal = 0; $subtotal = 0;
$total_product_vat = 0;
@endphp @endphp
<tbody class="in-table-body-container"> <tbody class="in-table-body-container">
@foreach ($purchase->details as $detail) @foreach ($purchase->details as $detail)
@php @php
$productTotal = ($detail->productPurchasePrice ?? 0) * ($detail->quantities ?? 0); $productTotal = ($detail->productPurchasePrice ?? 0) * ($detail->quantities ?? 0);
$exclusive_price = ($detail->price_without_tax && $detail->price_without_tax > 0) ? $detail->price_without_tax : ($detail->productPurchasePrice ?? 0); $subtotal += $productTotal;
$qty = $detail->quantities ?? 0;
$product_vat = $productTotal - ($exclusive_price * $qty ?? 1);
$total_product_vat += $product_vat;
$subtotal += $exclusive_price * ($qty ?? 1);
@endphp @endphp
<tr class="in-table-body"> <tr class="in-table-body">
<td class="text-center">{{ $loop->iteration }}</td> <td class="text-center">{{ $loop->iteration }}</td>
<td class="text-start"> <td class="text-start">
<div class="invoice-item"> <div class="invoice-item">
{{ ($detail->product->productName ?? '') . (!empty($detail->stock?->batch_no) ? ' (' . $detail->stock?->batch_no . ')' : '') }} {{ ($detail->product->productName ?? '') . (!empty($detail->stock?->batch_no) ? ' (' . $detail->stock?->batch_no . ')' : '') }}
@if(moduleCheck('SerialCodeAddon') && ($detail->product->has_serial ?? 0) == 1)
<p>{{__('Serial')}}:{{ is_array($detail->serial_numbers) ? implode(', ', $detail->serial_numbers) : $detail->serial_numbers }}
</p>
@endif
</div> </div>
</td> </td>
<td class="text-center">{{ $detail->quantities ?? '' }}</td> <td class="text-center">{{ $detail->quantities ?? '' }}</td>
@usercan('purchases.price') @usercan('purchases.price')
<td class="text-end"> <td class="text-end">
{{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency($business_id)) }} {{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency()) }}
</td>
<td class="text-end">
{{ currency_format($exclusive_price ?? 0, currency: business_currency($business_id)) }}
</td> </td>
@endusercan @endusercan
<td class="text-end"> <td class="text-end">
{{ currency_format($productTotal, currency: business_currency($business_id)) }}</td> {{ currency_format($productTotal, currency: business_currency()) }}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
@@ -187,21 +159,20 @@
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Subtotal') }}</td> <td class="text-end">{{ __('Subtotal') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end">{{ currency_format($subtotal, currency: business_currency($business_id)) }} <td class="text-end">{{ currency_format($subtotal, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ get_business_option('business-settings', $business_id)['vat_name'] ?? 'Vat' }}</td> <td class="text-end">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($vat_amount + $total_product_vat, currency: business_currency($business_id)) }} {{ currency_format($purchase->vat_amount, currency: business_currency()) }}</td>
</td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Shipping Charge') }}</td> <td class="text-end">{{ __('Shipping Charge') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($purchase->shipping_charge, currency: business_currency($business_id)) }} {{ currency_format($purchase->shipping_charge, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom border-bottom-dis"> <tr class="in-table-row-bottom border-bottom-dis">
@@ -212,14 +183,14 @@
</td> </td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($purchase->discountAmount + $total_discount, currency: business_currency($business_id)) }} {{ currency_format($purchase->discountAmount + $total_discount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end total-amound">{{ __('Total Amount') }}</td> <td class="text-end total-amound">{{ __('Total Amount') }}</td>
<td class="text-end total-amound">:</td> <td class="text-end total-amound">:</td>
<td class="text-end total-amound"> <td class="text-end total-amound">
{{ currency_format($subtotal + $total_product_vat + $vat_amount - ($purchase->discountAmount + $total_discount) + $purchase->shipping_charge, currency: business_currency($business_id)) }} {{ currency_format($subtotal + $purchase->vat_amount - ($purchase->discountAmount + $total_discount) + $purchase->shipping_charge, currency: business_currency()) }}
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -227,7 +198,7 @@
</div> </div>
</div> </div>
{{-- purchase Return portion --}} {{-- purchase Return --}}
<div class="custom-invoice-table"> <div class="custom-invoice-table">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@@ -248,19 +219,16 @@
@endphp @endphp
<tr class="in-table-body"> <tr class="in-table-body">
<td class="text-center">{{ $loop->iteration }}</td> <td class="text-center">{{ $loop->iteration }}</td>
<td class="text-start">{{ formatted_datetime($return->return_date) }}</td> <td class="text-start">{{ formatted_date($return->return_date) }}</td>
<td class="text-start"> <td class="text-start">
<div class="invoice-item"> <div class="invoice-item">
{{ $detail->purchaseDetail->product->productName ?? '' }} {{ $detail->purchaseDetail->product->productName ?? '' }}
{{ $detail->purchaseDetail?->stock?->batch_no ? '(' . $detail->purchaseDetail?->stock?->batch_no . ')' : '' }} {{ $detail->purchaseDetail?->stock?->batch_no ? '(' . $detail->purchaseDetail?->stock?->batch_no . ')' : '' }}
@if(moduleCheck('SerialCodeAddon') && ($detail->purchaseDetail->product->has_serial ?? 0) == 1)
<p>{{__('Serial')}}: {{ is_array($detail->serial_numbers) ? implode(', ', $detail->serial_numbers) : $detail->serial_numbers }}</p>
@endif
</div> </div>
</td> </td>
<td class="text-center">{{ $detail->return_qty ?? 0 }}</td> <td class="text-center">{{ $detail->return_qty ?? 0 }}</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($detail->return_amount ?? 0, currency: business_currency($business_id)) }} {{ currency_format($detail->return_amount ?? 0, currency: business_currency()) }}
</td> </td>
</tr> </tr>
@endforeach @endforeach
@@ -269,7 +237,7 @@
</table> </table>
</div> </div>
<div class="d-flex align-items-start justify-content-between position-relative bottom-info-container"> <div class="d-flex align-items-start justify-content-between position-relative bottom-info-container">
<h2 class="word-amount">{{ amountInWords($total_return_amount, business_id: $business_id) }}</h2> <h2 class="word-amount">{{ amountInWords($total_return_amount) }}</h2>
<div> <div>
<table class="table"> <table class="table">
<tbody> <tbody>
@@ -281,10 +249,10 @@
{{ $returnTransactionType ?? $purchase->paymentType ?? '' }} {{ $returnTransactionType ?? $purchase->paymentType ?? '' }}
</td> </td>
</tr> </tr>
@if ((get_business_option('business-settings', $business_id)['show_note'] ?? 0) == 1) @if ((get_business_option('business-settings')['show_note'] ?? 0) == 1)
<tr class="in-table-row"> <tr class="in-table-row">
<td class="text-start"> <td class="text-start">
{{ get_business_option('business-settings', $business_id)['note'] ?? '' }} {{ get_business_option('business-settings')['note'] ?? '' }}
</td> </td>
</tr> </tr>
@endif @endif
@@ -293,7 +261,7 @@
@if ($bank_detail->show_in_invoice ?? 0 == 1) @if ($bank_detail->show_in_invoice ?? 0 == 1)
<div class="bank-details-container"> <div class="bank-details-container">
<div class="bank-details-title"> <div class="bank-details-title">
{{__('Bank Details')}} Bank Details
</div> </div>
<div class="back-details-content"> <div class="back-details-content">
<table class="table mb-2"> <table class="table mb-2">
@@ -333,33 +301,32 @@
<td class="text-end">{{ __('Total Return Amount') }}</td> <td class="text-end">{{ __('Total Return Amount') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($total_return_amount, currency: business_currency($business_id)) }}</td> {{ currency_format($total_return_amount, currency: business_currency()) }}</td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end total-amound">{{ __('Payable Amount') }}</td> <td class="text-end total-amound">{{ __('Payable Amount') }}</td>
<td class="text-end total-amound">:</td> <td class="text-end total-amound">:</td>
<td class="text-end total-amound"> <td class="text-end total-amound">
{{ currency_format($purchase->totalAmount, currency: business_currency($business_id)) }}</td> {{ currency_format($purchase->totalAmount, currency: business_currency()) }}</td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Paid Amount') }}</td> <td class="text-end">{{ __('Paid Amount') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($purchase->paidAmount, currency: business_currency($business_id)) }}</td> {{ currency_format($purchase->paidAmount, currency: business_currency()) }}</td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Due') }}</td> <td class="text-end">{{ __('Due') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($purchase->dueAmount, currency: business_currency($business_id)) }}</td> {{ currency_format($purchase->dueAmount, currency: business_currency()) }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
{{-- ONLY PURCHASE --}}
@else @else
{{-- purchases --}}
<div class="custom-invoice-table"> <div class="custom-invoice-table">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@@ -369,54 +336,39 @@
<th class="head-black text-center">{{ __('Quantity') }}</th> <th class="head-black text-center">{{ __('Quantity') }}</th>
@usercan('purchases.price') @usercan('purchases.price')
<th class="head-black text-end">{{ __('Unit Price') }}</th> <th class="head-black text-end">{{ __('Unit Price') }}</th>
<th class="head-black text-end">{{ __('Price (exc.)') }}</th>
@endusercan @endusercan
<th class="head-black text-end">{{ __('Total Price') }}</th> <th class="head-black text-end">{{ __('Total Price') }}</th>
</tr> </tr>
</thead> </thead>
@php @php $subtotal = 0; @endphp
$subtotal = 0;
$total_product_vat = 0;
@endphp
<tbody class="in-table-body-container"> <tbody class="in-table-body-container">
@foreach ($purchase->details as $detail) @foreach ($purchase->details as $detail)
@php @php
$productTotal = ($detail->productPurchasePrice ?? 0) * ($detail->quantities ?? 0); $productTotal = ($detail->productPurchasePrice ?? 0) * ($detail->quantities ?? 0);
$exclusive_price = ($detail->price_without_tax && $detail->price_without_tax > 0) ? $detail->price_without_tax : ($detail->productPurchasePrice ?? 0); $subtotal += $productTotal;
$qty = $detail->quantities ?? 0;
$product_vat = $productTotal - ($exclusive_price * $qty ?? 1);
$total_product_vat += $product_vat;
$subtotal += $exclusive_price * ($qty ?? 1);
@endphp @endphp
<tr class="in-table-body"> <tr class="in-table-body">
<td class="text-center">{{ $loop->iteration }}</td> <td class="text-center">{{ $loop->iteration }}</td>
<td class="text-start"> <td class="text-start">
<div class="invoice-item"> <div class="invoice-item">
{{ ($detail->product->productName ?? '') . (!empty($detail->stock?->batch_no) ? ' (' . $detail->stock?->batch_no . ')' : '') }} {{ ($detail->product->productName ?? '') . (!empty($detail->stock?->batch_no) ? ' (' . $detail->stock?->batch_no . ')' : '') }}
@if(moduleCheck('SerialCodeAddon') && ($detail->product->has_serial ?? 0) == 1)
<p>{{__('Serial')}}: {{ is_array($detail->serial_numbers) ? implode(', ', $detail->serial_numbers) : $detail->serial_numbers }}</p>
@endif
</div> </div>
</td> </td>
<td class="text-center">{{ $detail->quantities ?? '' }}</td> <td class="text-center">{{ $detail->quantities ?? '' }}</td>
@usercan('purchases.price') @usercan('purchases.price')
<td class="text-end"> <td class="text-end">
{{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency($business_id)) }} {{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency()) }}
</td>
<td class="text-end">
{{ currency_format($exclusive_price ?? 0, currency: business_currency($business_id)) }}
</td> </td>
@endusercan @endusercan
<td class="text-end"> <td class="text-end">
{{ currency_format($productTotal, currency: business_currency($business_id)) }}</td> {{ currency_format($productTotal, currency: business_currency()) }}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="d-flex align-items-start justify-content-between position-relative bottom-info-container"> <div class="d-flex align-items-start justify-content-between position-relative bottom-info-container">
<h2 class="word-amount">{{ amountInWords($purchase->totalAmount, business_id: $business_id) }}</h2> <h2 class="word-amount">{{ amountInWords($subtotal) }}</h2>
<div> <div>
<table class="table"> <table class="table">
<tbody> <tbody>
@@ -428,10 +380,10 @@
{{ $transactionTypes ?? ($purchase->payment_type_id ? ($purchase->payment_type->name ?? '') : ($purchase->paymentType ?? '')) }} {{ $transactionTypes ?? ($purchase->payment_type_id ? ($purchase->payment_type->name ?? '') : ($purchase->paymentType ?? '')) }}
</td> </td>
</tr> </tr>
@if ((get_business_option('business-settings', $business_id)['show_note'] ?? 0) == 1) @if ((get_business_option('business-settings')['show_note'] ?? 0) == 1)
<tr class="in-table-row"> <tr class="in-table-row">
<td class="text-start"> <td class="text-start">
{{ get_business_option('business-settings', $business_id)['note'] ?? '' }} {{ get_business_option('business-settings')['note'] ?? '' }}
</td> </td>
</tr> </tr>
@endif @endif
@@ -480,21 +432,21 @@
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Subtotal') }}</td> <td class="text-end">{{ __('Subtotal') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end">{{ currency_format($subtotal, currency: business_currency($business_id)) }} <td class="text-end">{{ currency_format($subtotal, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ get_business_option('business-settings', $business_id)['vat_name'] ?? 'Vat' }}</td> <td class="text-end">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($vat_amount + $total_product_vat, currency: business_currency($business_id)) }} {{ currency_format($purchase->vat_amount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Shipping Charge') }}</td> <td class="text-end">{{ __('Shipping Charge') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($purchase->shipping_charge, currency: business_currency($business_id)) }} {{ currency_format($purchase->shipping_charge, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom border-bottom-dis" > <tr class="in-table-row-bottom border-bottom-dis" >
@@ -505,20 +457,20 @@
</td> </td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($purchase->discountAmount, currency: business_currency($business_id)) }} {{ currency_format($purchase->discountAmount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end total-amound">{{ __('Total Amount') }}</td> <td class="text-end total-amound">{{ __('Total Amount') }}</td>
<td class="text-end total-amound">:</td> <td class="text-end total-amound">:</td>
<td class="text-end total-amound"> <td class="text-end total-amound">
{{ currency_format($purchase->totalAmount, currency: business_currency($business_id)) }}</td> {{ currency_format($purchase->totalAmount, currency: business_currency()) }}</td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Paid Amount') }}</td> <td class="text-end">{{ __('Paid Amount') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($purchase->paidAmount + $purchase->change_amount, currency: business_currency($business_id)) }} {{ currency_format($purchase->paidAmount + $purchase->change_amount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
@if($purchase->change_amount > 0) @if($purchase->change_amount > 0)
@@ -526,7 +478,7 @@
<td class="text-end">{{ __('Change Amount') }}</td> <td class="text-end">{{ __('Change Amount') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($purchase->change_amount, currency: business_currency($business_id)) }} {{ currency_format($purchase->change_amount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
@else @else
@@ -534,7 +486,7 @@
<td class="text-end">{{ __('Due') }}</td> <td class="text-end">{{ __('Due') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($purchase->dueAmount, currency: business_currency($business_id)) }} {{ currency_format($purchase->dueAmount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
@endif @endif
@@ -556,26 +508,15 @@
</div> </div>
</div> </div>
</div> </div>
@if ((get_business_option('business-settings', $business_id)['show_warranty'] ?? 0) == 1) @if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
<div class="warranty-container-2"> <div class="warranty-container-2">
<p> <p>
@if ((get_business_option('business-settings', $business_id)['show_warranty'] ?? 0) == 1) @if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
<span>{{ get_business_option('business-settings', $business_id)['warranty_void_label'] ?? '' }} - </span> <span>{{ get_business_option('business-settings')['warranty_void_label'] ?? '' }} - </span>
@endif @endif
{{ get_business_option('business-settings', $business_id)['warranty_void'] ?? '' }} {{ get_business_option('business-settings')['warranty_void'] ?? '' }}
</p> </p>
</div> </div>
@endif @endif
<h4 class="tax-powered pt-3 pb-0">{{ get_option('general')['admin_footer_text'] ?? '' }}: {{ get_option('general')['admin_footer_link_text'] ?? '' }}</h4>
</div> </div>
</div> </div>
@php
$shareUrl = $purchase->unique_id ? route('purchase.invoice.unique', $purchase->unique_id) : ($purchase->party?->phone ? route('purchase.invoice', ['purchase_id' => $purchase->id, 'phone' => $purchase->party?->phone]) : '');
$facebook = $shareUrl ? 'https://www.facebook.com/sharer/sharer.php?u=' . urlencode($shareUrl) : '';
$twitter = $shareUrl ? 'https://twitter.com/intent/tweet?url=' . urlencode($shareUrl) : '';
$whatsapp = $shareUrl ? 'https://wa.me/?text=' . urlencode($shareUrl) : '';
@endphp
@include('business::component.share-modal', ['copy' => $shareUrl, 'facebook' => $facebook, 'twitter' => $twitter, 'whatsapp' => $whatsapp])

View File

@@ -132,7 +132,7 @@
@endsection @endsection
@section('pdf_content') @section('pdf_content')
<div class="invoice-container" dir="{{ app()->getLocale() == 'ar' ? 'rtl' : 'ltr' }}"> <div class="invoice-container">
{{-- HEADER --}} {{-- HEADER --}}
<table class="top-table"> <table class="top-table">
@@ -198,13 +198,13 @@
{{-- SUPPLIER / PURCHASE INFO --}} {{-- SUPPLIER / PURCHASE INFO --}}
<table class="info-table"> <table class="info-table">
<tr> <tr>
<td width="50%" style="text-align:{{ app()->getLocale() == 'ar' ? 'right' : 'left' }};"> <td width="50%" style="text-align:{{ app()->getLocale() == 'ar' ? 'left' : 'left' }};">
<strong>{{ __('Supplier Name') }}</strong> : {{ $purchase->party->name }}<br> <strong>{{ __('Supplier Name') }}</strong> : {{ $purchase->party->name }}<br>
<strong>{{ __('Mobile') }}</strong> : {{ $purchase->party->phone }}<br> <strong>{{ __('Mobile') }}</strong> : {{ $purchase->party->phone }}<br>
<strong>{{ __('Address') }}</strong> : {{ $purchase->party->address }} <strong>{{ __('Address') }}</strong> : {{ $purchase->party->address }}
</td> </td>
<td width="50%" style="text-align:{{ app()->getLocale() == 'ar' ? 'left' : 'right' }};"> <td width="50%" style="text-align:{{ app()->getLocale() == 'ar' ? 'right' : 'right' }};">
<strong>{{ __('Invoice') }}</strong> : {{ $purchase->invoiceNumber }}<br> <strong>{{ __('Invoice') }}</strong> : {{ $purchase->invoiceNumber }}<br>
<strong>{{ __('Date') }}</strong> : {{ formatted_date($purchase->purchaseDate) }}<br> <strong>{{ __('Date') }}</strong> : {{ formatted_date($purchase->purchaseDate) }}<br>
<strong>{{ __('Purchases By') }}</strong> : <strong>{{ __('Purchases By') }}</strong> :

View File

@@ -1,28 +1,20 @@
@foreach($products as $product) @foreach($products as $product)
@php @php
$firstStock = $product->stocks->first(); $firstStock = $product->stocks->first();
$price_without_tax = $product->product_type === 'combo' ? ($product->price_without_tax ?? 0): ($firstStock->exclusive_price ?? 0);
$inclusive_price = $firstStock->productPurchasePrice ?? 0;
@endphp @endphp
<div id="single-product" class="single-product {{ $product->id }}" <div id="single-product" class="single-product {{ $product->id }}"
data-product_id="{{ $product->id }}" data-product_id="{{ $product->id }}"
data-product_type="{{ $product->product_type }}" data-product_type="{{ $product->product_type }}" {{-- newly added. this logic apply when product-modal opeb --}}
data-has_serial="{{ $product->has_serial }}"
data-product_code="{{ $product->productCode }}" data-product_code="{{ $product->productCode }}"
data-product_unit_id="{{ $product->unit->id ?? null }}" data-product_unit_id="{{ $product->unit->id ?? null }}"
data-product_unit_name="{{ $product->unit->unitName ?? null }}" data-product_unit_name="{{ $product->unit->unitName ?? null }}"
data-product_image="{{ $product->productPicture }}" data-product_image="{{ $product->productPicture }}"
data-brand="{{ $product->brand->brandName ?? '' }}" data-brand="{{ $product->brand->brandName ?? '' }}"
data-stock="{{ $product->stocks_sum_product_stock ?? 0 }}" data-stock="{{ $product->stocks_sum_product_stock ?? 0 }}"
data-purchase_price="{{ $inclusive_price }}" data-purchase_price="{{ $firstStock->productPurchasePrice ?? 0 }}"
data-sales_price="{{ $firstStock->productSalePrice ?? 0 }}" data-sales_price="{{ $firstStock->productSalePrice ?? 0 }}"
data-whole_sale_price="{{ $firstStock->productWholeSalePrice ?? 0 }}" data-whole_sale_price="{{ $firstStock->productWholeSalePrice ?? 0 }}"
data-dealer_price="{{ $firstStock->productDealerPrice ?? 0 }}" data-dealer_price="{{ $firstStock->productDealerPrice ?? 0 }}"
data-price_without_tax="{{ $price_without_tax }}"
data-profit_percent="{{ $firstStock->profit_percent ?? 0 }}"
data-batch_no="{{ $firstStock->batch_no ?? null }}"
data-expire_date="{{ $firstStock->expire_date ?? null }}"
data-vat_rate="{{ $product->vat->rate ?? null }}"
> >
<div class="pro-img"> <div class="pro-img">
<img class='w-100 rounded' src="{{ asset($product->productPicture ?? 'assets/images/products/box.svg') }}" alt=""> <img class='w-100 rounded' src="{{ asset($product->productPicture ?? 'assets/images/products/box.svg') }}" alt="">
@@ -32,7 +24,7 @@
<p class="pro-category">{{ $product->category->categoryName ?? '' }}</p> <p class="pro-category">{{ $product->category->categoryName ?? '' }}</p>
@usercan('purchases.price') @usercan('purchases.price')
<div class="price"> <div class="price">
<h6 class="pro-price product_price">{{ currency_format($inclusive_price ?? 0, currency: business_currency()) }}</h6> <h6 class="pro-price product_price">{{ currency_format($firstStock->productPurchasePrice ?? 0, currency: business_currency()) }}</h6>
</div> </div>
@endusercan @endusercan
</div> </div>

View File

@@ -45,10 +45,6 @@
<input type="number" step="any" name="amount" id="purchase_price" required class="form-control" placeholder="{{ __('Enter Purchase Price') }}"> <input type="number" step="any" name="amount" id="purchase_price" required class="form-control" placeholder="{{ __('Enter Purchase Price') }}">
</div> </div>
@endusercan @endusercan
<div class="col-lg-6 mb-2">
<label>{{ __('Profit Percent') }}</label>
<input type="number" step="any" name="profit_percent" id="profit_percent" required class="form-control" placeholder="{{ __('Enter Profit Percent') }}">
</div>
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
<label>{{ __('Sales Price') }}</label> <label>{{ __('Sales Price') }}</label>
<input type="number" step="any" name="amount" id="sales_price" required class="form-control" placeholder="{{ __('Enter Sales Price') }}"> <input type="number" step="any" name="amount" id="sales_price" required class="form-control" placeholder="{{ __('Enter Sales Price') }}">

View File

@@ -35,22 +35,14 @@ class="ajaxform_instant_reload">
<label>{{ __('Due') }}</label> <label>{{ __('Due') }}</label>
<input type="number" name="due" step="any" class="form-control" placeholder="{{ __('Enter Due') }}"> <input type="number" name="due" step="any" class="form-control" placeholder="{{ __('Enter Due') }}">
</div> </div>
<div class="col-lg-6"> <div class="col-lg-12">
<div class="row">
<div class="col-10">
<label class="img-label">{{ __('Image') }}</label> <label class="img-label">{{ __('Image') }}</label>
<div class="custom-upload-wrapper"> <input type="file" accept="image/*" name="image" class="form-control file-input-change" data-id="image">
<div class="custom-image-box">
<div class="custom-image-content">
<svg width="30" height="30" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18.3327 7.5026V12.5026C18.3327 14.8596 18.3327 16.0381 17.6004 16.7704C16.8682 17.5026 15.6897 17.5026 13.3327 17.5026H6.66602C4.309 17.5026 3.13048 17.5026 2.39825 16.7704C1.66602 16.0381 1.66602 14.8596 1.66602 12.5026V9.21404C1.66602 8.39729 1.66602 7.98892 1.76053 7.65502C1.99698 6.81974 2.64982 6.1669 3.48509 5.93046C3.819 5.83594 4.22736 5.83594 5.04409 5.83594C5.34907 5.83594 5.50157 5.83594 5.64361 5.81118C5.99556 5.74983 6.31847 5.577 6.56476 5.3182C6.66415 5.21375 6.91352 4.8397 7.08268 4.58594C7.413 4.09048 7.57815 3.84275 7.80393 3.67233C7.94181 3.56826 8.09502 3.48627 8.25809 3.42927C8.52512 3.33594 8.82287 3.33594 9.41837 3.33594H10.8327" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
<path d="M13.3327 11.2474C13.3327 13.0883 11.8403 14.5807 9.99937 14.5807C8.1584 14.5807 6.66602 13.0883 6.66602 11.2474C6.66602 9.40641 8.1584 7.91406 9.99937 7.91406C11.8403 7.91406 13.3327 9.40641 13.3327 11.2474Z" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
<path d="M13.334 4.58333H17.5007M15.4173 6.66667V2.5" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<span class="custom-upload-text">{{ __('Add Image') }}</span>
</div> </div>
<div class="col-1 align-self-center mt-3">
<!-- Preview image --> <img src="{{ asset('assets/images/icons/upload.png') }}" id="image" class="table-img">
<img class="preview-image d-none" id="image" src="" alt="Preview">
<input type="file" name="image" class="preview-image-input" data-id="#image" accept="image/*">
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,7 +1,7 @@
@extends('layouts.business.master') @extends('layouts.business.master')
@section('title') @section('title')
{{ __('Sale Return') }} {{ __('Pos Sale') }}
@endsection @endsection
@section('main_content') @section('main_content')
@@ -49,61 +49,55 @@
<th class="border table-background text-start">{{ __('Items') }}</th> <th class="border table-background text-start">{{ __('Items') }}</th>
<th class="border table-background">{{ __('Code') }}</th> <th class="border table-background">{{ __('Code') }}</th>
<th class="border table-background">{{ __('Qty') }}</th> <th class="border table-background">{{ __('Qty') }}</th>
<th class="border table-background">{{ __('Sale Price') }}</th> <th class="border table-background text-end">{{ __('Sale Price') }}</th>
<th class="border table-background">{{ __('Return Qty') }}</th> <th class="border table-background text-end">{{ __('Vat %') }}</th>
<th class="border table-background text-end">{{ __('Vat Value') }}</th>
<th class="border table-background text-center">{{ __('Return Qty') }}</th>
<th class="border table-background text-end">{{ __('Sub Total') }}</th> <th class="border table-background text-end">{{ __('Sub Total') }}</th>
</tr> </tr>
</thead> </thead>
<tbody class='text-start'> <tbody class='text-start'>
@foreach($sale->details as $detail) @foreach($sale->details as $detail)
@php @php
// Calculate the discounted price per unit // Calculate the discounted price per unit (EXCLUSIVE)
$original_price = $detail->price; $original_price = $detail->price;
$detail_discount = $detail->discount ?? 0; $detail_discount = $detail->discount ?? 0;
$discounted_price_per_unit = $original_price - $detail_discount - ($original_price * $discount_per_unit_factor) + $avg_rounding_amount; $exclusive_price_per_unit = $original_price - $detail_discount - ($original_price * $discount_per_unit_factor) + $avg_rounding_amount;
$sub_total = $discounted_price_per_unit * $detail->quantities;
// Calculate VAT for the item
$item_vat_percent = $detail->product->vat->rate ?? 0;
$item_vat_amount = ($original_price * $item_vat_percent) / 100;
$inclusive_price_per_unit = $exclusive_price_per_unit + $item_vat_amount;
$sub_total = $inclusive_price_per_unit * $detail->quantities;
@endphp @endphp
<tr data-max_qty="{{ $detail->quantities }}" <tr data-max_qty="{{ $detail->quantities }}"
data-price="{{ $detail->price }}" data-price="{{ $detail->price }}"
data-vat_percent="{{ $item_vat_percent }}"
data-vat_amount="{{ $item_vat_amount }}"
data-discount_per_unit_factor="{{ $discount_per_unit_factor }}" data-discount_per_unit_factor="{{ $discount_per_unit_factor }}"
data-discounted_price_per_unit="{{ $discounted_price_per_unit }}" data-discounted_price_per_unit="{{ $inclusive_price_per_unit }}">
data-serials='@json($detail->serial_numbers ?? [])'>
<td class='text-center'> <td class='text-center'>
<img class="table-img" src="{{ asset($detail->product->productPicture ?? 'assets/images/products/box.svg') }}"> <img class="table-img" src="{{ asset($detail->product->productPicture ?? 'assets/images/products/box.svg') }}">
</td> </td>
<td class='text-start'>{{ $detail->product->productName ?? '' }}</td> <td class='text-start'>{{ $detail->product->productName ?? '' }}</td>
<td class='text-center'>{{ $detail->product->productCode ?? '' }}</td> <td class='text-center'>{{ $detail->product->productCode ?? '' }}</td>
<td class='text-center'>{{ $detail->quantities ?? 0 }}</td> <td class='text-center'>{{ $detail->quantities ?? 0 }}</td>
<td class='text-center price'>{{ currency_format($discounted_price_per_unit, currency: business_currency()) }}</td> <td class='text-end price'>{{ currency_format($exclusive_price_per_unit, currency: business_currency()) }}</td>
<td class='text-center large-td justify-content-center'> <td class='text-end'>{{ $item_vat_percent }}%</td>
@if (($detail->product->has_serial ?? 0) == 1 && moduleCheck('SerialCodeAddon')) <td class='text-end vat_value'>{{ currency_format($item_vat_amount, currency: business_currency()) }}</td>
<button type="button" class="serial-cell-button serial-return-btn"> <td class='text-center large-td'>
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 7H18" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round"/>
<path d="M23 7H23.0105" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M23 14H23.0105" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M23 21H23.0105" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4 14H18" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round"/>
<path d="M4 21H18" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round"/>
</svg>
</button>
<input type="hidden" name="products[][detail_id]" value="{{ $detail->id }}">
<input type="hidden" name="products[][return_qty]" class="return-qty-hidden" value="0">
<input type="hidden" name="products[][serial_numbers]" class="selected-serials-input" value="[]">
@elseif(($detail->product->has_serial ?? 0) == 1)
<span class="text-danger">{{ __('Cannot return') }}</span>
@else
<div class="d-flex align-items-center gap-3"> <div class="d-flex align-items-center gap-3">
<button class="incre-decre sub-btn"><i class="fas fa-minus icon"></i></button> <button class="incre-decre sub-btn">
<input type="number" step="any" value="" class="custom-number-input return-qty" placeholder="{{ __('0') }}"> <i class="fas fa-minus icon"></i>
<button class="incre-decre add-btn"><i class="fas fa-plus icon"></i></button> </button>
<input type="number" step="any" name="return_qty[]" value="" class="custom-number-input return-qty" placeholder="{{ __('0') }}">
<button class="incre-decre add-btn">
<i class="fas fa-plus icon"></i>
</button>
</div> </div>
<input type="hidden" name="products[][detail_id]" value="{{ $detail->id }}">
<input type="hidden" name="products[][return_qty]" class="return-qty-hidden" value="0">
<input type="hidden" name="products[][serial_numbers]" value="[]">
@endif
</td> </td>
<td class="subtotal text-end">{{ currency_format(0, currency: business_currency()) }}</td> <td class="subtotal text-end">{{ currency_format(0) }}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
@@ -114,8 +108,8 @@
<h6 class="text-end fw-bold return_amount" data-return-text="{{ __('Return Amount') }}">{{ __('Return Amount') . ' ' . currency_format($sale->totalAmount, currency: business_currency()) }}</h6> <h6 class="text-end fw-bold return_amount" data-return-text="{{ __('Return Amount') }}">{{ __('Return Amount') . ' ' . currency_format($sale->totalAmount, currency: business_currency()) }}</h6>
</div> </div>
</div> </div>
<div class="col-lg-12 delete-cancel-group mt-5"> <div class="col-lg-12 delete-cancel-group">
<div class="button-group text-center"> <div class="button-group text-center pt-5">
<a href="{{ route('business.sales.index') }}" class="theme-btn border-btn m-2">{{ __('Cancel') }}</a> <a href="{{ route('business.sales.index') }}" class="theme-btn border-btn m-2">{{ __('Cancel') }}</a>
<button class="theme-btn m-2 submit-btn">{{ __('Confirm Return') }}</button> <button class="theme-btn m-2 submit-btn">{{ __('Confirm Return') }}</button>
</div> </div>
@@ -124,18 +118,8 @@
</div> </div>
</div> </div>
</div> </div>
<input type="hidden" id="has-serial-code-addon" value="{{ moduleCheck('SerialCodeAddon') }}">
@endsection @endsection
@push('modal')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::select-serial-modal')
@endif
@endpush
@push('js') @push('js')
<script src="{{ asset('assets/js/custom/sale-purchase-return.js') . '?v=' . time() }}"></script> <script src="{{ asset('assets/js/custom/sale-purchase-return.js') }}"></script>
@endpush @endpush

View File

@@ -19,13 +19,11 @@
@foreach ($sales as $sale) @foreach ($sales as $sale)
@php @php
$total_return_amount = $sale->saleReturns->sum('total_return_amount'); $total_return_amount = $sale->saleReturns->sum('total_return_amount');
$tax_invoice = moduleCheck('TaxInvoiceAddon') && invoice_setting($sale->business_id) == 'standard_a4';
$invoice_route = $tax_invoice ? route('business.sales.tax.invoice', $sale->id) : route('business.sales.invoice', $sale->id);
@endphp @endphp
<tr> <tr>
<td>{{ ($sales->currentPage() - 1) * $sales->perPage() + $loop->iteration }}</td> <td>{{ ($sales->currentPage() - 1) * $sales->perPage() + $loop->iteration }}</td>
<td> <td>
<a href="{{ $invoice_route }}" target="_blank" class="text-primary"> <a href="{{ route('business.sales.invoice', $sale->id) }}" target="_blank" class="text-primary">
{{ $sale->invoiceNumber }} {{ $sale->invoiceNumber }}
</a> </a>
</td> </td>

View File

@@ -1,21 +1,6 @@
@if(isset($cart_contents)) @if(isset($cart_contents))
@php
$modules = product_setting()->modules ?? [];
@endphp
@foreach($cart_contents as $cart) @foreach($cart_contents as $cart)
<tr <tr data-row_id="{{ $cart->rowId }}" data-batch_no="{{ $cart->options->batch_no ?? '' }}"
data-row_id="{{ $cart->rowId }}"
data-product_id="{{ $cart->id }}"
data-product_name="{{ $cart->name }}"
data-product_code="{{ $cart->options->product_code ?? '' }}"
data-product_unit_id="{{ $cart->options->product_unit_id ?? '' }}"
data-product_unit_name="{{ $cart->options->product_unit_name ?? '' }}"
data-product_image="{{ $cart->options->product_image ?? '' }}"
data-product_type="{{ $cart->options->product_type ?? '' }}"
data-has_serial="{{ $cart->options->has_serial ?? 0 }}"
data-serials='@json($cart->options->serial_numbers ?? [])'
data-batch_no="{{ $cart->options->batch_no ?? '' }}"
data-stock_id="{{ $cart->options->stock_id ?? '' }}" data-stock_id="{{ $cart->options->stock_id ?? '' }}"
data-update_route="{{ route('business.carts.update', $cart->rowId) }}" data-update_route="{{ route('business.carts.update', $cart->rowId) }}"
data-destroy_route="{{ route('business.carts.destroy', $cart->rowId) }}"> data-destroy_route="{{ route('business.carts.destroy', $cart->rowId) }}">
@@ -27,40 +12,36 @@
<td>{{ $cart->options->batch_no ?? '' }}</td> <td>{{ $cart->options->batch_no ?? '' }}</td>
<td>{{ $cart->options->product_unit_name }}</td> <td>{{ $cart->options->product_unit_name }}</td>
<td> <td>
<input class="text-center sales-input cart-price" type="number" step="any" min="0" value="{{ round($cart->price, 2) }}" placeholder="0"> <input class="text-center sales-input cart-price" type="number" step="any" min="0" value="{{ $cart->price }}"
placeholder="0">
</td> </td>
@if (moduleCheck('SerialCodeAddon'))
<td class="serial-cell serial-option">
<button type="button" class="serial-cell-button mx-auto" @if(($cart->options->has_serial ?? 0) != 1) disabled @endif data-bs-toggle="modal" data-bs-target="#serialModal">
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 7H18" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round"/>
<path d="M23 7H23.0105" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M23 14H23.0105" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M23 21H23.0105" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4 14H18" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round"/>
<path d="M4 21H18" stroke="var(--clr-primary)" stroke-width="2" stroke-linecap="round"/>
</svg>
</button>
</td>
@endif
@if ($modules['allow_product_discount'] ?? false) @if ($modules['allow_product_discount'] ?? false)
<td> <td>
<input class="text-center sales-input cart-discount" type="number" step="any" min="0" value="{{ $cart->options->discount ?? 0 }}" placeholder="0"> <input class="text-center sales-input cart-discount" type="number" step="any" min="0"
value="{{ $cart->options->discount ?? 0 }}" placeholder="0">
</td> </td>
@endif @endif
<td class="cart-vat-percent text-center">
{{ $cart->options->vat_percent ?? 0 }}%
<input type="hidden" class="cart-vat-percent-input" value="{{ $cart->options->vat_percent ?? 0 }}">
</td>
<td class="cart-vat-value text-center">
{{ currency_format(($cart->price * $cart->qty) * ($cart->options->vat_percent ?? 0) / 100, currency: business_currency()) }}
</td>
<td class="large-td"> <td class="large-td">
<div class="d-flex gap-2 align-items-center justify-content-center"> <div class="d-flex gap-2 align-items-center">
<button class="incre-decre minus-btn"> <button class="incre-decre minus-btn">
<i class="fas fa-minus icon"></i> <i class="fas fa-minus icon"></i>
</button> </button>
<input type="number" step="any" value="{{ $cart->qty }}" class="dynamic-width cart-qty " placeholder="{{ __('0') }}" > <input type="number" step="any" value="{{ $cart->qty }}" class="dynamic-width cart-qty "
placeholder="{{ __('0') }}">
<button class="incre-decre plus-btn"> <button class="incre-decre plus-btn">
<i class="fas fa-plus icon"></i> <i class="fas fa-plus icon"></i>
</button> </button>
</div> </div>
</td> </td>
<td class="cart-subtotal"> <td class="cart-subtotal">
{{ currency_format(round(($cart->price - ($cart->options->discount ?? 0)) * $cart->qty, 2), currency: business_currency()) }} {{ currency_format(($cart->price - ($cart->options->discount ?? 0)) * $cart->qty, currency: business_currency()) }}
</td> </td>
<td> <td>
<button class='x-btn remove-btn'> <button class='x-btn remove-btn'>

View File

@@ -24,22 +24,26 @@
<h4 class='quick-act-title'>{{ __('Quick Action') }}</h4> <h4 class='quick-act-title'>{{ __('Quick Action') }}</h4>
</div> </div>
<div class="quick-actions-container"> <div class="quick-actions-container">
<a href="{{ route('business.products.index') }}" class='save-product-btn d-flex align-items-center gap-1'> <a href="{{ route('business.products.index') }}"
class='save-product-btn d-flex align-items-center gap-1'>
<img src="{{ asset('assets/images/icons/product.svg') }}" alt=""> <img src="{{ asset('assets/images/icons/product.svg') }}" alt="">
{{ __('Product List') }} {{ __('Product List') }}
</a> </a>
<a href="{{ route('business.sales.index', ['today' => true]) }}" class='sales-btn d-flex align-items-center gap-1'> <a href="{{ route('business.sales.index', ['today' => true]) }}"
class='sales-btn d-flex align-items-center gap-1'>
<img src="{{ asset('assets/images/icons/sales.svg') }}" alt=""> <img src="{{ asset('assets/images/icons/sales.svg') }}" alt="">
{{ __('Today Sales') }} {{ __('Today Sales') }}
</a> </a>
<button data-bs-toggle="modal" data-bs-target="#calculatorModal" class='calculator-btn d-flex align-items-center gap-1'> <button data-bs-toggle="modal" data-bs-target="#calculatorModal"
class='calculator-btn d-flex align-items-center gap-1'>
<img src="{{ asset('assets/images/icons/calculator.svg') }}" alt=""> <img src="{{ asset('assets/images/icons/calculator.svg') }}" alt="">
{{ __('Calculator') }} {{ __('Calculator') }}
</button> </button>
<a href="{{ route('business.dashboard.index') }}" class='dashboard-btn d-flex align-items-center gap-1'> <a href="{{ route('business.dashboard.index') }}"
class='dashboard-btn d-flex align-items-center gap-1'>
<img src="{{ asset('assets/images/icons/dashboard.svg') }}" alt=""> <img src="{{ asset('assets/images/icons/dashboard.svg') }}" alt="">
{{ __('Dashboard') }} {{ __('Dashboard') }}
</a> </a>
@@ -52,7 +56,8 @@
<div class="row g-3"> <div class="row g-3">
<!-- First Row --> <!-- First Row -->
<div class="col-12 col-md-6"> <div class="col-12 col-md-6">
<input type="text" name="invoiceNumber" value="{{ $invoice_no }}" class="form-control" placeholder="{{ __('Invoice no') }}." readonly> <input type="text" name="invoiceNumber" value="{{ $invoice_no }}" class="form-control"
placeholder="{{ __('Invoice no') }}." readonly>
</div> </div>
<!-- Second Row --> <!-- Second Row -->
<div class="col-12 col-md-6"> <div class="col-12 col-md-6">
@@ -73,12 +78,12 @@
@endforeach @endforeach
</select> </select>
<a type="button" href="#customer-create-modal" data-bs-toggle="modal" class="btn btn-danger square-btn d-flex justify-content-center align-items-center"> <a type="button" href="#customer-create-modal" data-bs-toggle="modal"
class="btn btn-danger square-btn d-flex justify-content-center align-items-center">
<img src="{{ asset('assets/images/icons/plus-square.svg') }}" alt=""> <img src="{{ asset('assets/images/icons/plus-square.svg') }}" alt="">
</a> </a>
</div> </div>
</div> </div>
@if(moduleCheck('WarehouseAddon'))
<div class="col-6"> <div class="col-6">
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<select required name="warehouse_id" class="form-select choices-select warehouse_id" aria-label="Select Customer"> <select required name="warehouse_id" class="form-select choices-select warehouse_id" aria-label="Select Customer">
@@ -89,7 +94,6 @@
</select> </select>
</div> </div>
</div> </div>
@endif
</div> </div>
</div> </div>
<div class="cart-payment"> <div class="cart-payment">
@@ -103,18 +107,17 @@
<th class="border table-background">{{ __('Batch') }}</th> <th class="border table-background">{{ __('Batch') }}</th>
<th class="border table-background">{{ __('Unit') }}</th> <th class="border table-background">{{ __('Unit') }}</th>
<th class="border table-background">{{ __('Sale Price') }}</th> <th class="border table-background">{{ __('Sale Price') }}</th>
@if (moduleCheck('SerialCodeAddon'))
<th class="border table-background serial-option">{{ __('Serial') }}</th>
@endif
@if ($modules['allow_product_discount'] ?? false) @if ($modules['allow_product_discount'] ?? false)
<th class="border table-background">{{ __('Discount') }}</th> <th class="border table-background">{{ __('Discount') }}</th>
@endif @endif
<th class="border table-background">{{ __('Vat %') }}</th>
<th class="border table-background">{{ __('Vat Value') }}</th>
<th class="border table-background">{{ __('Qty') }}</th> <th class="border table-background">{{ __('Qty') }}</th>
<th class="border table-background">{{ __('Sub Total') }}</th> <th class="border table-background">{{ __('Sub Total') }}</th>
<th class="border table-background">{{ __('Action') }}</th> <th class="border table-background">{{ __('Action') }}</th>
</tr> </tr>
</thead> </thead>
<tbody id="sale_cart_list"> <tbody id="cart-list">
@include('business::sales.cart-list') @include('business::sales.cart-list')
</tbody> </tbody>
</table> </table>
@@ -130,11 +133,13 @@
<div class="amount-info-container"> <div class="amount-info-container">
<div class="row amount-container align-items-center mb-2"> <div class="row amount-container align-items-center mb-2">
<h6 class="payment-title">{{ __('Receive Amount') }}</h6> <h6 class="payment-title">{{ __('Receive Amount') }}</h6>
<input name="receive_amount" type="number" step="any" id="receive_amount" min="0" class="form-control receive_amount" placeholder="0"> <input name="receive_amount" type="number" step="any" id="receive_amount"
min="0" class="form-control receive_amount" placeholder="0">
</div> </div>
<div class="row amount-container align-items-center mb-2"> <div class="row amount-container align-items-center mb-2">
<h6 class="payment-title">{{ __('Change Amount') }}</h6> <h6 class="payment-title">{{ __('Change Amount') }}</h6>
<input type="number" step="any" id="change_amount" class="form-control" placeholder="0" readonly> <input type="number" step="any" id="change_amount" class="form-control"
placeholder="0" readonly>
</div> </div>
<div class="row amount-container align-items-center mb-2"> <div class="row amount-container align-items-center mb-2">
<h6 class="payment-title">{{ __('Due Amount') }}</h6> <h6 class="payment-title">{{ __('Due Amount') }}</h6>
@@ -160,21 +165,13 @@
<h6 class="fw-bold" id="sub_total"> <h6 class="fw-bold" id="sub_total">
{{ currency_format(0, currency: business_currency()) }}</h6> {{ currency_format(0, currency: business_currency()) }}</h6>
</div> </div>
<div class="row save-amount-container align-items-center mb-2"> <div class="mb-2 d-flex align-items-center justify-content-between">
<h6 class="payment-title col-6">{{ __('Discount') }}</h6> <h6>{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2"> <h6 class="fw-bold" id="vat_amount_txt">
<div class="d-flex d-flex align-items-center gap-2"> {{ currency_format(0, currency: business_currency()) }}</h6>
<select name="discount_type" class="form-select discount_type" id='form-ware'>
<option value="flat">{{ __('Flat') }}
({{ business_currency()->symbol }})
</option>
<option value="percent">{{ __('Percent (%)') }}</option>
</select>
</div> </div>
<input type="number" step="any" name="discountAmount" id="discount_amount" min="0" class="form-control right-start-input" placeholder="{{ __('0') }}"> <div class="row save-amount-container align-items-center mb-2 d-none">
</div>
</div>
<div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6> <h6 class="payment-title col-6">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2"> <div class="col-6 w-100 d-flex justify-content-between gap-2">
<div class="d-flex d-flex align-items-center gap-2"> <div class="d-flex d-flex align-items-center gap-2">
@@ -188,7 +185,26 @@
@endforeach @endforeach
</select> </select>
</div> </div>
<input type="number" step="any" name="vat_amount" id="vat_amount" min="0" class="form-control right-start-input" placeholder="{{ __('0') }}" readonly> <input type="number" step="any" name="vat_amount" id="vat_amount"
min="0" class="form-control right-start-input"
placeholder="{{ __('0') }}" readonly>
</div>
</div>
<div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ __('Discount') }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2">
<div class="d-flex d-flex align-items-center gap-2">
<select name="discount_type" class="form-select discount_type"
id='form-ware'>
<option value="flat">{{ __('Flat') }}
({{ business_currency()->symbol }})
</option>
<option value="percent">{{ __('Percent (%)') }}</option>
</select>
</div>
<input type="number" step="any" name="discountAmount"
id="discount_amount" min="0"
class="form-control right-start-input" placeholder="{{ __('0') }}">
</div> </div>
</div> </div>
<div class="mb-2 shopping-crg-grid"> <div class="mb-2 shopping-crg-grid">
@@ -270,7 +286,6 @@ class="btn btn-brand w-100">{{ __('Brand') }}</a>
</div> </div>
</div> </div>
</div> </div>
@php @php
$rounding_amount_option = sale_rounding(); $rounding_amount_option = sale_rounding();
@endphp @endphp
@@ -286,17 +301,9 @@ class="btn btn-brand w-100">{{ __('Brand') }}</a>
<input type="hidden" id="asset_base_url" value="{{ asset('') }}"> <input type="hidden" id="asset_base_url" value="{{ asset('') }}">
<input type="hidden" id="get_stock_prices" value="{{ route('business.products.stocks-prices') }}"> <input type="hidden" id="get_stock_prices" value="{{ route('business.products.stocks-prices') }}">
<input type="hidden" id="warehouse_module_exist" value="{{ moduleCheck('WarehouseAddon') ? 1 : 0 }}"> <input type="hidden" id="warehouse_module_exist" value="{{ moduleCheck('WarehouseAddon') ? 1 : 0 }}">
<input type="hidden" id="has-serial-code-addon" value="{{ moduleCheck('SerialCodeAddon') }}">
<input type="hidden" id="check-serial-exist" value="{{ route('business.products.check-serial') }}">
<input type="hidden" id="get-product-serials" value="{{ route('business.products.get-serials') }}">
<input type="hidden" id="is-inventory-page" value="0">
@endsection @endsection
@push('modal') @push('modal')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::select-serial-modal')
@endif
@include('business::sales.calculator') @include('business::sales.calculator')
@include('business::sales.category-search') @include('business::sales.category-search')
@include('business::sales.brand-search') @include('business::sales.brand-search')

View File

@@ -7,17 +7,20 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="personal-info"> <div class="personal-info">
<form action="{{ route('business.sales.store.customer') }}" method="post" enctype="multipart/form-data" class="ajaxform_instant_reload"> <form action="{{ route('business.sales.store.customer') }}" method="post" enctype="multipart/form-data"
class="ajaxform_instant_reload">
@csrf @csrf
<div class="row"> <div class="row">
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
<label>{{ __('Name') }}</label> <label>{{ __('Name') }}</label>
<input type="text" name="name" required class="form-control" placeholder="{{ __('Enter Name') }}"> <input type="text" name="name" required class="form-control" placeholder="{{ __('Enter Name') }}">
</div> </div>
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
<label>{{ __('Phone') }}</label> <label>{{ __('Phone') }}</label>
<input type="number" name="phone" class="form-control" placeholder="{{ __('Enter phone number') }}"> <input type="number" name="phone" class="form-control" placeholder="{{ __('Enter phone number') }}">
</div> </div>
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
<label>{{__('Party Type')}}</label> <label>{{__('Party Type')}}</label>
<div class="gpt-up-down-arrow position-relative"> <div class="gpt-up-down-arrow position-relative">
@@ -29,6 +32,7 @@
<span></span> <span></span>
</div> </div>
</div> </div>
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
<label>{{ __('Email') }}</label> <label>{{ __('Email') }}</label>
<input type="email" name="email" class="form-control" placeholder="{{ __('Enter Email') }}"> <input type="email" name="email" class="form-control" placeholder="{{ __('Enter Email') }}">
@@ -41,22 +45,14 @@
<label>{{ __('Due') }}</label> <label>{{ __('Due') }}</label>
<input type="number" name="due" step="any" class="form-control" placeholder="{{ __('Enter Due') }}"> <input type="number" name="due" step="any" class="form-control" placeholder="{{ __('Enter Due') }}">
</div> </div>
<div class="col-lg-6"> <div class="col-lg-12">
<div class="row">
<div class="col-10">
<label class="img-label">{{ __('Image') }}</label> <label class="img-label">{{ __('Image') }}</label>
<div class="custom-upload-wrapper"> <input type="file" accept="image/*" name="image" class="form-control file-input-change" data-id="image">
<div class="custom-image-box">
<div class="custom-image-content">
<svg width="30" height="30" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18.3327 7.5026V12.5026C18.3327 14.8596 18.3327 16.0381 17.6004 16.7704C16.8682 17.5026 15.6897 17.5026 13.3327 17.5026H6.66602C4.309 17.5026 3.13048 17.5026 2.39825 16.7704C1.66602 16.0381 1.66602 14.8596 1.66602 12.5026V9.21404C1.66602 8.39729 1.66602 7.98892 1.76053 7.65502C1.99698 6.81974 2.64982 6.1669 3.48509 5.93046C3.819 5.83594 4.22736 5.83594 5.04409 5.83594C5.34907 5.83594 5.50157 5.83594 5.64361 5.81118C5.99556 5.74983 6.31847 5.577 6.56476 5.3182C6.66415 5.21375 6.91352 4.8397 7.08268 4.58594C7.413 4.09048 7.57815 3.84275 7.80393 3.67233C7.94181 3.56826 8.09502 3.48627 8.25809 3.42927C8.52512 3.33594 8.82287 3.33594 9.41837 3.33594H10.8327" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
<path d="M13.3327 11.2474C13.3327 13.0883 11.8403 14.5807 9.99937 14.5807C8.1584 14.5807 6.66602 13.0883 6.66602 11.2474C6.66602 9.40641 8.1584 7.91406 9.99937 7.91406C11.8403 7.91406 13.3327 9.40641 13.3327 11.2474Z" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
<path d="M13.334 4.58333H17.5007M15.4173 6.66667V2.5" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<span class="custom-upload-text">{{ __('Add Image') }}</span>
</div> </div>
<div class="col-1 align-self-center mt-3">
<!-- Preview image --> <img src="{{ asset('assets/images/icons/upload.png') }}" id="image" class="table-img">
<img class="preview-image d-none" id="image" src="" alt="Preview">
<input type="file" name="image" class="preview-image-input" data-id="#image" accept="image/*">
</div> </div>
</div> </div>
</div> </div>

View File

@@ -65,87 +65,52 @@
<i class="far fa-ellipsis-v"></i> <i class="far fa-ellipsis-v"></i>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
@usercan('sales.read') @usercan('sales.read')
<li> <li>
<a target="_blank" href="{{ route('business.sales.invoice', $sale->id) }}"> <a target="_blank" href="{{ route('business.sales.invoice', $sale->id) }}">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <img src="{{ asset('assets/images/icons/Invoic.svg') }}" alt="">
<path d="M2.66602 12.4331V5.37211C2.66602 3.46944 2.66602 2.5181 3.2518 1.92702C3.83759 1.33594 4.7804 1.33594 6.66602 1.33594H9.33268C11.2183 1.33594 12.1611 1.33594 12.7469 1.92702C13.3327 2.5181 13.3327 3.46944 13.3327 5.37211V12.4331C13.3327 13.4409 13.3327 13.9448 13.0247 14.1431C12.5214 14.4673 11.7434 13.7875 11.3521 13.5408C11.0287 13.3369 10.8671 13.2349 10.6877 13.2291C10.4938 13.2227 10.3293 13.3205 9.97995 13.5408L8.70602 14.3442C8.36235 14.5609 8.19055 14.6693 7.99935 14.6693C7.80815 14.6693 7.63635 14.5609 7.29268 14.3442L6.01877 13.5408C5.69545 13.3369 5.53379 13.2349 5.35437 13.2291C5.1605 13.2227 4.99597 13.3205 4.6466 13.5408C4.25532 13.7875 3.47726 14.4673 2.97398 14.1431C2.66602 13.9448 2.66602 13.4409 2.66602 12.4331Z" stroke="#4B5563" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M10.6673 4H5.33398" stroke="#4B5563" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M6.66732 6.66406H5.33398" stroke="#4B5563" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M9.66602 6.58333C9.11375 6.58333 8.66602 6.97507 8.66602 7.45833C8.66602 7.9416 9.11375 8.33333 9.66602 8.33333C10.2183 8.33333 10.666 8.72507 10.666 9.20833C10.666 9.6916 10.2183 10.0833 9.66602 10.0833M9.66602 6.58333C10.1014 6.58333 10.4718 6.8268 10.6091 7.16667M9.66602 6.58333V6M9.66602 10.0833C9.23062 10.0833 8.86022 9.83987 8.72295 9.5M9.66602 10.0833V10.6667" stroke="#4B5563" stroke-width="1.25" stroke-linecap="round"/>
</svg>
{{ __('Invoice') }} {{ __('Invoice') }}
</a> </a>
</li> </li>
@endusercan @endusercan
@usercan('sales.read')
@php
$useTaxInvoice = moduleCheck('TaxInvoiceAddon') && invoice_setting($sale->business_id) == 'standard_a4';
@endphp
@if($useTaxInvoice)
<li>
<a target="_blank" href="{{ route('business.sales.tax.invoice', $sale->id) }}">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_40008374_151568)">
<path d="M15.012 1.5C14.177 1.5 13.5 3.51472 13.5 6H15.012C15.7407 6 16.105 6 16.3306 5.74841C16.5562 5.49682 16.5169 5.1655 16.4384 4.50286C16.2311 2.75357 15.6707 1.5 15.012 1.5Z" stroke="#4D4D4D" stroke-width="1.25"/>
<path d="M13.5 6.0407V13.9844C13.5 15.1181 13.5 15.685 13.1535 15.9081C12.5873 16.2728 11.7121 15.5081 11.2718 15.2305C10.9081 15.0011 10.7263 14.8864 10.5244 14.8798C10.3063 14.8726 10.1212 14.9826 9.72817 15.2305L8.295 16.1343C7.90838 16.3781 7.7151 16.5 7.5 16.5C7.28491 16.5 7.09159 16.3781 6.705 16.1343L5.27185 15.2305C4.90811 15.0011 4.72624 14.8864 4.5244 14.8798C4.30629 14.8726 4.1212 14.9826 3.72815 15.2305C3.28796 15.5081 2.41265 16.2728 1.84646 15.9081C1.5 15.685 1.5 15.1181 1.5 13.9844V6.0407C1.5 3.90019 1.5 2.82994 2.15901 2.16497C2.81802 1.5 3.87868 1.5 6 1.5H15" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M7.5 6C6.67157 6 6 6.50368 6 7.125C6 7.7463 6.67157 8.25 7.5 8.25C8.32845 8.25 9 8.7537 9 9.375C9 9.9963 8.32845 10.5 7.5 10.5M7.5 6C8.1531 6 8.7087 6.31305 8.91465 6.75M7.5 6V5.25M7.5 10.5C6.84689 10.5 6.29127 10.1869 6.08535 9.75M7.5 10.5V11.25" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round"/>
</g>
<defs>
<clipPath id="clip0_40008374_151568">
<rect width="18" height="18" fill="white"/>
</clipPath>
</defs>
</svg>
{{ __('Tax Invoice') }}
</a>
</li>
@endif
@endusercan
@if ($sale->details->sum('quantities') != 0) @if ($sale->details->sum('quantities') != 0)
@usercan('sale-returns.read') @usercan('sale-returns.read')
<li> <li>
<a <a
href="{{ route('business.sale-returns.create', ['sale_id' => $sale->id]) }}"> href="{{ route('business.sale-returns.create', ['sale_id' => $sale->id]) }}">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <i class="fal fa-undo-alt"></i>
<path d="M2.25 9.75V6H15.75V9.75C15.75 12.5784 15.75 13.9927 14.8713 14.8713C13.9927 15.75 12.5784 15.75 9.75 15.75H8.25C5.42157 15.75 4.00736 15.75 3.12868 14.8713C2.25 13.9927 2.25 12.5784 2.25 9.75Z" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M2.25 6L2.89904 4.55769C3.40241 3.4391 3.65408 2.87981 4.16423 2.5649C4.67438 2.25 5.32875 2.25 6.6375 2.25H11.3625C12.6712 2.25 13.3256 2.25 13.8358 2.5649C14.3459 2.87981 14.5976 3.4391 15.1009 4.55769L15.75 6" stroke="#4B5563" stroke-linecap="round"/>
<path d="M9 6V2.25" stroke="#4B5563" stroke-linecap="round"/>
<path d="M6.375 10.125H10.5C11.3284 10.125 12 10.7966 12 11.625C12 12.4534 11.3284 13.125 10.5 13.125H9.75M7.5 8.625L6 10.125L7.5 11.625" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
{{ __('Sales Return') }} {{ __('Sales Return') }}
</a> </a>
</li> </li>
@endusercan @endusercan
@endif @endif
<li> <li>
<a href="#" class="view-payment-btn" <a href="#" class="view-payment-btn"
data-url="{{ route('business.view-payment', ['type' => 'sale', 'id' => $sale->id]) }}" data-url="{{ route('business.view-payment', ['type' => 'sale', 'id' => $sale->id]) }}"
data-bs-toggle="modal" data-bs-target="#view-payment-modal"> data-bs-toggle="modal" data-bs-target="#view-payment-modal">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="18" height="18" viewBox="0 0 18 18" fill="none"
<path d="M3 13.9844V6.0407C3 3.90019 3 2.82994 3.65901 2.16497C4.31802 1.5 5.37868 1.5 7.5 1.5H10.5C12.6213 1.5 13.6819 1.5 14.341 2.16497C15 2.82994 15 3.90019 15 6.0407V13.9844C15 15.1181 15 15.685 14.6535 15.9081C14.0873 16.2728 13.2121 15.5081 12.7718 15.2305C12.4081 15.0011 12.2263 14.8864 12.0244 14.8798C11.8063 14.8726 11.6212 14.9826 11.2282 15.2305L9.795 16.1343C9.40838 16.3781 9.2151 16.5 9 16.5C8.7849 16.5 8.59162 16.3781 8.205 16.1343L6.77185 15.2305C6.40811 15.0011 6.22624 14.8864 6.0244 14.8798C5.80629 14.8726 5.6212 14.9826 5.22815 15.2305C4.78796 15.5081 3.91265 16.2728 3.34646 15.9081C3 15.685 3 15.1181 3 13.9844Z" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/> xmlns="http://www.w3.org/2000/svg">
<path d="M12 4H6" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/> <path
<path d="M11 7H6" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/> d="M3 13.9844V6.0407C3 3.90019 3 2.82994 3.65901 2.16497C4.31802 1.5 5.37868 1.5 7.5 1.5H10.5C12.6213 1.5 13.6819 1.5 14.341 2.16497C15 2.82994 15 3.90019 15 6.0407V13.9844C15 15.1181 15 15.685 14.6535 15.9081C14.0873 16.2728 13.2121 15.5081 12.7718 15.2305C12.4081 15.0011 12.2263 14.8864 12.0244 14.8798C11.8063 14.8726 11.6212 14.9826 11.2282 15.2305L9.795 16.1343C9.40838 16.3781 9.2151 16.5 9 16.5C8.7849 16.5 8.59162 16.3781 8.205 16.1343L6.77185 15.2305C6.40811 15.0011 6.22624 14.8864 6.0244 14.8798C5.80629 14.8726 5.6212 14.9826 5.22815 15.2305C4.78796 15.5081 3.91265 16.2728 3.34646 15.9081C3 15.685 3 15.1181 3 13.9844Z"
<path d="M9 10H6" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/> stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round" />
<path d="M12 4.5H6" stroke="#4B5563" stroke-linecap="round"
stroke-linejoin="round" />
<path d="M7.5 7.5H6" stroke="#4B5563" stroke-linecap="round"
stroke-linejoin="round" />
<path
d="M10.875 7.40625C10.2537 7.40625 9.75 7.84695 9.75 8.39063C9.75 8.9343 10.2537 9.375 10.875 9.375C11.4963 9.375 12 9.8157 12 10.3594C12 10.9031 11.4963 11.3438 10.875 11.3438M10.875 7.40625C11.3648 7.40625 11.7815 7.68015 11.936 8.0625M10.875 7.40625V6.75M10.875 11.3438C10.3852 11.3438 9.96847 11.0699 9.81405 10.6875M10.875 11.3438V12"
stroke="#4B5563" stroke-linecap="round" />
</svg> </svg>
</i> {{ __('View Payment') }} </i> {{ __('View Payment') }}
</a> </a>
</li> </li>
@if (!in_array($sale->id, $salesWithReturns)) @if (!in_array($sale->id, $salesWithReturns))
@usercan('sales.update') @usercan('sales.update')
<li> <li>
<a href="{{ route('business.sales.edit', $sale->id) }}"> <a href="{{ route('business.sales.edit', $sale->id) }}">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <i class="fal fa-edit"></i>
<path d="M12.1606 3.73679L13.2119 2.68547C13.7925 2.10484 14.7339 2.10484 15.3145 2.68547C15.8951 3.2661 15.8951 4.20748 15.3145 4.78811L14.2632 5.83943M12.1606 3.73679L8.23515 7.66222C7.4512 8.4462 7.05919 8.83815 6.79228 9.31582C6.52535 9.7935 6.2568 10.9214 6 12C7.07857 11.7432 8.2065 11.4746 8.68418 11.2077C9.16185 10.9408 9.5538 10.5488 10.3378 9.76485L14.2632 5.83943M12.1606 3.73679L14.2632 5.83943" stroke="#4B5563" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M15.75 9C15.75 12.1819 15.75 13.773 14.7615 14.7615C13.773 15.75 12.1819 15.75 9 15.75C5.81802 15.75 4.22703 15.75 3.23851 14.7615C2.25 13.773 2.25 12.1819 2.25 9C2.25 5.81802 2.25 4.22703 3.23851 3.23851C4.22703 2.25 5.81802 2.25 9 2.25" stroke="#4B5563" stroke-width="1.2" stroke-linecap="round"/>
</svg>
{{ __('Edit') }} {{ __('Edit') }}
</a> </a>
</li> </li>
@@ -154,12 +119,7 @@
<li> <li>
<a href="{{ route('business.sales.destroy', $sale->id) }}" <a href="{{ route('business.sales.destroy', $sale->id) }}"
class="confirm-action" data-method="DELETE"> class="confirm-action" data-method="DELETE">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <i class="fal fa-trash-alt"></i>
<path d="M14.625 4.125L14.1602 11.6438C14.0414 13.5648 13.9821 14.5253 13.5006 15.2159C13.2625 15.5573 12.956 15.8455 12.6005 16.062C11.8816 16.5 10.9192 16.5 8.99452 16.5C7.06734 16.5 6.10372 16.5 5.38429 16.0612C5.0286 15.8443 4.722 15.5556 4.48401 15.2136C4.00266 14.5219 3.94459 13.5601 3.82846 11.6364L3.375 4.125" stroke="#4B5563" stroke-width="1.2" stroke-linecap="round"/>
<path d="M6.75 8.79688H11.25" stroke="#4B5563" stroke-width="1.2" stroke-linecap="round"/>
<path d="M7.875 11.7422H10.125" stroke="#4B5563" stroke-width="1.2" stroke-linecap="round"/>
<path d="M2.25 4.125H15.75M12.0416 4.125L11.5297 3.0688C11.1896 2.3672 11.0195 2.01639 10.7261 1.79761C10.6611 1.74908 10.5922 1.7059 10.5201 1.66852C10.1953 1.5 9.80542 1.5 9.02572 1.5C8.22645 1.5 7.82685 1.5 7.49662 1.67559C7.42343 1.71451 7.35359 1.75943 7.28783 1.80988C6.99109 2.03753 6.82533 2.40116 6.49381 3.12844L6.03955 4.125" stroke="#4B5563" stroke-width="1.2" stroke-linecap="round"/>
</svg>
{{ __('Delete') }} {{ __('Delete') }}
</a> </a>
</li> </li>

View File

@@ -20,7 +20,7 @@
@csrf @csrf
@method('put') @method('put')
<div class="row "> <div class="row mt-3">
<div class="col-lg-4"> <div class="col-lg-4">
<label>{{ __('Customer') }}</label> <label>{{ __('Customer') }}</label>
<div class="input-group"> <div class="input-group">
@@ -58,7 +58,7 @@ class="btn btn-danger square-btn d-flex justify-content-center align-items-cente
@foreach ($products as $product) @foreach ($products as $product)
@if (!empty($product->stocks) && $product->stocks->count() > 1) @if (!empty($product->stocks) && $product->stocks->count() > 1)
{{-- when multiple stock --}} {{-- when multiple stock --}}
<div class="product-option-item single-product {{ $product->id }}" data-product_id="{{ $product->id }}" data-default_price="{{ $product->productSalePrice }}" data-route="{{ route('business.carts.store') }}" data-product_name="{{ $product->productName }}" data-product_code="{{ $product->productCode }}" data-product_unit_id="{{ $product->unit_id }}" data-product_unit_name="{{ $product->unit->unitName ?? '' }}" data-purchase_price="{{ $product->productPurchasePrice }}" data-product_image="{{ $product->productPicture }}"> <div class="product-option-item single-product {{ $product->id }}" data-product_id="{{ $product->id }}" data-default_price="{{ $product->productSalePrice }}" data-route="{{ route('business.carts.store') }}" data-product_name="{{ $product->productName }}" data-product_code="{{ $product->productCode }}" data-product_unit_id="{{ $product->unit_id }}" data-product_unit_name="{{ $product->unit->unitName ?? '' }}" data-purchase_price="{{ $product->productPurchasePrice }}" data-product_image="{{ $product->productPicture }}" data-vat_percent="{{ $product->vat->rate ?? 0 }}">
<div class="product-left"> <div class="product-left">
<img src="{{ asset($product->productPicture ?? 'assets/images/products/box.svg') }}" alt=""> <img src="{{ asset($product->productPicture ?? 'assets/images/products/box.svg') }}" alt="">
<div class="product-text"> <div class="product-text">
@@ -79,10 +79,11 @@ class="btn btn-danger square-btn d-flex justify-content-center align-items-cente
data-product_unit_name="{{ $product->unit->unitName ?? '' }}" data-product_unit_name="{{ $product->unit->unitName ?? '' }}"
data-purchase_price="{{ $product->productPurchasePrice }}" data-purchase_price="{{ $product->productPurchasePrice }}"
data-product_image="{{ $product->productPicture }}" data-product_image="{{ $product->productPicture }}"
data-route="{{ route('business.carts.store') }}"> data-route="{{ route('business.carts.store') }}"
data-vat_percent="{{ $product->vat->rate ?? 0 }}">
<div class="product-des"> <div class="product-des">
{{ __('Batch') }}: {{ $stock->batch_no ?? 'N/A' }} {{ __('Batch') }}: {{ $stock->batch_no ?? 'N/A' }}
{{ $product->color ? ', Color: ' . $product->color : '' }}, Code : {{ $product->productCode }} {{ $product->color ? ', Color: ' . $product->color : '' }}
<span class="product-in-stock">{{ __('In Stock') }}: {{ $stock->productStock }}</span> <span class="product-in-stock">{{ __('In Stock') }}: {{ $stock->productStock }}</span>
</div> </div>
<div class="product-price product_price"> <div class="product-price product_price">
@@ -108,7 +109,8 @@ class="btn btn-danger square-btn d-flex justify-content-center align-items-cente
data-product_image="{{ $product->productPicture }}" data-product_image="{{ $product->productPicture }}"
data-product_batch_no="{{ $stock->batch_no ?? '' }}" data-product_batch_no="{{ $stock->batch_no ?? '' }}"
data-product_expire_date="{{ $stock->expire_date ?? '' }}" data-product_expire_date="{{ $stock->expire_date ?? '' }}"
data-route="{{ route('business.carts.store') }}"> data-route="{{ route('business.carts.store') }}"
data-vat_percent="{{ $product->vat->rate ?? 0 }}">
<div class="product-left"> <div class="product-left">
<img src="{{ asset($product->productPicture ?? 'assets/images/products/box.svg') }}" alt=""> <img src="{{ asset($product->productPicture ?? 'assets/images/products/box.svg') }}" alt="">
<div class="product-text"> <div class="product-text">
@@ -118,7 +120,7 @@ class="btn btn-danger square-btn d-flex justify-content-center align-items-cente
</div> </div>
<div class="d-flex align-items-center justify-content-between w-100"> <div class="d-flex align-items-center justify-content-between w-100">
<div class="product-des"> <div class="product-des">
{{ __('Batch') }}: {{ $stock->batch_no ?? 'N/A' }}, {{ __('Code') }}: {{ $product->productCode }} {{ __('Batch') }}: {{ $stock->batch_no ?? 'N/A' }}
{{ $product->color ? ', Color: ' . $product->color : '' }} {{ $product->color ? ', Color: ' . $product->color : '' }}
<span class="product-in-stock">{{ __('In Stock') }}: {{ $stock->productStock ?? 0 }}</span> <span class="product-in-stock">{{ __('In Stock') }}: {{ $stock->productStock ?? 0 }}</span>
</div> </div>
@@ -157,23 +159,23 @@ class="btn btn-danger square-btn d-flex justify-content-center align-items-cente
<th class="border p-2 table-background">{{ __('Batch') }}</th> <th class="border p-2 table-background">{{ __('Batch') }}</th>
<th class="border p-2 table-background">{{ __('Unit') }}</th> <th class="border p-2 table-background">{{ __('Unit') }}</th>
<th class="border p-2 table-background">{{ __('Sale Price') }}</th> <th class="border p-2 table-background">{{ __('Sale Price') }}</th>
@if (moduleCheck('SerialCodeAddon'))
<th class="border table-background serial-option">{{ __('Serial') }}</th>
@endif
@if ($modules['allow_product_discount'] ?? false) @if ($modules['allow_product_discount'] ?? false)
<th class="border p-2 table-background">{{ __('Discount') }}</th> <th class="border p-2 table-background">{{ __('Discount') }}</th>
@endif @endif
<th class="border p-2 table-background">{{ __('Vat %') }}</th>
<th class="border p-2 table-background">{{ __('Vat Value') }}</th>
<th class="border p-2 table-background">{{ __('Qty') }}</th> <th class="border p-2 table-background">{{ __('Qty') }}</th>
<th class="border p-2 table-background">{{ __('Sub Total') }}</th> <th class="border p-2 table-background">{{ __('Sub Total') }}</th>
<th class="border p-2 table-background">{{ __('Action') }}</th> <th class="border p-2 table-background">{{ __('Action') }}</th>
</tr> </tr>
</thead> </thead>
<tbody id="sale_cart_list"> <tbody id="cart-list">
@include('business::sales.cart-list') @include('business::sales.cart-list')
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="col-sm-12 col-md-6 col-lg-6 mt-5"> <div class="col-sm-12 col-md-6 col-lg-6 mt-5">
<div class="amount-info-container inventory-amount-info-container"> <div class="amount-info-container inventory-amount-info-container">
<div class="row amount-container align-items-center mb-2"> <div class="row amount-container align-items-center mb-2">
@@ -207,20 +209,13 @@ class="btn btn-danger square-btn d-flex justify-content-center align-items-cente
<h6 class="fw-bold" id="sub_total"> <h6 class="fw-bold" id="sub_total">
{{ currency_format(0, currency: business_currency()) }}</h6> {{ currency_format(0, currency: business_currency()) }}</h6>
</div> </div>
<div class="row save-amount-container align-items-center mb-2"> <div class="mb-2 d-flex align-items-center justify-content-between">
<h6 class="payment-title col-6">{{ __('Discount') }}</h6> <h6>{{ __('Vat') }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2"> <h6 class="fw-bold" id="vat_amount_txt">
<div class="d-flex d-flex align-items-center gap-2"> {{ currency_format(($sale->vat_amount ?? 0) != 0 ? $sale->vat_amount : (($sale->vat_percent ?? 0) != 0 ? $sale->vat_percent : 0), currency: business_currency()) }}</h6>
<select name="discount_type" class="form-select discount_type" id='form-ware'>
<option value="flat" @selected($sale->discount_type == 'flat')>{{ __('Flat') }} ({{ business_currency()->symbol }})</option>
<option value="percent" @selected($sale->discount_type == 'percent')>{{ __('Percent (%)') }}</option>
</select>
</div> </div>
<input type="number" step="any" name="discountAmount" value="{{ $sale->discount_type == 'percent' ? $sale->discount_percent : $sale->discountAmount }}" id="discount_amount" min="0" class="right-start-input form-control" placeholder="{{ __('0') }}"> <div class="row save-amount-container align-items-center mb-2 d-none">
</div> <h6 class="payment-title col-6">{{ __('Vat') }}</h6>
</div>
<div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2"> <div class="col-6 w-100 d-flex justify-content-between gap-2">
<div class="d-flex d-flex align-items-center gap-2"> <div class="d-flex d-flex align-items-center gap-2">
<select name="vat_id" class="form-select vat_select" id='form-ware'> <select name="vat_id" class="form-select vat_select" id='form-ware'>
@@ -233,6 +228,18 @@ class="btn btn-danger square-btn d-flex justify-content-center align-items-cente
<input type="number" step="any" name="vat_amount" id="vat_amount" value="{{ ($sale->vat_amount ?? 0) != 0 ? $sale->vat_amount : (($sale->vat_percent ?? 0) != 0 ? $sale->vat_percent : 0) }}" min="0" class="form-control right-start-input" placeholder="{{ __('0') }}" readonly> <input type="number" step="any" name="vat_amount" id="vat_amount" value="{{ ($sale->vat_amount ?? 0) != 0 ? $sale->vat_amount : (($sale->vat_percent ?? 0) != 0 ? $sale->vat_percent : 0) }}" min="0" class="form-control right-start-input" placeholder="{{ __('0') }}" readonly>
</div> </div>
</div> </div>
<div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ __('Discount') }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2">
<div class="d-flex d-flex align-items-center gap-2">
<select name="discount_type" class="form-select discount_type" id='form-ware'>
<option value="flat" @selected($sale->discount_type == 'flat')>{{ __('Flat') }} ({{ business_currency()->symbol }})</option>
<option value="percent" @selected($sale->discount_type == 'percent')>{{ __('Percent (%)') }}</option>
</select>
</div>
<input type="number" step="any" name="discountAmount" value="{{ $sale->discount_type == 'percent' ? $sale->discount_percent : $sale->discountAmount }}" id="discount_amount" min="0" class="right-start-input form-control" placeholder="{{ __('0') }}">
</div>
</div>
<div class="row save-amount-container align-items-center mb-2"> <div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ __('Shipping Charge') }}</h6> <h6 class="payment-title col-6">{{ __('Shipping Charge') }}</h6>
<div class="col-12 "> <div class="col-12 ">
@@ -286,16 +293,9 @@ class="theme-btn border-btn m-2">{{__('Cancel')}}
<input type="hidden" id="selectedProductValue" name="selectedProductValue"> <input type="hidden" id="selectedProductValue" name="selectedProductValue">
<input type="hidden" id="asset_base_url" value="{{ asset('') }}"> <input type="hidden" id="asset_base_url" value="{{ asset('') }}">
<input type="hidden" id="get_stock_prices" value="{{ route('business.products.stocks-prices') }}"> <input type="hidden" id="get_stock_prices" value="{{ route('business.products.stocks-prices') }}">
<input type="hidden" id="has-serial-code-addon" value="{{ moduleCheck('SerialCodeAddon') }}">
<input type="hidden" id="check-serial-exist" value="{{ route('business.products.check-serial') }}">
<input type="hidden" id="get-product-serials" value="{{ route('business.products.get-serials') }}"> <input type="hidden" id="is-inventory-page" value="1">
@endsection @endsection
@push('modal') @push('modal')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::select-serial-modal')
@endif
@include('business::sales.calculator') @include('business::sales.calculator')
@include('business::sales.customer-create') @include('business::sales.customer-create')
@endpush @endpush

View File

@@ -78,7 +78,6 @@ class="ajaxform">
</a> </a>
</div> </div>
</div> </div>
@if(moduleCheck('WarehouseAddon'))
<div class="col-6"> <div class="col-6">
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<select required name="warehouse_id" class="form-select choices-select warehouse_id" aria-label="Select Customer"> <select required name="warehouse_id" class="form-select choices-select warehouse_id" aria-label="Select Customer">
@@ -89,7 +88,6 @@ class="ajaxform">
</select> </select>
</div> </div>
</div> </div>
@endif
</div> </div>
</div> </div>
<div class="cart-payment"> <div class="cart-payment">
@@ -103,18 +101,17 @@ class="ajaxform">
<th class="border table-background">{{ __('Batch') }}</th> <th class="border table-background">{{ __('Batch') }}</th>
<th class="border table-background">{{ __('Unit') }}</th> <th class="border table-background">{{ __('Unit') }}</th>
<th class="border table-background">{{ __('Sale Price') }}</th> <th class="border table-background">{{ __('Sale Price') }}</th>
@if (moduleCheck('SerialCodeAddon'))
<th class="border table-background serial-option">{{ __('Serial') }}</th>
@endif
@if ($modules['allow_product_discount'] ?? false) @if ($modules['allow_product_discount'] ?? false)
<th class="border table-background">{{ __('Discount') }}</th> <th class="border table-background">{{ __('Discount') }}</th>
@endif @endif
<th class="border table-background">{{ __('Vat %') }}</th>
<th class="border table-background">{{ __('Vat Value') }}</th>
<th class="border table-background">{{ __('Qty') }}</th> <th class="border table-background">{{ __('Qty') }}</th>
<th class="border table-background">{{ __('Sub Total') }}</th> <th class="border table-background">{{ __('Sub Total') }}</th>
<th class="border table-background">{{ __('Action') }}</th> <th class="border table-background">{{ __('Action') }}</th>
</tr> </tr>
</thead> </thead>
<tbody class='text-start' id="sale_cart_list"> <tbody class='text-start' id="cart-list">
@include('business::sales.cart-list') @include('business::sales.cart-list')
</tbody> </tbody>
</table> </table>
@@ -168,25 +165,12 @@ class="form-control" placeholder="{{ __('Type note...') }}">
<h6 class="fw-bold" id="sub_total"> <h6 class="fw-bold" id="sub_total">
{{ currency_format(0, currency: business_currency()) }}</h6> {{ currency_format(0, currency: business_currency()) }}</h6>
</div> </div>
<div class="row save-amount-container align-items-center mb-2"> <div class="mb-2 d-flex align-items-center justify-content-between">
<h6 class="payment-title col-6">{{ __('Discount') }}</h6> <h6>{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2"> <h6 class="fw-bold" id="vat_amount_txt">
<div class="d-flex d-flex align-items-center gap-2"> {{ currency_format(($sale->vat_amount ?? 0) != 0 ? $sale->vat_amount : (($sale->vat_percent ?? 0) != 0 ? $sale->vat_percent : 0), currency: business_currency()) }}</h6>
<select name="discount_type" class="form-select discount_type" id='form-ware'>
<option value="flat" @selected($sale->discount_type == 'flat')>{{ __('Flat') }}
({{ business_currency()->symbol }})
</option>
<option value="percent" @selected($sale->discount_type == 'percent')>{{ __('Percent (%)') }}</option>
</select>
</div> </div>
<input type="number" step="any" name="discountAmount" <div class="row save-amount-container align-items-center mb-2 d-none">
value="{{ $sale->discount_type == 'percent' ? $sale->discount_percent : $sale->discountAmount }}"
id="discount_amount" min="0" class="right-start-input form-control"
placeholder="{{ __('0') }}">
</div>
</div>
<div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6> <h6 class="payment-title col-6">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2"> <div class="col-6 w-100 d-flex justify-content-between gap-2">
<div class="d-flex d-flex align-items-center gap-2"> <div class="d-flex d-flex align-items-center gap-2">
@@ -207,6 +191,24 @@ class="form-control" placeholder="{{ __('Type note...') }}">
</div> </div>
</div> </div>
<div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ __('Discount') }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2">
<div class="d-flex d-flex align-items-center gap-2">
<select name="discount_type" class="form-select discount_type" id='form-ware'>
<option value="flat" @selected($sale->discount_type == 'flat')>{{ __('Flat') }}
({{ business_currency()->symbol }})
</option>
<option value="percent" @selected($sale->discount_type == 'percent')>{{ __('Percent (%)') }}</option>
</select>
</div>
<input type="number" step="any" name="discountAmount"
value="{{ $sale->discount_type == 'percent' ? $sale->discount_percent : $sale->discountAmount }}"
id="discount_amount" min="0" class="right-start-input form-control"
placeholder="{{ __('0') }}">
</div>
</div>
<div class="shopping-crg-grid mb-2"> <div class="shopping-crg-grid mb-2">
<h6 class="payment-title">{{ __('Shipping Charge') }}</h6> <h6 class="payment-title">{{ __('Shipping Charge') }}</h6>
<div class=""> <div class="">
@@ -253,7 +255,7 @@ class="form-control right-start-input" placeholder="0">
<form action="{{ route('business.sales.product-filter') }}" method="post" class="product-filter product-filter-form" table="#products-list"> <form action="{{ route('business.sales.product-filter') }}" method="post" class="product-filter product-filter-form" table="#products-list">
@csrf @csrf
<div class="d-flex"> <div class="d-flex">
<input type="text" name="search" id="sale_product_search" class="form-control search-input" <input type="text" name="search" class="form-control search-input"
placeholder="{{ __('Search product...') }}"> placeholder="{{ __('Search product...') }}">
<button class="btn btn-search"> <button class="btn btn-search">
<i class="far fa-search"></i> <i class="far fa-search"></i>
@@ -301,16 +303,10 @@ class="btn btn-category w-100">{{ __('Category') }}</a>
<input type="hidden" id="asset_base_url" value="{{ asset('') }}"> <input type="hidden" id="asset_base_url" value="{{ asset('') }}">
<input type="hidden" id="get_stock_prices" value="{{ route('business.products.stocks-prices') }}"> <input type="hidden" id="get_stock_prices" value="{{ route('business.products.stocks-prices') }}">
<input type="hidden" id="warehouse_module_exist" value="{{ moduleCheck('WarehouseAddon') ? 1 : 0 }}"> <input type="hidden" id="warehouse_module_exist" value="{{ moduleCheck('WarehouseAddon') ? 1 : 0 }}">
<input type="hidden" id="has-serial-code-addon" value="{{ moduleCheck('SerialCodeAddon') }}">
<input type="hidden" id="check-serial-exist" value="{{ route('business.products.check-serial') }}">
<input type="hidden" id="get-product-serials" value="{{ route('business.products.get-serials') }}">
@endsection @endsection
@push('modal') @push('modal')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::select-serial-modal')
@endif
@include('business::sales.calculator') @include('business::sales.calculator')
@include('business::sales.category-search') @include('business::sales.category-search')
@include('business::sales.brand-search') @include('business::sales.brand-search')

View File

@@ -4,10 +4,6 @@
{{ __('Sales List') }} {{ __('Sales List') }}
@endsection @endsection
@php
$modules = product_setting()->modules ?? [];
@endphp
@section('main_content') @section('main_content')
<div class="erp-table-section"> <div class="erp-table-section">
<div class="container-fluid"> <div class="container-fluid">

View File

@@ -15,11 +15,11 @@
<h4>{{ __('Inventory Sales') }}</h4> <h4>{{ __('Inventory Sales') }}</h4>
</div> </div>
<div class="order-form-section p-16"> <div class="order-form-section p-16">
<form action="{{ route('business.sales.store') }}" method="post" enctype="multipart/form-data" class="ajaxform" inventory-sale="1"> <form action="{{ route('business.sales.store') }}" method="post" enctype="multipart/form-data"
class="ajaxform">
@csrf @csrf
<input type="hidden" name="type" value="inventory"> <input type="hidden" name="type" value="inventory">
<div class="row "> <div class="row mt-3">
<div class="col-lg-4"> <div class="col-lg-4">
<label>{{ __('Customer') }}</label> <label>{{ __('Customer') }}</label>
<div class="input-group"> <div class="input-group">
@@ -67,7 +67,7 @@ class="btn btn-danger square-btn d-flex justify-content-center align-items-cente
</div> </div>
<div class="dropdown-search hidden" id="searchContainer"> <div class="dropdown-search hidden" id="searchContainer">
<input type="text" id="productSearch" placeholder="{{__('Search product...')}}" /> <input type="text" id="productSearch" placeholder="Search product..." />
</div> </div>
<div class="product-dropdown-options" id="dropdownList"> <div class="product-dropdown-options" id="dropdownList">
@@ -98,18 +98,17 @@ class="btn btn-danger square-btn d-flex justify-content-center align-items-cente
<th class="border p-2 table-background">{{ __('Batch') }}</th> <th class="border p-2 table-background">{{ __('Batch') }}</th>
<th class="border p-2 table-background">{{ __('Unit') }}</th> <th class="border p-2 table-background">{{ __('Unit') }}</th>
<th class="border p-2 table-background">{{ __('Sale Price') }}</th> <th class="border p-2 table-background">{{ __('Sale Price') }}</th>
@if (moduleCheck('SerialCodeAddon'))
<th class="border table-background serial-option">{{ __('Serial') }}</th>
@endif
@if ($modules['allow_product_discount'] ?? false) @if ($modules['allow_product_discount'] ?? false)
<th class="border p-2 table-background">{{ __('Discount') }}</th> <th class="border p-2 table-background">{{ __('Discount') }}</th>
@endif @endif
<th class="border p-2 table-background">{{ __('Vat %') }}</th>
<th class="border p-2 table-background">{{ __('Vat Value') }}</th>
<th class="border p-2 table-background">{{ __('Qty') }}</th> <th class="border p-2 table-background">{{ __('Qty') }}</th>
<th class="border p-2 table-background">{{ __('Sub Total') }}</th> <th class="border p-2 table-background">{{ __('Sub Total') }}</th>
<th class="border p-2 table-background">{{ __('Action') }}</th> <th class="border p-2 table-background">{{ __('Action') }}</th>
</tr> </tr>
</thead> </thead>
<tbody id="sale_cart_list"> <tbody id="cart-list">
@include('business::sales.cart-list') @include('business::sales.cart-list')
</tbody> </tbody>
</table> </table>
@@ -150,23 +149,12 @@ class="btn btn-danger square-btn d-flex justify-content-center align-items-cente
<h6 class="fw-bold" id="sub_total"> <h6 class="fw-bold" id="sub_total">
{{ currency_format(0, currency: business_currency()) }}</h6> {{ currency_format(0, currency: business_currency()) }}</h6>
</div> </div>
<div class="row save-amount-container align-items-center mb-2"> <div class="mb-2 d-flex align-items-center justify-content-between">
<h6 class="payment-title col-6">{{ __('Discount') }}</h6> <h6>{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2"> <h6 class="fw-bold" id="vat_amount_txt">
<div class="d-flex d-flex align-items-center gap-2"> {{ currency_format(0, currency: business_currency()) }}</h6>
<select name="discount_type" class="form-select discount_type"
id='form-ware'>
<option value="flat">{{ __('Flat') }}
({{ business_currency()->symbol }})</option>
<option value="percent">{{ __('Percent (%)') }}</option>
</select>
</div> </div>
<input type="number" step="any" name="discountAmount" id="discount_amount" <div class="row save-amount-container align-items-center mb-2 d-none">
min="0" class="form-control right-start-input"
placeholder="{{ __('0') }}">
</div>
</div>
<div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6> <h6 class="payment-title col-6">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2"> <div class="col-6 w-100 d-flex justify-content-between gap-2">
<div class="d-flex d-flex align-items-center gap-2"> <div class="d-flex d-flex align-items-center gap-2">
@@ -185,6 +173,22 @@ class="btn btn-danger square-btn d-flex justify-content-center align-items-cente
placeholder="{{ __('0') }}" readonly> placeholder="{{ __('0') }}" readonly>
</div> </div>
</div> </div>
<div class="row save-amount-container align-items-center mb-2">
<h6 class="payment-title col-6">{{ __('Discount') }}</h6>
<div class="col-6 w-100 d-flex justify-content-between gap-2">
<div class="d-flex d-flex align-items-center gap-2">
<select name="discount_type" class="form-select discount_type"
id='form-ware'>
<option value="flat">{{ __('Flat') }}
({{ business_currency()->symbol }})</option>
<option value="percent">{{ __('Percent (%)') }}</option>
</select>
</div>
<input type="number" step="any" name="discountAmount" id="discount_amount"
min="0" class="form-control right-start-input"
placeholder="{{ __('0') }}">
</div>
</div>
<div class="shopping-crg-grid mb-2"> <div class="shopping-crg-grid mb-2">
<h6 class="payment-title">{{ __('Shipping Charge') }}</h6> <h6 class="payment-title">{{ __('Shipping Charge') }}</h6>
<div class=""> <div class="">
@@ -243,16 +247,10 @@ class="theme-btn border-btn m-2">{{__('Cancel')}}
<input type="hidden" id="selectedProductValue" name="selectedProductValue"> <input type="hidden" id="selectedProductValue" name="selectedProductValue">
<input type="hidden" id="asset_base_url" value="{{ url('/') }}"> <input type="hidden" id="asset_base_url" value="{{ url('/') }}">
<input type="hidden" id="get_stock_prices" value="{{ route('business.products.stocks-prices') }}"> <input type="hidden" id="get_stock_prices" value="{{ route('business.products.stocks-prices') }}">
<input type="hidden" id="has-serial-code-addon" value="{{ moduleCheck('SerialCodeAddon') }}">
<input type="hidden" id="check-serial-exist" value="{{ route('business.products.check-serial') }}">
<input type="hidden" id="get-product-serials" value="{{ route('business.products.get-serials') }}">
@endsection @endsection
@push('modal') @push('modal')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::select-serial-modal')
@endif
@include('business::sales.calculator') @include('business::sales.calculator')
@include('business::sales.customer-create') @include('business::sales.customer-create')
@endpush @endpush

View File

@@ -5,11 +5,9 @@
@endsection @endsection
@section('main_content') @section('main_content')
@if (invoice_setting($sale->business_id) == '3_inch_80mm' && moduleCheck('ThermalPrinterAddon')) @if (invoice_setting() == '3_inch_80mm' && moduleCheck('ThermalPrinterAddon'))
@include('thermalprinteraddon::sales.3_inch_80mm') @include('thermalprinteraddon::sales.3_inch_80mm')
@else @else
@include('business::sales.invoices.a4-size') @include('business::sales.invoices.a4-size')
@endif @endif
@endsection @endsection

View File

@@ -1,56 +1,38 @@
@php
$isBusinessRoute = request()->routeIs('business.sales.*');
$business_id = $sale->business_id;
$modules = product_setting($business_id)->modules ?? [];
@endphp
<div class="invoice-container"> <div class="invoice-container">
<div class="invoice-content p-4"> <div class="invoice-content p-4">
{{-- Print Header --}} {{-- Print Header --}}
<div <div class="row py-2 d-flex align-items-start justify-content-between border-bottom print-container d-print-none">
class="row py-2 d-flex align-items-start justify-content-between border-bottom print-container d-print-none">
<div class="col-md-3 d-flex align-items-center p-2"> <div class="col-md-6 d-flex align-items-center p-2">
<span class="Money-Receipt">{{ __('Sales Invoice') }}</span> <span class="Money-Receipt">{{ __('Sales Invoice') }}</span>
</div> </div>
@if($isBusinessRoute) <div class="col-md-6 d-flex justify-content-end align-items-end">
<div class="col-md-9 d-flex justify-content-start justify-content-md-end align-items-end"> <div class="d-flex gap-2">
<div class="d-flex gap-2 flex-wrap">
<a href="javascript:void(0)" class="pdf-btn print-btn share-btn" data-bs-toggle="modal" data-bs-target="#shareModalDues">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.8303 3.75H6.96224C4.50701 3.75 3.27939 3.75 2.51665 4.48223C1.75391 5.21447 1.75391 6.39298 1.75391 8.75V12.0833C1.75391 14.4403 1.75391 15.6188 2.51665 16.3511C3.27939 17.0833 4.50701 17.0833 6.96224 17.0833H10.4678C12.923 17.0833 14.1506 17.0833 14.9133 16.3511C15.4075 15.8767 15.5815 15.2149 15.6428 14.1667" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
<path d="M13.4723 5.83073V3.20869C13.4723 3.04597 13.6097 2.91406 13.7792 2.91406C13.8605 2.91406 13.9386 2.9451 13.9962 3.00035L17.9396 6.7861C18.1362 6.97475 18.2465 7.23061 18.2465 7.4974C18.2465 7.76418 18.1362 8.02005 17.9396 8.20869L13.9962 11.9944C13.9386 12.0497 13.8605 12.0807 13.7792 12.0807C13.6097 12.0807 13.4723 11.9488 13.4723 11.7861V9.16406H10.9298C7.39583 9.16406 6.09375 12.0807 6.09375 12.0807V9.9974C6.09375 7.69621 8.03696 5.83073 10.434 5.83073H13.4723Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
</svg>
{{__('Share')}} <form action="{{ route('business.sales.mail', ['sale_id' => $sale->id]) }}" method="POST"
</a> class="ajaxform_instant_reload ">
<form action="{{ route('business.sales.mail', ['sale_id' => $sale->id]) }}" method="POST" class="ajaxform_instant_reload">
@csrf @csrf
<button type="submit" class="btn custom-print-btn submit-btn">
<img class="w-10 h-10" src="{{ asset('assets/img/email.svg') }}"> <button type="submit" class="btn custom-print-btn"><img class="w-10 h-10"
<span class="text-white pl-1">{{ __('Email') }}</span> src="{{ asset('assets/img/email.svg') }}"><span class="text-white pl-1">{{ __('Email') }}</span>
</button> </button>
</form> </form>
<a target="_blank" class="pdf-btn print-btn" <a target="blank" class="pdf-btn print-btn" href="{{ route('business.sales.pdf', ['sale_id' => $sale->id]) }}">
href="{{ route('business.sales.pdf', ['sale_id' => $sale->id]) }}">
<img class="w-10 h-10" src="{{ asset('assets/img/pdf.svg') }}"> <img class="w-10 h-10" src="{{ asset('assets/img/pdf.svg') }}">
{{ __('PDF') }} {{ __('PDF') }}
</a> </a>
<a class="print-btn-2 print-btn" onclick="window.print()"><img class="w-10 h-10" src="{{ asset('assets/img/print.svg') }}"> <a class="print-btn-2 print-btn" onclick="window.print()"><img class="w-10 h-10" src="{{ asset('assets/img/print.svg') }}">{{ __('Print') }}</a>
{{ __('Print') }}
</a>
</div> </div>
</div> </div>
@endif
</div> </div>
<div class="d-flex justify-content-between align-items-center gap-3 print-logo-container"> <div class="d-flex justify-content-between align-items-center gap-3 print-logo-container">
{{-- Left Side: Logo and Content --}} {{-- Left Side: Logo and Content --}}
<div class="d-flex align-items-center gap-2 logo pdf-logo"> <div class="d-flex align-items-center gap-2 logo pdf-logo">
@if ((get_business_option('business-settings', $business_id)['show_a4_invoice_logo'] ?? 0) == 1) @if ((get_business_option('business-settings')['show_a4_invoice_logo'] ?? 0) == 1 )
<img class="invoice-logo" src="{{ Storage::url(get_business_option('business-settings', $business_id)['a4_invoice_logo'] ?? 'assets/images/default.svg') }}"> <img class="invoice-logo" src="{{ asset(get_business_option('business-settings')['a4_invoice_logo'] ?? 'assts/images/default.svg') ?? '' }}">
@endif @endif
</div> </div>
@@ -88,14 +70,17 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
<td class="text-start bold-title">{{ __('Customer') }}</td> <td class="text-start bold-title">{{ __('Customer') }}</td>
<td class="text-start">: {{ $sale->party->name ?? 'Guest' }}</td> <td class="text-start">: {{ $sale->party->name ?? 'Guest' }}</td>
</tr> </tr>
<tr class="in-table-row"> <tr class="in-table-row">
<td class="text-start bold-title">{{ __('Address') }}</td> <td class="text-start bold-title">{{ __('Address') }}</td>
<td class="text-start">: {{ $sale->party->address ?? '' }}</td> <td class="text-start">: {{ $sale->party->address ?? '' }}</td>
</tr> </tr>
<tr class="in-table-row "> <tr class="in-table-row ">
<td class="text-start bold-title">{{ __('Phone') }}</td> <td class="text-start bold-title">{{ __('Phone') }}</td>
<td class="text-start">: {{ $sale->party->phone ?? 'Guest' }}</td> <td class="text-start">: {{ $sale->party->phone ?? 'Guest' }}</td>
</tr> </tr>
<tr class="in-table-row "> <tr class="in-table-row ">
<td class="text-start bold-title">{{ __('Remarks') }}</td> <td class="text-start bold-title">{{ __('Remarks') }}</td>
<td class="text-start">: <td class="text-start">:
@@ -128,8 +113,9 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
</table> </table>
</div> </div>
</div> </div>
{{-- SALE + RETURN --}} {{-- Sale Return --}}
@if (!$sale_returns->isEmpty()) @if (!$sale_returns->isEmpty())
{{-- Sales portion--}}
<div class="table-content custom-invoice-table"> <div class="table-content custom-invoice-table">
<table class="table table-striped mb-1"> <table class="table table-striped mb-1">
<thead> <thead>
@@ -144,39 +130,33 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
<th class="head-black text-center white-text">{{ __('Guarantee') }}</th> <th class="head-black text-center white-text">{{ __('Guarantee') }}</th>
@endif @endif
<th class="head-black text-end white-text">{{ __('Unit Price') }}</th> <th class="head-black text-end white-text">{{ __('Unit Price') }}</th>
@if (is_module_enabled($modules, 'allow_product_discount'))
<th class="head-black text-end white-text">{{ __('Discount') }}</th> <th class="head-black text-end white-text">{{ __('Discount') }}</th>
@endif <th class="head-black text-end white-text">{{ __('Vat %') }}</th>
<th class="head-black text-end white-text">{{ __('Vat Value') }}</th>
<th class="head-black text-end white-text">{{ __('Total') }}</th> <th class="head-black text-end white-text">{{ __('Total Price') }}</th>
</tr> </tr>
</thead> </thead>
@php @php
$subtotal = 0; $subtotal = 0;
$total_product_vat = 0;
@endphp @endphp
<tbody class="in-table-body-container"> <tbody class="in-table-body-container">
@foreach ($sale->details as $detail) @foreach ($sale->details as $detail)
@php @php
$price = $detail->price ?? 0; $price = $detail->price ?? 0;
$exclusive_price = ($detail->price_without_tax && $detail->price_without_tax > 0) ? $detail->price_without_tax : ($detail->price ?? 0);
$discount = $detail->discount ?? 0; $discount = $detail->discount ?? 0;
$qty = $detail->quantities ?? 0; $qty = $detail->quantities ?? 0;
$productTotal = ($price - $discount) * $qty; $productTotal = ($price - $discount) * $qty;
$product_vat = $productTotal - ($exclusive_price * $qty ?? 1); $subtotal += $productTotal;
$subtotal += $exclusive_price * ($qty ?? 1);
$total_product_vat += $product_vat;
$info = $detail->warranty_guarantee_info ?? []; $info = $detail->warranty_guarantee_info ?? [];
$vat_percent = $detail->product->vat->rate ?? 0;
$vat_value = ($price * $qty) * ($vat_percent / 100);
@endphp @endphp
<tr class="in-table-body"> <tr class="in-table-body">
<td class="text-center">{{ $loop->iteration }}</td> <td class="text-center">{{ $loop->iteration }}</td>
<td class="text-start"> <td class="text-start">
<div class="invoice-item"> <div class="invoice-item">
{{ ($detail->product->productName ?? '') . (!empty($detail->stock->batch_no) ? ' (' . $detail->stock->batch_no . ')' : '') }} {{ ($detail->product->productName ?? '') . (!empty($detail->stock->batch_no) ? ' (' . $detail->stock->batch_no . ')' : '') }}
@if(moduleCheck('SerialCodeAddon') && ($detail->product->has_serial ?? 0) == 1)
<p>{{__('Serial')}}: {{ is_array($detail->serial_numbers) ? implode(', ', $detail->serial_numbers) : $detail->serial_numbers }}</p>
@endif
</div> </div>
</td> </td>
<td class="text-center">{{ $detail->quantities ?? '' }}</td> <td class="text-center">{{ $detail->quantities ?? '' }}</td>
@@ -194,11 +174,11 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
@endif @endif
</td> </td>
@endif @endif
<td class="text-end">{{ currency_format($detail->price ?? 0, currency: business_currency($business_id)) }}</td> <td class= "text-end">{{ currency_format($detail->price ?? 0, currency: business_currency()) }}</td>
@if (is_module_enabled($modules, 'allow_product_discount')) <td class= "text-end">{{ currency_format($discount, currency: business_currency()) }}</td>
<td class="text-end">{{ currency_format($discount, currency: business_currency($business_id)) }}</td> <td class="text-end">{{ $vat_percent }}%</td>
@endif <td class="text-end">{{ currency_format($vat_value, currency: business_currency()) }}</td>
<td class="text-end">{{ currency_format($productTotal, currency: business_currency($business_id)) }}</td> <td class="text-end">{{ currency_format($productTotal, currency: business_currency()) }}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
@@ -223,20 +203,20 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Subtotal') }}</td> <td class="text-end">{{ __('Subtotal') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end">{{ currency_format($subtotal, currency: business_currency($business_id)) }}</td> <td class="text-end">{{ currency_format($subtotal, currency: business_currency()) }}
</td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ get_business_option('business-settings', $business_id)['vat_name'] ?? 'Vat' }}</td> <td class="text-end">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($sale->vat_amount + $total_product_vat, currency: business_currency($business_id)) }} {{ currency_format($sale->vat_amount, currency: business_currency()) }}</td>
</td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Shipping Charge') }}</td> <td class="text-end">{{ __('Shipping Charge') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($sale->shipping_charge, currency: business_currency($business_id)) }} {{ currency_format($sale->shipping_charge, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom border-bottom-dis"> <tr class="in-table-row-bottom border-bottom-dis">
@@ -247,28 +227,28 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
</td> </td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($sale->discountAmount + $total_discount, currency: business_currency($business_id)) }} {{ currency_format($sale->discountAmount + $total_discount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Total Amount') }}</td> <td class="text-end">{{ __('Total Amount') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($subtotal + $total_product_vat + $sale->vat_amount - ($sale->discountAmount + $total_discount) + $sale->shipping_charge + $sale->rounding_amount, currency: business_currency($business_id)) }} {{ currency_format($subtotal + $sale->vat_amount - ($sale->discountAmount + $total_discount) + $sale->shipping_charge + $sale->rounding_amount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Rounding(+/-)') }}</td> <td class="text-end">{{ __('Rounding(+/-)') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format(abs($sale->rounding_amount), currency: business_currency($business_id)) }} {{ currency_format(abs($sale->rounding_amount), currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end total-amound white-text ">{{ __('Total Payable') }}</td> <td class="text-end total-amound white-text ">{{ __('Total Payable') }}</td>
<td class="text-end total-amound white-text ">:</td> <td class="text-end total-amound white-text ">:</td>
<td class="text-end total-amound white-text "> <td class="text-end total-amound white-text ">
{{ currency_format($subtotal + $total_product_vat+ $sale->vat_amount - ($sale->discountAmount + $total_discount) + $sale->shipping_charge, currency: business_currency($business_id)) }} {{ currency_format($subtotal + $sale->vat_amount - ($sale->discountAmount + $total_discount) + $sale->shipping_charge, currency: business_currency()) }}
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -301,20 +281,16 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
@endphp @endphp
<tr class="in-table-body"> <tr class="in-table-body">
<td class="text-center">{{ $row_counter }}</td> <td class="text-center">{{ $row_counter }}</td>
<td class="text-start">{{ formatted_datetime($return->return_date) }}</td> <td class="text-start">{{ formatted_date($return->return_date) }}</td>
<td class="text-start"> <td class="text-start">
<div class="invoice-item"> <div class="invoice-item">
{{ $detail->saleDetail->product->productName ?? '' }} {{ $detail->saleDetail->product->productName ?? '' }}
{{ $detail->saleDetail?->stock?->batch_no ? '(' . $detail->saleDetail?->stock?->batch_no . ')' : '' }} {{ $detail->saleDetail?->stock?->batch_no ? '(' . $detail->saleDetail?->stock?->batch_no . ')' : '' }}
@if(moduleCheck('SerialCodeAddon') && ($detail->saleDetail->product->has_serial ?? 0) == 1)
<p>{{__('Serial')}}
: {{ is_array($detail->serial_numbers) ? implode(', ', $detail->serial_numbers) : $detail->serial_numbers }}</p>
@endif
</div> </div>
</td> </td>
<td class="text-center">{{ $detail->return_qty ?? 0 }}</td> <td class="text-center">{{ $detail->return_qty ?? 0 }}</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($detail->return_amount ?? 0, currency: business_currency($business_id)) }} {{ currency_format($detail->return_amount ?? 0, currency: business_currency()) }}
</td> </td>
</tr> </tr>
@endforeach @endforeach
@@ -323,7 +299,7 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
</table> </table>
</div> </div>
<div class="d-flex align-items-start justify-content-between position-relative bottom-info-container mt-3"> <div class="d-flex align-items-start justify-content-between position-relative bottom-info-container mt-3">
<h2 class="word-amount">{{ amountInWords($total_return_amount, business_id: $business_id) }}</h2> <h2 class="word-amount">{{ amountInWords($total_return_amount) }}</h2>
<div> <div>
<table class="table"> <table class="table">
<tbody> <tbody>
@@ -334,11 +310,11 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
</tr> </tr>
<tr class="in-table-row"> <tr class="in-table-row">
<td class="text-start paid-by"> <td class="text-start paid-by">
@if ((get_business_option('business-settings', $business_id)['show_note'] ?? 0 == 1)) @if ((get_business_option('business-settings')['show_note'] ?? 0 == 1))
{{ get_business_option('business-settings', $business_id)['note_label'] ?? '' }} : {{ get_business_option('business-settings')['note_label'] ?? '' }} :
@endif @endif
@if ((get_business_option('business-settings', $business_id)['show_note'] ?? 0 == 1)) @if ((get_business_option('business-settings')['show_note'] ?? 0 == 1))
{{ get_business_option('business-settings', $business_id)['note'] ?? '' }} {{ get_business_option('business-settings')['note'] ?? '' }}
@endif @endif
</td> </td>
</tr> </tr>
@@ -348,7 +324,7 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
@if ($bank_detail->show_in_invoice ?? 0 == 1) @if ($bank_detail->show_in_invoice ?? 0 == 1)
<div class="bank-details-container"> <div class="bank-details-container">
<div class="bank-details-title"> <div class="bank-details-title">
{{__('Bank Details')}} Bank Details
</div> </div>
<div class="back-details-content"> <div class="back-details-content">
<table class="table mb-2"> <table class="table mb-2">
@@ -386,36 +362,36 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Total Return Amount') }}</td> <td class="text-end">{{ __('Total Return Amount') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end">{{ currency_format($total_return_amount, currency: business_currency($business_id)) }}</td> <td class="text-end">{{ currency_format($total_return_amount, currency: business_currency()) }}</td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end total-amound white-text">{{ __('Payable Amount') }}</td> <td class="text-end total-amound white-text">{{ __('Payable Amount') }}</td>
<td class="text-end total-amound white-text">:</td> <td class="text-end total-amound white-text">:</td>
<td class="text-end total-amound white-text">{{ currency_format($sale->totalAmount, currency: business_currency($business_id)) }}</td> <td class="text-end total-amound white-text">{{ currency_format($sale->totalAmount, currency: business_currency()) }}</td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Paid Amount') }}</td> <td class="text-end">{{ __('Paid Amount') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end">{{ currency_format($sale->paidAmount, currency: business_currency($business_id)) }}</td> <td class="text-end">{{ currency_format($sale->paidAmount, currency: business_currency()) }}</td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Due') }}</td> <td class="text-end">{{ __('Due') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end">{{ currency_format($sale->dueAmount, currency: business_currency($business_id)) }}</td> <td class="text-end">{{ currency_format($sale->dueAmount, currency: business_currency()) }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
{{-- Only SALE --}}
@else @else
{{-- Sales --}}
<div class="custom-invoice-table"> <div class="custom-invoice-table">
<table class="table table-striped mb-1"> <table class="table table-striped mb-1">
<thead> <thead>
<tr class="in-table-header"> <tr class="in-table-header">
<th class="head-red text-center white-text">{{ __('SL') }}</th> <th class="head-red text-center white-text">{{ __('SL') }}</th>
<th class="head-red text-start white-text invoice-item">{{ __('Item') }}</th> <th class="head-red text-start white-text invoice-item">{{ __('Item') }}</th>
<th class="head-black text-center white-text">{{ __('Qty') }}</th> <th class="head-black text-center white-text">{{ __('Quantity') }}</th>
@if ($hasWarranty) @if ($hasWarranty)
<th class="head-black text-center white-text">{{ __('Warranty') }}</th> <th class="head-black text-center white-text">{{ __('Warranty') }}</th>
@endif @endif
@@ -423,39 +399,33 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
<th class="head-black text-center white-text">{{ __('Guarantee') }}</th> <th class="head-black text-center white-text">{{ __('Guarantee') }}</th>
@endif @endif
<th class="head-black text-end white-text">{{ __('Unit Price') }}</th> <th class="head-black text-end white-text">{{ __('Unit Price') }}</th>
@if (is_module_enabled($modules, 'allow_product_discount'))
<th class="head-black text-end white-text">{{ __('Discount') }}</th> <th class="head-black text-end white-text">{{ __('Discount') }}</th>
@endif <th class="head-black text-end white-text">{{ __('Vat %') }}</th>
<th class="head-black text-end white-text">{{ __('Total') }}</th> <th class="head-black text-end white-text">{{ __('Vat Value') }}</th>
<th class="head-black text-end white-text">{{ __('Total Price') }}</th>
</tr> </tr>
</thead> </thead>
@php @php
$subtotal = 0; $subtotal = 0;
$total_product_vat = 0;
@endphp @endphp
<tbody class="in-table-body-container"> <tbody class="in-table-body-container">
@foreach ($sale->details as $detail) @foreach ($sale->details as $detail)
@php @php
$price = $detail->price ?? 0; $price = $detail->price ?? 0;
$exclusive_price = ($detail->price_without_tax && $detail->price_without_tax > 0) ? $detail->price_without_tax : ($detail->price ?? 0);
$discount = $detail->discount ?? 0; $discount = $detail->discount ?? 0;
$qty = $detail->quantities ?? 0; $qty = $detail->quantities ?? 0;
$productTotal = ($price - $discount) * $qty; $productTotal = ($price - $discount) * $qty;
$product_vat = $productTotal - ($exclusive_price * $qty ?? 1); $subtotal += $productTotal;
$subtotal += $exclusive_price * ($qty ?? 1);
$total_product_vat += $product_vat;
$info = $detail->warranty_guarantee_info ?? []; $info = $detail->warranty_guarantee_info ?? [];
$vat_percent = $detail->product->vat->rate ?? 0;
$vat_value = ($price * $qty) * ($vat_percent / 100);
@endphp @endphp
<tr class="in-table-body"> <tr class="in-table-body">
<td class="text-center">{{ $loop->iteration }}</td> <td class="text-center">{{ $loop->iteration }}</td>
<td class="text-start"> <td class="text-start">
<div class="invoice-item"> <div class="invoice-item">
{{ ($detail->product->productName ?? '') . (!empty($detail->stock?->batch_no) ? ' (' . $detail->stock?->batch_no . ')' : '') }} {{ ($detail->product->productName ?? '') . (!empty($detail->stock?->batch_no) ? ' (' . $detail->stock?->batch_no . ')' : '') }}
@if(moduleCheck('SerialCodeAddon') && ($detail->product->has_serial ?? 0) == 1)
<p>{{__('Serial')}}
: {{ is_array($detail->serial_numbers) ? implode(', ', $detail->serial_numbers) : $detail->serial_numbers }}</p>
@endif
</div> </div>
</td> </td>
<td class="text-center">{{ $detail->quantities ?? '' }}</td> <td class="text-center">{{ $detail->quantities ?? '' }}</td>
@@ -473,19 +443,19 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
@endif @endif
</td> </td>
@endif @endif
<td class="text-end">{{ currency_format($detail->price ?? 0, currency: business_currency($business_id)) }}</td> <td class="text-end">{{ currency_format($detail->price ?? 0, currency: business_currency()) }}</td>
@if (is_module_enabled($modules, 'allow_product_discount')) <td class="text-end">{{ currency_format($discount, currency: business_currency()) }}</td>
<td class="text-end">{{ currency_format($discount, currency: business_currency($business_id)) }}</td> <td class="text-end">{{ $vat_percent }}%</td>
@endif <td class="text-end">{{ currency_format($vat_value, currency: business_currency()) }}</td>
<td class="text-end">{{ currency_format($productTotal, currency: business_currency($business_id)) }}</td> <td class="text-end">{{ currency_format($productTotal, currency: business_currency()) }}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="d-flex align-items-start justify-content-between position-relative bottom-info-container mt-3">
<h2 class="word-amount">{{ amountInWords($sale->totalAmount, business_id: $business_id) }}</h2>
<div class="d-flex align-items-start justify-content-between position-relative bottom-info-container mt-3">
<h2 class="word-amount">{{ amountInWords($subtotal) }}</h2>
<div> <div>
<table class="table"> <table class="table">
<tbody> <tbody>
@@ -496,11 +466,11 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
</tr> </tr>
<tr class="in-table-row"> <tr class="in-table-row">
<td class="text-start paid-by"> <td class="text-start paid-by">
@if ((get_business_option('business-settings', $business_id)['show_note'] ?? 0 == 1)) @if ((get_business_option('business-settings')['show_note'] ?? 0 == 1))
{{ get_business_option('business-settings', $business_id)['note_label'] ?? '' }} : {{ get_business_option('business-settings')['note_label'] ?? '' }} :
@endif @endif
@if ((get_business_option('business-settings', $business_id)['show_note'] ?? 0 == 1)) @if ((get_business_option('business-settings')['show_note'] ?? 0 == 1))
{{ get_business_option('business-settings', $business_id)['note'] ?? '' }} {{ get_business_option('business-settings')['note'] ?? '' }}
@endif @endif
</td> </td>
</tr> </tr>
@@ -548,21 +518,21 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Subtotal') }}</td> <td class="text-end">{{ __('Subtotal') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end">{{ currency_format($subtotal, currency: business_currency($business_id)) }} <td class="text-end">{{ currency_format($subtotal, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ get_business_option('business-settings', $business_id)['vat_name'] ?? 'Vat' }}</td> <td class="text-end">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($sale->vat_amount + $total_product_vat, currency: business_currency($business_id)) }} {{ currency_format($sale->vat_amount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Shipping Charge') }}</td> <td class="text-end">{{ __('Shipping Charge') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($sale->shipping_charge, currency: business_currency($business_id)) }} {{ currency_format($sale->shipping_charge, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom border-bottom-dis"> <tr class="in-table-row-bottom border-bottom-dis">
@@ -573,35 +543,35 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
</td> </td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($sale->discountAmount, currency: business_currency($business_id)) }} {{ currency_format($sale->discountAmount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Total Amount') }}</td> <td class="text-end">{{ __('Total Amount') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($sale->actual_total_amount, currency: business_currency($business_id)) }} {{ currency_format($sale->actual_total_amount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Rounding(+/-)')}}</td> <td class="text-end">{{ __('Rounding(+/-)')}}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format(abs($sale->rounding_amount), currency: business_currency($business_id)) }} {{ currency_format(abs($sale->rounding_amount), currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end total-amound white-text">{{ __('Payable Amount') }}</td> <td class="text-end total-amound white-text">{{ __('Payable Amount') }}</td>
<td class="text-end total-amound white-text">:</td> <td class="text-end total-amound white-text">:</td>
<td class="text-end total-amound white-text"> <td class="text-end total-amound white-text">
{{ currency_format($sale->totalAmount, currency: business_currency($business_id)) }} {{ currency_format($sale->totalAmount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end">{{ __('Receive Amount') }}</td> <td class="text-end">{{ __('Receive Amount') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($sale->paidAmount + $sale->change_amount, currency: business_currency($business_id)) }} {{ currency_format($sale->paidAmount + $sale->change_amount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
@if($sale->change_amount > 0) @if($sale->change_amount > 0)
@@ -609,7 +579,7 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
<td class="text-end">{{ __('Change Amount') }}</td> <td class="text-end">{{ __('Change Amount') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($sale->change_amount, currency: business_currency($business_id)) }} {{ currency_format($sale->change_amount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
@else @else
@@ -617,7 +587,7 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
<td class="text-end">{{ __('Due') }}</td> <td class="text-end">{{ __('Due') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <td class="text-end">
{{ currency_format($sale->dueAmount, currency: business_currency($business_id)) }} {{ currency_format($sale->dueAmount, currency: business_currency()) }}
</td> </td>
</tr> </tr>
@endif @endif
@@ -627,7 +597,7 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
</div> </div>
@endif @endif
<div class="pdf-footer"> <div class="pdf-footer">
<div class="in-signature-container d-flex align-items-center justify-content-between gap-2 my-3 px-2"> <div class="in-signature-container d-flex align-items-center justify-content-between my-3 px-2">
<div class="in-signature"> <div class="in-signature">
<hr class="in-hr"> <hr class="in-hr">
<h4>{{ __('Customer Signature') }}</h4> <h4>{{ __('Customer Signature') }}</h4>
@@ -639,26 +609,15 @@ class="row py-2 d-flex align-items-start justify-content-between border-bottom p
</div> </div>
</div> </div>
@if ((get_business_option('business-settings', $business_id)['show_warranty'] ?? 0) == 1) @if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
<div class="warranty-container-2"> <div class="warranty-container-2">
<p> <p>
@if ((get_business_option('business-settings', $business_id)['show_warranty'] ?? 0) == 1) @if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
<span>{{ get_business_option('business-settings', $business_id)['warranty_void_label'] ?? '' }} - </span> <span>{{ get_business_option('business-settings')['warranty_void_label'] ?? '' }} - </span>
@endif @endif
{{ get_business_option('business-settings', $business_id)['warranty_void'] ?? '' }} {{ get_business_option('business-settings')['warranty_void'] ?? '' }}
</p> </p>
</div> </div>
@endif @endif
<h4 class="tax-powered pt-3 pb-0">{{ get_option('general')['admin_footer_text'] ?? '' }}
: {{ get_option('general')['admin_footer_link_text'] ?? '' }}</h4>
</div> </div>
</div> </div>
@php
$shareUrl = $sale->unique_id ? route('sale.invoice.unique', $sale->unique_id) : ($sale->party?->phone ? route('sale.invoice', ['sale_id' => $sale->id, 'phone' => $sale->party?->phone]) : '');
$facebook = $shareUrl ? 'https://www.facebook.com/sharer/sharer.php?u=' . urlencode($shareUrl) : '';
$twitter = $shareUrl ? 'https://twitter.com/intent/tweet?url=' . urlencode($shareUrl) : '';
$whatsapp = $shareUrl ? 'https://wa.me/?text=' . urlencode($shareUrl) : '';
@endphp
@include('business::component.share-modal', ['copy' => $shareUrl, 'facebook' => $facebook, 'twitter' => $twitter, 'whatsapp' => $whatsapp])

View File

@@ -1,10 +1,9 @@
@extends('layouts.business.pdf.pdf_layout') @extends('layouts.business.pdf.pdf_layout')
@section('pdf_title') @section('pdf_title')
<style> <style>
body { body {
font-family: notosansarmenian, sans-serif; font-family: sans-serif;
font-size: 12px; font-size: 12px;
color: #000; color: #000;
} }
@@ -12,8 +11,6 @@
.invoice-container { .invoice-container {
width: 100%; width: 100%;
padding: 10px; padding: 10px;
direction: {{ app()->getLocale() == 'ar' ? 'rtl' : 'ltr' }};
text-align: {{ app()->getLocale() == 'ar' ? 'right' : 'left' }};
} }
.border-none { .border-none {
@@ -151,36 +148,10 @@
@include('business::pdf.fonts-css') @include('business::pdf.fonts-css')
<style> <style>
body { body {
font-family: notosansarmenian, sans-serif; font-family: sans-serif;
font-size: 12px; font-size: 12px;
} }
:root {
--clr-primary: var(--dynamic-primary, #c52127);
--secondary-color: var(--dynamic-secondary, #0071bc);
--sidebar-color: var(--dynamic-sidebar, #201415);
--accent-color: var(--dynamic-accent, #fef0f1);
--clr-white: #fff;
--clr-white2: #f9f9f9;
--clr-white3: #f3f7ff;
--clr-black: #01040d;
--clr-black2: #171717;
--clr-black3: #344054;
--clr-gray: #525252;
--clr-gray1: #737373;
--clr-gray2: #d4d4d4;
--clr-gray3: #f5f5f5;
--clr-gray4: #f4f5f7;
--clr-gray5: #a3a3a3;
--clr-violet: rgba(130, 49, 211, 1);
--clr-violet-light: rgba(130, 49, 211, 0.12);
--clr-green: #01b81a;
--clr-green-light: rgba(1, 184, 26, 0.12);
--clr-orange: #ff6565;
--clr-orange-light: rgba(255, 116, 62, 0.12);
--clr-red: #ef4444;
--ff: "Inter", sans-serif;
}
.header-table { .header-table {
width: 100%; width: 100%;
margin-bottom: 10px; margin-bottom: 10px;
@@ -240,10 +211,6 @@
font-size: 11px; font-size: 11px;
margin-top: 10px; margin-top: 10px;
} }
.invoice-badge{
background-color: #c52127 !important;
}
</style> </style>
@endpush @endpush
@endsection @endsection
@@ -263,7 +230,7 @@
} }
@endphp @endphp
<div class="invoice-container" dir="{{ app()->getLocale() == 'ar' ? 'rtl' : 'ltr' }}"> <div class="invoice-container">
{{-- Header --}} {{-- Header --}}
<table class="header-table"> <table class="header-table">
<tr> <tr>
@@ -311,12 +278,12 @@
</table> </table>
{{-- INVOICE BADGE --}} {{-- INVOICE BADGE --}}
<h3 class="invoice-badge" <h3
style=" style="
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
color: white; color: white;
background-color: #c52127;
padding: 5px 12px; padding: 5px 12px;
border-radius: 30px; border-radius: 30px;
margin: 0; margin: 0;
@@ -333,14 +300,14 @@
{{-- Customer & Invoice Info --}} {{-- Customer & Invoice Info --}}
<table class="header-table"> <table class="header-table">
<tr> <tr>
<td style="width:50%; text-align:{{ app()->getLocale() == 'ar' ? 'right' : 'left' }};"> <td style="width:50%; text-align:{{ app()->getLocale() == 'ar' ? 'left' : 'left' }};">
<div>{{ __('Customer') }} : {{ $sale->party->name ?? __('Guest') }}</div> <div>{{ __('Customer') }} : {{ $sale->party->name ?? __('Guest') }}</div>
<div>{{ __('Address') }} : {{ $sale->party->address ?? '' }}</div> <div>{{ __('Address') }} : {{ $sale->party->address ?? '' }}</div>
<div>{{ __('Phone') }} : {{ $sale->party->phone ?? __('Guest') }}</div> <div>{{ __('Phone') }} : {{ $sale->party->phone ?? __('Guest') }}</div>
<div>{{ __('Remarks') }} : {{ $sale->meta['note'] ?? 'N/A' }}</div> <div>{{ __('Remarks') }} : {{ $sale->meta['note'] ?? 'N/A' }}</div>
</td> </td>
<td style="width:50%; text-align:{{ app()->getLocale() == 'ar' ? 'left' : 'right' }};"> <td style="width:50%; text-align:{{ app()->getLocale() == 'ar' ? 'right' : 'right' }};">
<div>{{ __('Invoice No') }} : {{ $sale->invoiceNumber ?? '' }}</div> <div>{{ __('Invoice No') }} : {{ $sale->invoiceNumber ?? '' }}</div>
<div>{{ __('Date') }} : {{ formatted_date($sale->saleDate ?? '') }}</div> <div>{{ __('Date') }} : {{ formatted_date($sale->saleDate ?? '') }}</div>
<div>{{ __('Time') }} : {{ formatted_time($sale->saleDate ?? '') }}</div> <div>{{ __('Time') }} : {{ formatted_time($sale->saleDate ?? '') }}</div>
@@ -403,7 +370,7 @@
</table> </table>
<table class="table-summery" width="100%" style="margin-top:15px;"> <table width="100%" style="margin-top:15px;">
<tr> <tr>
<!-- LEFT SIDE --> <!-- LEFT SIDE -->
<td width="60%" valign="top"> <td width="60%" valign="top">

View File

@@ -3,24 +3,14 @@
$firstStock = $product->stocks->first(); $firstStock = $product->stocks->first();
$purchasePrice = $firstStock->productPurchasePrice ?? 0; $purchasePrice = $firstStock->productPurchasePrice ?? 0;
$salePrice = $product->product_type === 'combo' ? ($product->productSalePrice ?? 0) : ($firstStock->productSalePrice ?? 0); $salePrice = $product->product_type === 'combo' ? ($product->productSalePrice ?? 0) : ($firstStock->productSalePrice ?? 0);
$price_without_tax = $product->product_type === 'combo' ? ($product->price_without_tax ?? 0): ($firstStock->exclusive_price ?? 0);
@endphp @endphp
<div class="single-product {{ $product->id }}" <div class="single-product {{ $product->id }}" data-product_id="{{ $product->id }}"
data-product_id="{{ $product->id }}" data-product_type="{{ $product->product_type }}" data-default_price="{{ $salePrice }}"
data-product_type="{{ $product->product_type }}" data-product_code="{{ $product->productCode }}" data-product_unit_id="{{ $product->unit->id ?? null }}"
data-has_serial="{{ $product->has_serial }}" data-product_unit_name="{{ $product->unit->unitName ?? null }}" data-product_image="{{ $product->productPicture }}"
data-default_price="{{ $salePrice }}" data-product_name="{{ $product->productName }}" data-purchase_price="{{ $purchasePrice }}"
data-product_code="{{ $product->productCode }}" data-batch_count="{{ $product->stocks->count() }}" data-stocks='@json($product->stocks)'
data-product_unit_id="{{ $product->unit->id ?? null }}" data-route="{{ route('business.carts.store') }}" data-vat_percent="{{ $product->vat->rate ?? 0 }}">
data-product_unit_name="{{ $product->unit->unitName ?? null }}"
data-product_image="{{ $product->productPicture }}"
data-product_name="{{ $product->productName }}"
data-purchase_price="{{ $purchasePrice }}"
data-batch_count="{{ $product->stocks->count() }}"
data-price_without_tax="{{ $price_without_tax }}"
data-stocks='@json($product->stocks)'
data-route="{{ route('business.carts.store') }}"
>
<div class="pro-img w-100"> <div class="pro-img w-100">
<img src="{{ asset($product->productPicture ?? 'assets/images/products/box.svg') }}" alt=""> <img src="{{ asset($product->productPicture ?? 'assets/images/products/box.svg') }}" alt="">
</div> </div>
@@ -34,6 +24,6 @@
</div> </div>
@empty @empty
<div class="alert alert-danger not-found mt-1" role="alert"> <div class="alert alert-danger not-found mt-1" role="alert">
{{ __('No product found') }} No product found
</div> </div>
@endforelse @endforelse

View File

@@ -8,7 +8,7 @@
Route::apiResource('departments', Hrm\DepartmentController::class); Route::apiResource('departments', Hrm\DepartmentController::class);
Route::apiResource('designations', Hrm\DesignationController::class); Route::apiResource('designations', Hrm\DesignationController::class);
Route::apiResource('shifts', Hrm\ShiftController::class); Route::apiResource('shifts', Hrm\ShiftController::class);
Route::post('shifts/status/{id}', [Hrm\ShiftController::class, 'status']); Route::post('shifts/status/{id}', [Hrm\ShiftController::class, 'status'])->name('shifts.status');
Route::apiResource('employees', Hrm\EmployeeController::class); Route::apiResource('employees', Hrm\EmployeeController::class);
Route::apiResource('attendances', Hrm\AttendanceController::class); Route::apiResource('attendances', Hrm\AttendanceController::class);
Route::apiResource('holidays', Hrm\HolidayController::class); Route::apiResource('holidays', Hrm\HolidayController::class);

View File

@@ -16,6 +16,6 @@
Route::middleware(['auth:sanctum'])->prefix('v1')->name('api.')->group(function () { Route::middleware(['auth:sanctum'])->prefix('v1')->name('api.')->group(function () {
Route::apiResource('branches', Multibranch\AcnooBranchController::class)->except('show'); Route::apiResource('branches', Multibranch\AcnooBranchController::class)->except('show');
Route::get('/switch-branch/{id}', [Multibranch\AcnooBranchController::class, 'switchBranch']); Route::get('/switch-branch/{id}', [Multibranch\AcnooBranchController::class, 'switchBranch'])->name('branches.switch');
Route::get('/exit-branch/{id}', [Multibranch\AcnooBranchController::class, 'exitBranch']); Route::get('/exit-branch/{id}', [Multibranch\AcnooBranchController::class, 'exitBranch'])->name('branches.exit');
}); });

View File

@@ -790,3 +790,12 @@ function transaction_types($transactions): string
->unique() ->unique()
->implode(', '); ->implode(', ');
} }
if (!function_exists('extractTemplateVariables')) {
function extractTemplateVariables($message)
{
preg_match_all('/\[(.*?)\]/', $message, $matches);
return $matches[1] ?? [];
}
}

View File

@@ -27,6 +27,8 @@ class PurchaseDetails extends Model
'stock_id', 'stock_id',
'mfg_date', 'mfg_date',
'expire_date', 'expire_date',
'serial_numbers',
'price_without_tax',
]; ];
/** /**
@@ -61,5 +63,7 @@ public function stock(): BelongsTo
'productWholeSalePrice' => 'double', 'productWholeSalePrice' => 'double',
'quantities' => 'double', 'quantities' => 'double',
'profit_percent' => 'double', 'profit_percent' => 'double',
'serial_numbers' => 'json',
'price_without_tax' => 'double',
]; ];
} }

View File

@@ -20,6 +20,7 @@ class PurchaseReturnDetail extends Model
'purchase_detail_id', 'purchase_detail_id',
'return_amount', 'return_amount',
'return_qty', 'return_qty',
'serial_numbers',
]; ];
/** /**
@@ -44,5 +45,6 @@ public function purchaseDetail()
'purchase_detail_id' => 'integer', 'purchase_detail_id' => 'integer',
'return_amount' => 'double', 'return_amount' => 'double',
'return_qty' => 'double', 'return_qty' => 'double',
'serial_numbers' => 'json',
]; ];
} }

View File

@@ -27,6 +27,7 @@ class SaleDetails extends Model
'mfg_date', 'mfg_date',
'productPurchasePrice', 'productPurchasePrice',
'warranty_guarantee_info', 'warranty_guarantee_info',
'serial_numbers',
]; ];
/** /**
@@ -61,5 +62,6 @@ public function sale(): BelongsTo
'quantities' => 'double', 'quantities' => 'double',
'productPurchasePrice' => 'double', 'productPurchasePrice' => 'double',
'warranty_guarantee_info' => 'json', 'warranty_guarantee_info' => 'json',
'serial_numbers' => 'json',
]; ];
} }

View File

@@ -27,6 +27,7 @@ class SaleReturnDetails extends Model
'sale_detail_id', 'sale_detail_id',
'return_amount', 'return_amount',
'return_qty', 'return_qty',
'serial_numbers',
]; ];
public function saleReturn() public function saleReturn()
@@ -45,5 +46,6 @@ public function saleDetail()
'sale_detail_id' => 'integer', 'sale_detail_id' => 'integer',
'return_amount' => 'double', 'return_amount' => 'double',
'return_qty' => 'double', 'return_qty' => 'double',
'serial_numbers' => 'json',
]; ];
} }

View File

@@ -17,6 +17,11 @@ class TransferProduct extends Model
'unit_price', 'unit_price',
'discount', 'discount',
'tax', 'tax',
'serial_numbers',
];
protected $casts = [
'serial_numbers' => 'json',
]; ];
public function transfer() public function transfer()

View File

@@ -0,0 +1,61 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('sale_details', function (Blueprint $table) {
$table->longText('serial_numbers')->nullable();
});
Schema::table('purchase_details', function (Blueprint $table) {
$table->longText('serial_numbers')->nullable();
$table->double('price_without_tax')->nullable();
});
Schema::table('transfer_products', function (Blueprint $table) {
$table->longText('serial_numbers')->nullable();
});
Schema::table('sale_return_details', function (Blueprint $table) {
$table->longText('serial_numbers')->nullable();
});
Schema::table('purchase_return_details', function (Blueprint $table) {
$table->longText('serial_numbers')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('sale_details', function (Blueprint $table) {
$table->dropColumn('serial_numbers');
});
Schema::table('purchase_details', function (Blueprint $table) {
$table->dropColumn(['serial_numbers', 'price_without_tax']);
});
Schema::table('transfer_products', function (Blueprint $table) {
$table->dropColumn('serial_numbers');
});
Schema::table('sale_return_details', function (Blueprint $table) {
$table->dropColumn('serial_numbers');
});
Schema::table('purchase_return_details', function (Blueprint $table) {
$table->dropColumn('serial_numbers');
});
}
};

View File

@@ -65,11 +65,15 @@ $(document).on('click', '.sub-btn', function(e) {
// Update the subtotal for each row based on the return quantity // Update the subtotal for each row based on the return quantity
function updateSubTotal(row) { function updateSubTotal(row) {
let priceText = row.find(".price").text(); let priceText = row.find(".price").text();
let price = getNumericValue(String(priceText || "")) let price = getNumericValue(String(priceText || "0"));
|| getNumericValue(String(row.data("discounted_price_per_unit") || "0"));
let vatText = row.find(".vat_value").text();
let vatAmount = getNumericValue(String(vatText || "0"));
let inclusivePrice = price + vatAmount;
let quantity = getNumericValue(String(row.find(".return-qty").val() || "0")); let quantity = getNumericValue(String(row.find(".return-qty").val() || "0"));
let subTotal = price * quantity; let subTotal = inclusivePrice * quantity;
row.find(".subtotal").text(currencyFormat(subTotal)); row.find(".subtotal").text(currencyFormat(subTotal));
updateTotalAmount(); updateTotalAmount();

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 KiB

View File

@@ -19,7 +19,7 @@
// Interface // Interface
Route::resource('interfaces',Admin\AcnooInterfaceController::class); Route::resource('interfaces',Admin\AcnooInterfaceController::class);
Route::put('admin/interfaces/{interface}', [ADMIN\AcnooInterfaceController::class, 'update'])->name('interfaces.update');
Route::post('interfaces/status/{id}', [ADMIN\AcnooInterfaceController::class,'status'])->name('interfaces.status'); Route::post('interfaces/status/{id}', [ADMIN\AcnooInterfaceController::class,'status'])->name('interfaces.status');
Route::post('interfaces/delete-all', [ADMIN\AcnooInterfaceController::class, 'deleteAll'])->name('interfaces.delete-all'); Route::post('interfaces/delete-all', [ADMIN\AcnooInterfaceController::class, 'deleteAll'])->name('interfaces.delete-all');

View File

@@ -15,10 +15,10 @@
// Business Signup // Business Signup
Route::get('/get-business-categories', [Web\AcnooBusinessController::class, 'getBusinessCategories'])->name('get-business-categories'); Route::get('/get-business-categories', [Web\AcnooBusinessController::class, 'getBusinessCategories'])->name('get-business-categories');
Route::post('/businesses', [Web\AcnooBusinessController::class, 'store'])->name('business.store'); Route::post('/businesses', [Web\AcnooBusinessController::class, 'store'])->name('web.business.store');
Route::post('/verify-code', [Web\AcnooBusinessController::class, 'verifyCode'])->name('business.verify-code'); Route::post('/verify-code', [Web\AcnooBusinessController::class, 'verifyCode'])->name('business.verify-code');
Route::get('/data-deletion', [Web\DataDeletionController::class, 'index'])->name('term.index'); Route::get('/data-deletion', [Web\DataDeletionController::class, 'index'])->name('data-deletion.index');
Route::get('/terms-conditions', [Web\TermServiceController::class, 'index'])->name('term.index'); Route::get('/terms-conditions', [Web\TermServiceController::class, 'index'])->name('term.index');
Route::get('/privacy-policy', [Web\PolicyController::class, 'index'])->name('policy.index'); Route::get('/privacy-policy', [Web\PolicyController::class, 'index'])->name('policy.index');

View File

@@ -3,7 +3,7 @@
'name' => 'laravel/laravel', 'name' => 'laravel/laravel',
'pretty_version' => 'dev-main', 'pretty_version' => 'dev-main',
'version' => 'dev-main', 'version' => 'dev-main',
'reference' => '6f9bdff1150fd4e080fd07a1783ea0fece72a325', 'reference' => '1dfc06635d108a5eda609bfc23ce9bdcd96a32a6',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@@ -778,7 +778,7 @@
'laravel/laravel' => array( 'laravel/laravel' => array(
'pretty_version' => 'dev-main', 'pretty_version' => 'dev-main',
'version' => 'dev-main', 'version' => 'dev-main',
'reference' => '6f9bdff1150fd4e080fd07a1783ea0fece72a325', 'reference' => '1dfc06635d108a5eda609bfc23ce9bdcd96a32a6',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),

View File

@@ -119,7 +119,7 @@
}); });
Route::group(['prefix' => 'envato', 'as' => 'LaravelInstaller::', 'namespace' => 'Laravel\LaravelInstaller\Controllers', 'middleware' => 'web'], function () { Route::group(['prefix' => 'envato', 'as' => 'LaravelVerifier::', 'namespace' => 'Laravel\LaravelInstaller\Controllers', 'middleware' => 'web'], function () {
Route::post('purchase-code/verify/process', [ Route::post('purchase-code/verify/process', [
'as' => 'codeVerifyProcess', 'as' => 'codeVerifyProcess',