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;
$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) {
$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) {
$q->whereHas('product', function ($q) use ($request) {
$q->where('productName', 'like', "%{$request->search}%")
->orWhere('productCode', 'like', "%{$request->search}%")
->orWhere('hsn_code', 'like', "%{$request->search}%");
->orWhere('productCode', 'like', "%{$request->search}%");
});
});
@@ -39,11 +42,11 @@ public function index(Request $request)
->sum('lossProfit');
$product_lossProfits = $baseQuery
->with('product:id,productName,productCode,hsn_code')
->with('product:id,productName,productCode')
->select(
'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 loss')
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')
)
->groupBy('product_id')
->paginate($request->per_page ?? 20)
@@ -51,13 +54,17 @@ public function index(Request $request)
if ($request->ajax()) {
return response()->json([
'data' => view('business::reports.product-loss-profit.datas', compact('product_lossProfits'))->render(),
'loss' => currency_format($loss, currency: business_currency()),
'profit' => currency_format($profit, currency: business_currency())
'data' => view(
'business::reports.product-loss-profit.datas',
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,36 +78,26 @@ public function exportCsv()
return Excel::download(new ExportProductLossProfit, 'product-lossProfit.csv');
}
public function exportPdf(Request $request)
public function exportPdf()
{
$user = auth()->user();
$branchId = $user->branch_id ?? $user->active_branch_id;
$branchId = moduleCheck('MultiBranchAddon') ? auth()->user()->branch_id ?? auth()->user()->active_branch_id : null;
$baseQuery = SaleDetails::query()
->whereHas('product', fn ($q) =>
$q->where('business_id', $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) {
$q->whereHas('product', function ($q) use ($request) {
$q->where('productName', 'like', "%{$request->search}%")
->orWhere('productCode', 'like', "%{$request->search}%")
->orWhere('hsn_code', 'like', "%{$request->search}%");
});
});
$product_lossProfits = $baseQuery
->with('product:id,productName,productCode,hsn_code')
->select(
'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 loss')
)
->groupBy('product_id')
->limit($request->per_page ?? 20)
->get();
$product_lossProfits = SaleDetails::with('product:id,productName,productCode')
->whereHas('product', function ($q) {
$q->where('business_id', auth()->user()->business_id);
})
->when($branchId, function ($q) use ($branchId) {
$q->whereHas('sale', function ($sale) use ($branchId) {
$sale->where('branch_id', $branchId);
});
})
->select(
'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 loss')
)
->groupBy('product_id')
->get();
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',
'type' => 'nullable|string|in:sale,purchase',
'id' => 'required|integer',
'name' => 'nullable|string',
'name' => 'required|string',
'quantity' => 'required|numeric',
'price' => 'required|numeric',
'product_code' => 'nullable|string',
'product_unit_id' => 'nullable|integer',
'product_unit_name' => 'nullable|string',
'product_image' => 'nullable|string',
'profit_percent' => 'nullable|numeric',
'sales_price' => 'nullable|numeric',
'whole_sale_price' => 'nullable|numeric',
'dealer_price' => 'nullable|numeric',
'expire_date' => 'nullable|date',
'product_type' => 'nullable|in:single,variant,combo',
'variant_name' => 'nullable|string',
'serial_numbers' => 'nullable|array',
'serial_numbers.*' => 'string',
'has_serial' => 'nullable|boolean',
'price_without_tax' => 'required_without:serial_numbers|numeric|nullable',
'customer_type' => 'nullable|string'
'vat_percent' => 'nullable|numeric',
]);
$incomingSerials = $request->serial_numbers ?? [];
// Serial Mode
if (!empty($incomingSerials)) {
// Sale
if ($request->type === 'sale') {
$stocks = Stock::where('business_id', auth()->user()->business_id)
->where('product_id', $request->id)
->where(function ($query) use ($incomingSerials) {
foreach ($incomingSerials as $serial) {
$query->orWhereJsonContains('serial_numbers', $serial);
}
})->get();
// 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) {
$existingSerials = $existingCartItem->options->serial_numbers ?? [];
// 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 {
Cart::add([
'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,
]
]);
}
}
// Check for existing item in cart by type
$existingCartItem = Cart::search(
fn($item) => $item->id == $request->id &&
$item->options->type == $request->type &&
match ($request->type) {
'purchase' => $item->options->batch_no == $request->batch_no,
'sale' => $item->options->stock_id == $request->stock_id,
default => false,
}
// 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();
)->first();
if ($existingCartItem) {
Cart::update($existingCartItem->rowId, [
'qty' => $existingCartItem->qty + $request->quantity
]);
$newQty = $existingCartItem->qty + $request->quantity;
Cart::update($existingCartItem->rowId, ['qty' => $newQty]);
} else {
Cart::add([
// Add new item to cart
$mainItemData = [
'id' => $request->id,
'name' => $request->name,
'qty' => $request->quantity,
'price' => round($request->price, 2),
'price' => $request->price,
'options' => [
'type' => $request->type,
'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' => $request->stock_id,
'batch_no' => $request->batch_no,
'product_image' => $request->product_image,
'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,
'product_type' => $request->product_type,
'warehouse_id' => $request->warehouse_id,
'has_serial' => $request->has_serial ?? 0,
'price_without_tax' => $request->price_without_tax,
'variant_name' => $request->variant_name,
'vat_percent' => $request->vat_percent,
]
]);
];
Cart::add($mainItemData);
}
return response()->json([
'success' => true,
'message' => 'Item added to cart successfully.'
@@ -255,45 +108,20 @@ public function store(Request $request)
public function update(Request $request, $id)
{
$cart = Cart::get($id);
if (!$cart) {
return response()->json([
'success' => false,
'message' => __('Item not found in cart')
]);
return response()->json(['success' => false, 'message' => __('Item not found in cart')]);
}
$qty = $request->qty ?? $cart->qty;
if ($qty < 0) {
return response()->json([
'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);
return response()->json(['success' => false, 'message' => __('Enter a valid quantity')]);
}
Cart::update($id, [
'qty' => $qty,
'price' => round($request->price ?? $cart->price, 2),
'price' => $request->price ?? $cart->price,
'options' => [
'type' => $cart->options->type,
'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_name' => $cart->options->product_unit_name,
'product_image' => $cart->options->product_image,
'profit_percent' => $cart->options->profit_percent,
'sales_price' => $cart->options->sales_price,
'discount' => $request->discount ?? $cart->options->discount,
'whole_sale_price' => $cart->options->whole_sale_price,
@@ -312,9 +139,7 @@ public function update(Request $request, $id)
'product_type' => $cart->options->product_type,
'warehouse_id' => $cart->options->warehouse_id,
'variant_name' => $cart->options->variant_name,
'price_without_tax' => $cart->options->price_without_tax,
'has_serial' => $hasSerial,
'serial_numbers' => $existingSerials,
'vat_percent' => $cart->options->vat_percent,
]
]);

View File

@@ -3,17 +3,16 @@
namespace Modules\Business\App\Http\Controllers;
use App\Events\MultiPaymentProcessed;
use App\Http\Controllers\Controller;
use App\Models\Branch;
use App\Models\Party;
use App\Models\PaymentType;
use App\Models\Sale;
use App\Models\SaleReturn;
use App\Models\SaleReturnDetails;
use App\Models\Party;
use App\Models\Stock;
use App\Services\VatTransactionService;
use App\Models\Branch;
use App\Models\SaleReturn;
use Illuminate\Http\Request;
use App\Models\SaleReturnDetails;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\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'));
}
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([
'sale_id' => 'required|exists:sales,id',
'products' => 'required|array|min:1',
'products.*.detail_id' => 'required|exists:sale_details,id',
'products.*.return_qty' => 'required|integer',
'products.*.serial_numbers' => 'nullable|string',
'return_qty' => 'required|array',
]);
$business_id = auth()->user()->business_id;
DB::beginTransaction();
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,serial_numbers',
'details.product:id,product_type,has_serial',
'details.product.combo_products'
)
->where('business_id', $business_id)
->findOrFail($request->sale_id);
$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')
->where('business_id', $business_id)
->findOrFail($request->sale_id);
$old_sale_due = $sale->dueAmount;
// Calculate discount factors
// Calculate total discount factor with itemwise discount
$total_discount = $sale->discountAmount;
$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;
$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([
'return_date' => now(),
'business_id' => $business_id,
'sale_id' => $request->sale_id,
'invoice_no' => $sale->invoiceNumber,
'return_date' => now(),
]);
$sale_return_detail_data = [];
$total_return_amount = 0;
$total_return_discount = 0;
$total_return_vat = 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 (!$detail) continue; // skip if detail not found
$requested_qty = (int) ($indextem['return_qty'] ?? 0);
if ($requested_qty <= 0) continue;
if ($requested_qty <= 0) {
continue;
}
if ($requested_qty > $detail->quantities) {
return response()->json([
@@ -153,78 +132,63 @@ public function store(Request $request)
], 400);
}
$return_serials = !empty($indextem['serial_numbers']) ? json_decode($indextem['serial_numbers'], true) : [];
$product = $detail->product;
// Include SaleDetails discount in return calculation
$unit_discount = $detail->price * $discount_per_unit_factor;
$indextem_cart_discount = $detail->discount ?? 0;
$total_discount_per_unit = $unit_discount + $indextem_cart_discount;
$item_cart_discount = $detail->discount ?? 0;
$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_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_discount += $return_discount;
$total_return_vat += ($item_vat_amount * $requested_qty);
$product = $detail->product;
// Combo products
if ($product && $product->product_type === 'combo') {
$combo_total_purchase = 0;
$combo_total_sale = $detail->price * $requested_qty;
foreach ($product->combo_products as $comboItem) {
$stock = Stock::find($comboItem->stock_id);
if (!$stock) {
return response()->json([
'message' => __("Stock not found for combo item '{$comboItem->product->productName}'"),
], 400);
}
// increase stock by combo component quantity * returned qty
$restore_qty = $comboItem->quantity * $requested_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 {
$stock = Stock::where('id', $detail->stock_id)->first();
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);
// Restore serials to stock
$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);
if (!$stock) {
return response()->json(['error' => 'Stock not found.'], 404);
}
$stock->increment('productStock', $requested_qty);
$loss_profit_adjustment = (($detail->price - $stock->productPurchasePrice) * $requested_qty) - $return_discount;
$total_loss_profit_adjustment += $loss_profit_adjustment;
}
$loss_profit_adjustment = $detail->lossProfit * ($requested_qty / $detail->quantities);
$total_loss_profit_adjustment += $loss_profit_adjustment;
// Update sale detail
// Update sale details
$detail->quantities -= $requested_qty;
$detail->lossProfit -= $loss_profit_adjustment;
$detail->timestamps = false;
@@ -236,21 +200,22 @@ public function store(Request $request)
'sale_return_id' => $sale_return->id,
'return_qty' => $requested_qty,
'return_amount' => $return_amount,
'serial_numbers' => $return_serials ?? null,
]);
$previous_returned_qty = SaleReturnDetails::where('sale_detail_id', $detail->id)->sum('return_qty');
$totalQty = $detail->quantities + $previous_returned_qty;
VatTransactionService::productReturnVatCalculation($detail, $requested_qty, $returnDetail, $totalQty);
// Record VAT transaction for the return
if (class_exists('App\Services\VatTransactionService')) {
$totalQty = $detail->quantities + $requested_qty; // Original quantity before this return decrement
\App\Services\VatTransactionService::productReturnVatCalculation($detail, $requested_qty, $returnDetail, $totalQty);
}
}
if ($total_return_amount <= 0) {
return response()->json("You cannot return an empty product.", 400);
}
// Remaining refund / party logic
$remaining_refund = $total_return_amount;
// Adjust Due
$new_due = $sale->dueAmount;
if ($remaining_refund > 0) {
if ($remaining_refund >= $sale->dueAmount) {
@@ -262,6 +227,7 @@ public function store(Request $request)
}
}
// Adjust Paid (refund part)
$new_paid = $sale->paidAmount;
if ($remaining_refund > 0) {
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);
$sale->update([
'change_amount' => 0,
'dueAmount' => $new_due,
'paidAmount' => $new_paid,
'totalAmount' => $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),
'lossProfit' => $sale->lossProfit - $total_loss_profit_adjustment,
]);
// Party refund logic
$due_reduction = $old_sale_due - $new_due;
// Party Refund Logic
$party = Party::find($sale->party_id);
if ($due_reduction > 0) {
Party::where('business_id', $business_id)
->where('id', $sale->party_id)
->decrement('due', $due_reduction);
}
if ($party) {
$party = Party::where('business_id', $business_id)->find($sale->party_id);
if ($party && $remaining_refund > 0) {
// use leftover refund after due/paid adjustments
$refund_amount = $remaining_refund;
// Reduce party due
if ($party->due > 0) {
if ($party->due >= $remaining_refund) {
$party->decrement('due', $remaining_refund);
$remaining_refund = 0;
if ($party->due >= $refund_amount) {
$party->decrement('due', $refund_amount);
$refund_amount = 0;
} else {
$remaining_refund -= $party->due;
$refund_amount -= $party->due;
$party->update(['due' => 0]);
}
}
if ($remaining_refund > 0) {
$party->increment('wallet', $remaining_refund);
// Add leftover refund to wallet
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) {
$payment['amount'] = $total_return_amount;
return $payment;
@@ -325,22 +295,20 @@ public function store(Request $request)
$payments,
$sale_return->id,
'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();
return response()->json([
'message' => __('Sale returned successfully.'),
'redirect' => route('business.sale-returns.index'),
'secondary_redirect_url' => $invoice_route,
'secondary_redirect_url' => route('business.sales.invoice', $sale->id),
]);
} catch (\Exception $e) {
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="d-flex justify-content-between align-items-center w-100">
<div class="bulk-input w-100">
<div class="row align-items-center">
<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>
<input class="form-control" type="file" name="file" required>
</div>
</div>
<div class="d-flex align-items-center justify-content-center gap-2 flex-wrap">
@@ -48,9 +32,9 @@ class="bulk_cart_upload_form">
<div class="instruction-header">
<h5>{{__('Instructions') }}</h5>
<div class="mt-3">
<h6><strong>{{__('Note') }}: </strong>{{__('Please follow the instructions below to upload your file.')}}</h6>
<h6><strong>{{__('Note') }}: </strong>{{__(' Please follow the instructions below to upload your file.')}}</h6>
<ul>
<li><b>{{__('1.')}}</b>{{__('Download the sample file first and add all your purchases data to it.')}}</li>
<li><b>{{__('1.')}}</b>{{__(' Download the sample file first and add all your purchases data to it.')}}</li>
<li><b>{{__('2.')}}</b> <span class="text-danger">*</span> {{__('Indicates a required field. If you do not provide the required fields, the system will ignore except product information.')}}</li>
<li><b>{{__('3.')}}</b> {{__('After adding all your purchases, please save the file and then upload the updated version.')}}</li>
</ul>

View File

@@ -19,23 +19,7 @@
<div class="bulk-upload-container w-100">
<div class="d-flex justify-content-between align-items-center w-100">
<div class="bulk-input w-100">
<div class="row align-items-center">
<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>
<input class="form-control w-100" type="file" name="file" required>
</div>
</div>
<div class="d-flex align-items-center justify-content-center gap-2 flex-wrap">

View File

@@ -2,14 +2,8 @@
@php
$modules = product_setting()->modules ?? [];
@endphp
<tr
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'>
<tr data-row_id="{{ $cart->rowId }}" data-update_route="{{ route('business.carts.update', $cart->rowId) }}" data-destroy_route="{{ route('business.carts.destroy', $cart->rowId) }}">
<td class='text-start '>
<img class="table-img" src="{{ asset($cart->options->product_image ?? 'assets/images/products/box.svg') }}">
</td>
<td class='text-start'>{{ $cart->name }}</td>
@@ -23,9 +17,9 @@
@if (is_module_enabled($modules, 'show_product_expire_date'))
<td>
@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">
@else
<input type="month" name="expire_date" value="{{ date('Y-m', strtotime($cart->options->expire_date ?? '')) }}" class="form-control expire_date">
@endif
</td>
@endif
@@ -34,27 +28,13 @@
<input type="number" step="any" value="{{ $cart->price }}" class="custom-number-input price" placeholder="{{ __('0') }}">
</td>
@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'>
<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>
</button>
<input type="number" step="any" value="{{ $cart->qty }}" class="dynamic-width cart-qty" @if(($cart->options->has_serial ?? 0) == 1) disabled readonly @endif>
<button class="incre-decre plus-btn" @if(($cart->options->has_serial ?? 0) == 1) disabled @endif>
<input type="number" step="any" value="{{ $cart->qty }}" class="dynamic-width cart-qty" placeholder="{{ __('0') }}">
<button class="incre-decre plus-btn">
<i class="fas fa-plus icon"></i>
</button>
</div>

View File

@@ -97,9 +97,6 @@
@usercan('purchases.price')
<th class="border table-background">{{ __('Purchase Price') }}</th>
@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">{{ __('Sub Total') }}</th>
<th class="border table-background">{{ __('Action') }}</th>
@@ -150,23 +147,6 @@
<h6 class="fw-bold" id="sub_total">
{{ currency_format(0, currency: business_currency()) }}</h6>
</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">
<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">
@@ -186,6 +166,23 @@ 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 class="shopping-crg-grid mb-2">
<h6 class="payment-title">{{ __('Shipping Charge') }}</h6>
<div class="">
@@ -246,7 +243,7 @@ class="btn btn-category w-100">{{ __('Category') }}</a>
</div>
<div class="products-container">
<div class="p-3 scroll-card">
<div class="search-product-card products gap-2 @if (count($products) === 1) single-product @endif product-list-container" id="products-list">
<div class="search-product-card products gap-2 @if (count($products) === 1) single-product @endif product-list-container" id="products-list">
@include('business::purchases.product-list')
</div>
</div>
@@ -255,30 +252,25 @@ class="btn btn-category w-100">{{ __('Category') }}</a>
</div>
</div>
@include('business::purchases.product-modal')
<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="clear-cart" value="{{ route('business.carts.remove-all') }}">
<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
@push('modal')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::serial-code-modal')
@endif
@include('business::purchases.calculator')
@include('business::purchases.category-search')
@include('business::purchases.brand-search')
@include('business::purchases.supplier-create')
@include('business::purchases.bulk-upload.index')
@include('business::purchases.product-modal')
@endpush
@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/calculator.js') }}"></script>
<script src="{{ asset('assets/js/choices.min.js') }}"></script>

View File

@@ -65,57 +65,19 @@
<i class="far fa-ellipsis-v"></i>
</button>
<ul class="dropdown-menu">
@usercan('purchases.read')
<li>
<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">
<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>
<img src="{{ asset('assets/images/icons/Invoic.svg') }}" alt="">
{{ __('Invoice') }}
</a>
</li>
@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')
<li>
<a
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">
<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>
<i class="fal fa-undo-alt"></i>
{{ __('Purchase Return') }}
</a>
</li>
@@ -147,13 +109,19 @@
data-url="{{ route('business.view-payment', ['type' => 'purchase', 'id' => $purchase->id]) }}"
class="view-payment-btn" 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">
<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"/>
<path d="M12 4H6" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11 7H6" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M9 10H6" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/>
<svg width="18" height="18" viewBox="0 0 18 18" fill="none"
xmlns="http://www.w3.org/2000/svg">
<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" />
<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>
{{ __('View Payment') }}
</a>
</li>
@@ -161,10 +129,7 @@ class="view-payment-btn" data-bs-toggle="modal"
@usercan('purchases.read')
<li>
<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">
<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>
<i class="fal fa-edit"></i>
{{ __('Edit') }}
</a>
</li>
@@ -173,12 +138,7 @@ class="view-payment-btn" data-bs-toggle="modal"
<li>
<a href="{{ route('business.purchases.destroy', $purchase->id) }}"
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">
<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>
<i class="fal fa-trash-alt"></i>
{{ __('Delete') }}
</a>
</li>

View File

@@ -98,9 +98,6 @@ class='dashboard-btn d-flex align-items-center gap-1'>
@usercan('purchases.price')
<th class="border table-background">{{ __('Purchase Price') }}</th>
@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">{{ __('Sub Total') }}</th>
<th class="border table-background">{{ __('Action') }}</th>
@@ -153,23 +150,6 @@ class="form-control receive_amount"
<h6>{{ __('Sub Total') }}</h6>
<h6 class="fw-bold" id="sub_total">{{ currency_format(0) }}</h6>
</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">
<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">
@@ -189,6 +169,23 @@ class="form-control receive_amount"
</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">
<h6 class="">{{ __('Shipping Charge') }}</h6>
<div class="">
@@ -256,30 +253,22 @@ class="btn btn-category w-100">{{ __('Category') }}</a>
</div>
</div>
@include('business::purchases.product-modal')
<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.carts.remove-all') }}" id="clear-cart">
<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
@push('modal')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::serial-code-modal')
@endif
@include('business::purchases.calculator')
@include('business::purchases.category-search')
@include('business::purchases.brand-search')
@include('business::purchases.product-modal')
@include('business::purchases.supplier-create')
@include('business::purchases.bulk-upload.index')
@endpush
@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/calculator.js') }}"></script>
<script src="{{ asset('assets/js/choices.min.js') }}"></script>

View File

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

View File

@@ -6,7 +6,7 @@
@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')
@else
@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-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="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>
</div>
@if($isBusinessRoute)
<div class="col-md-9 d-flex justify-content-start justify-content-md-end align-items-end">
<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')}}
</a>
<form action="{{ route('business.purchases.mail', ['purchase_id' => $purchase->id]) }}" method="POST" class="ajaxform_instant_reload">
<div class="col-md-6 d-flex justify-content-end align-items-end">
<div class="d-flex gap-2 ">
<form action="{{ route('business.purchases.mail', ['purchase_id' => $purchase->id]) }}" method="POST"
class="ajaxform_instant_reload">
@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>
<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') }}">
{{__('PDF')}}
</a>
<a class="print-btn-2 print-btn" onclick="window.print()"><img class="w-10 h-10" src="{{ asset('assets/img/print.svg') }}">{{ __('Print') }}</a>
{{__('PDF')}}</a>
<a class="print-btn-2 print-btn" onclick="window.print()"><img class="w-10 h-10"
src="{{ asset('assets/img/print.svg') }}">{{ __('Print') }}</a>
</div>
</div>
@endif
</div>
<div class="d-flex justify-content-between align-items-center gap-3 print-logo-container">
{{-- Left Side: Logo and Content --}}
<div class="d-flex align-items-center gap-2 logo">
@if ((get_business_option('business-settings', $business_id)['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') ?? '' }}">
@if ((get_business_option('business-settings')['show_a4_invoice_logo'] ?? 0) == 1 )
<img class="invoice-logo" src="{{ asset(get_business_option('business-settings')['a4_invoice_logo'] ?? 'assets/images/default.svg') ?? '' }}">
@endif
</div>
@@ -109,9 +96,8 @@
</div>
</div>
{{-- PURCHASE + RETURN --}}
@if (!$purchase_returns->isEmpty())
{{-- purchases portion --}}
{{-- purchases --}}
<div class="custom-invoice-table">
<table class="table table-striped">
<thead>
@@ -121,48 +107,34 @@
<th class="head-black text-center">{{ __('Quantity') }}</th>
@usercan('purchases.price')
<th class="head-black text-end">{{ __('Unit Price') }}</th>
<th class="head-black text-end">{{ __('Price (exc.)') }}</th>
@endusercan
<th class="head-black text-end">{{ __('Total Price') }}</th>
</tr>
</thead>
@php
$subtotal = 0;
$total_product_vat = 0;
@endphp
<tbody class="in-table-body-container">
@foreach ($purchase->details as $detail)
@php
$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);
$qty = $detail->quantities ?? 0;
$product_vat = $productTotal - ($exclusive_price * $qty ?? 1);
$total_product_vat += $product_vat;
$subtotal += $exclusive_price * ($qty ?? 1);
$subtotal += $productTotal;
@endphp
<tr class="in-table-body">
<td class="text-center">{{ $loop->iteration }}</td>
<td class="text-start">
<div class="invoice-item">
{{ ($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>
</td>
<td class="text-center">{{ $detail->quantities ?? '' }}</td>
@usercan('purchases.price')
<td class="text-end">
{{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency($business_id)) }}
</td>
<td class="text-end">
{{ currency_format($exclusive_price ?? 0, currency: business_currency($business_id)) }}
{{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency()) }}
</td>
@endusercan
<td class="text-end">
{{ currency_format($productTotal, currency: business_currency($business_id)) }}</td>
{{ currency_format($productTotal, currency: business_currency()) }}</td>
</tr>
@endforeach
</tbody>
@@ -187,21 +159,20 @@
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Subtotal') }}</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>
</tr>
<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">: </td>
<td class="text-end">{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($vat_amount + $total_product_vat, currency: business_currency($business_id)) }}
</td>
{{ currency_format($purchase->vat_amount, currency: business_currency()) }}</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Shipping Charge') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($purchase->shipping_charge, currency: business_currency($business_id)) }}
{{ currency_format($purchase->shipping_charge, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom border-bottom-dis">
@@ -212,14 +183,14 @@
</td>
<td class="text-end">:</td>
<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>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end total-amound">{{ __('Total Amount') }}</td>
<td class="text-end total-amound">:</td>
<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>
</tr>
</tbody>
@@ -227,7 +198,7 @@
</div>
</div>
{{-- purchase Return portion --}}
{{-- purchase Return --}}
<div class="custom-invoice-table">
<table class="table table-striped">
<thead>
@@ -248,19 +219,16 @@
@endphp
<tr class="in-table-body">
<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">
<div class="invoice-item">
{{ $detail->purchaseDetail->product->productName ?? '' }}
{{ $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>
</td>
<td class="text-center">{{ $detail->return_qty ?? 0 }}</td>
<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>
</tr>
@endforeach
@@ -269,7 +237,7 @@
</table>
</div>
<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>
<table class="table">
<tbody>
@@ -281,10 +249,10 @@
{{ $returnTransactionType ?? $purchase->paymentType ?? '' }}
</td>
</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">
<td class="text-start">
{{ get_business_option('business-settings', $business_id)['note'] ?? '' }}
{{ get_business_option('business-settings')['note'] ?? '' }}
</td>
</tr>
@endif
@@ -293,7 +261,7 @@
@if ($bank_detail->show_in_invoice ?? 0 == 1)
<div class="bank-details-container">
<div class="bank-details-title">
{{__('Bank Details')}}
Bank Details
</div>
<div class="back-details-content">
<table class="table mb-2">
@@ -333,33 +301,32 @@
<td class="text-end">{{ __('Total Return Amount') }}</td>
<td class="text-end">:</td>
<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 class="in-table-row-bottom">
<td class="text-end total-amound">{{ __('Payable Amount') }}</td>
<td class="text-end total-amound">:</td>
<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 class="in-table-row-bottom">
<td class="text-end">{{ __('Paid Amount') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($purchase->paidAmount, currency: business_currency($business_id)) }}</td>
{{ currency_format($purchase->paidAmount, currency: business_currency()) }}</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Due') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($purchase->dueAmount, currency: business_currency($business_id)) }}</td>
{{ currency_format($purchase->dueAmount, currency: business_currency()) }}</td>
</tr>
</tbody>
</table>
</div>
</div>
{{-- ONLY PURCHASE --}}
@else
{{-- purchases --}}
<div class="custom-invoice-table">
<table class="table table-striped">
<thead>
@@ -369,54 +336,39 @@
<th class="head-black text-center">{{ __('Quantity') }}</th>
@usercan('purchases.price')
<th class="head-black text-end">{{ __('Unit Price') }}</th>
<th class="head-black text-end">{{ __('Price (exc.)') }}</th>
@endusercan
<th class="head-black text-end">{{ __('Total Price') }}</th>
</tr>
</thead>
@php
$subtotal = 0;
$total_product_vat = 0;
@endphp
@php $subtotal = 0; @endphp
<tbody class="in-table-body-container">
@foreach ($purchase->details as $detail)
@php
$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);
$qty = $detail->quantities ?? 0;
$product_vat = $productTotal - ($exclusive_price * $qty ?? 1);
$total_product_vat += $product_vat;
$subtotal += $exclusive_price * ($qty ?? 1);
$subtotal += $productTotal;
@endphp
<tr class="in-table-body">
<td class="text-center">{{ $loop->iteration }}</td>
<td class="text-start">
<div class="invoice-item">
{{ ($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>
</td>
<td class="text-center">{{ $detail->quantities ?? '' }}</td>
@usercan('purchases.price')
<td class="text-end">
{{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency($business_id)) }}
</td>
<td class="text-end">
{{ currency_format($exclusive_price ?? 0, currency: business_currency($business_id)) }}
{{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency()) }}
</td>
@endusercan
<td class="text-end">
{{ currency_format($productTotal, currency: business_currency($business_id)) }}</td>
{{ currency_format($productTotal, currency: business_currency()) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<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>
<table class="table">
<tbody>
@@ -428,10 +380,10 @@
{{ $transactionTypes ?? ($purchase->payment_type_id ? ($purchase->payment_type->name ?? '') : ($purchase->paymentType ?? '')) }}
</td>
</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">
<td class="text-start">
{{ get_business_option('business-settings', $business_id)['note'] ?? '' }}
{{ get_business_option('business-settings')['note'] ?? '' }}
</td>
</tr>
@endif
@@ -480,21 +432,21 @@
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Subtotal') }}</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>
</tr>
<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">
{{ currency_format($vat_amount + $total_product_vat, currency: business_currency($business_id)) }}
{{ currency_format($purchase->vat_amount, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end">{{ __('Shipping Charge') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($purchase->shipping_charge, currency: business_currency($business_id)) }}
{{ currency_format($purchase->shipping_charge, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom border-bottom-dis" >
@@ -505,20 +457,20 @@
</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($purchase->discountAmount, currency: business_currency($business_id)) }}
{{ currency_format($purchase->discountAmount, currency: business_currency()) }}
</td>
</tr>
<tr class="in-table-row-bottom">
<td class="text-end total-amound">{{ __('Total Amount') }}</td>
<td class="text-end total-amound">:</td>
<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 class="in-table-row-bottom">
<td class="text-end">{{ __('Paid Amount') }}</td>
<td class="text-end">:</td>
<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>
</tr>
@if($purchase->change_amount > 0)
@@ -526,7 +478,7 @@
<td class="text-end">{{ __('Change Amount') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($purchase->change_amount, currency: business_currency($business_id)) }}
{{ currency_format($purchase->change_amount, currency: business_currency()) }}
</td>
</tr>
@else
@@ -534,7 +486,7 @@
<td class="text-end">{{ __('Due') }}</td>
<td class="text-end">:</td>
<td class="text-end">
{{ currency_format($purchase->dueAmount, currency: business_currency($business_id)) }}
{{ currency_format($purchase->dueAmount, currency: business_currency()) }}
</td>
</tr>
@endif
@@ -556,26 +508,15 @@
</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">
<p>
@if ((get_business_option('business-settings', $business_id)['show_warranty'] ?? 0) == 1)
<span>{{ get_business_option('business-settings', $business_id)['warranty_void_label'] ?? '' }} - </span>
@if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
<span>{{ get_business_option('business-settings')['warranty_void_label'] ?? '' }} - </span>
@endif
{{ get_business_option('business-settings', $business_id)['warranty_void'] ?? '' }}
{{ get_business_option('business-settings')['warranty_void'] ?? '' }}
</p>
</div>
@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>
@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
@section('pdf_content')
<div class="invoice-container" dir="{{ app()->getLocale() == 'ar' ? 'rtl' : 'ltr' }}">
<div class="invoice-container">
{{-- HEADER --}}
<table class="top-table">
@@ -198,13 +198,13 @@
{{-- SUPPLIER / PURCHASE INFO --}}
<table class="info-table">
<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>{{ __('Mobile') }}</strong> : {{ $purchase->party->phone }}<br>
<strong>{{ __('Address') }}</strong> : {{ $purchase->party->address }}
</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>{{ __('Date') }}</strong> : {{ formatted_date($purchase->purchaseDate) }}<br>
<strong>{{ __('Purchases By') }}</strong> :

View File

@@ -1,28 +1,20 @@
@foreach($products as $product)
@php
$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
<div id="single-product" class="single-product {{ $product->id }}"
data-product_id="{{ $product->id }}"
data-product_type="{{ $product->product_type }}"
data-has_serial="{{ $product->has_serial }}"
data-product_type="{{ $product->product_type }}" {{-- newly added. this logic apply when product-modal opeb --}}
data-product_code="{{ $product->productCode }}"
data-product_unit_id="{{ $product->unit->id ?? null }}"
data-product_unit_name="{{ $product->unit->unitName ?? null }}"
data-product_image="{{ $product->productPicture }}"
data-brand="{{ $product->brand->brandName ?? '' }}"
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-whole_sale_price="{{ $firstStock->productWholeSalePrice ?? 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">
<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>
@usercan('purchases.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>
@endusercan
</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') }}">
</div>
@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">
<label>{{ __('Sales Price') }}</label>
<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>
<input type="number" name="due" step="any" class="form-control" placeholder="{{ __('Enter Due') }}">
</div>
<div class="col-lg-6">
<label class="img-label">{{ __('Image') }}</label>
<div class="custom-upload-wrapper">
<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>
<!-- Preview image -->
<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 class="col-lg-12">
<div class="row">
<div class="col-10">
<label class="img-label">{{ __('Image') }}</label>
<input type="file" accept="image/*" name="image" class="form-control file-input-change" data-id="image">
</div>
<div class="col-1 align-self-center mt-3">
<img src="{{ asset('assets/images/icons/upload.png') }}" id="image" class="table-img">
</div>
</div>
</div>

View File

@@ -1,7 +1,7 @@
@extends('layouts.business.master')
@section('title')
{{ __('Sale Return') }}
{{ __('Pos Sale') }}
@endsection
@section('main_content')
@@ -49,61 +49,55 @@
<th class="border table-background text-start">{{ __('Items') }}</th>
<th class="border table-background">{{ __('Code') }}</th>
<th class="border table-background">{{ __('Qty') }}</th>
<th class="border table-background">{{ __('Sale Price') }}</th>
<th class="border table-background">{{ __('Return Qty') }}</th>
<th class="border table-background text-end">{{ __('Sale Price') }}</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>
</tr>
</thead>
<tbody class='text-start'>
@foreach($sale->details as $detail)
@php
// Calculate the discounted price per unit
// Calculate the discounted price per unit (EXCLUSIVE)
$original_price = $detail->price;
$detail_discount = $detail->discount ?? 0;
$discounted_price_per_unit = $original_price - $detail_discount - ($original_price * $discount_per_unit_factor) + $avg_rounding_amount;
$sub_total = $discounted_price_per_unit * $detail->quantities;
$exclusive_price_per_unit = $original_price - $detail_discount - ($original_price * $discount_per_unit_factor) + $avg_rounding_amount;
// 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
<tr data-max_qty="{{ $detail->quantities }}"
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-discounted_price_per_unit="{{ $discounted_price_per_unit }}"
data-serials='@json($detail->serial_numbers ?? [])'>
data-discounted_price_per_unit="{{ $inclusive_price_per_unit }}">
<td class='text-center'>
<img class="table-img" src="{{ asset($detail->product->productPicture ?? 'assets/images/products/box.svg') }}">
</td>
<td class='text-start'>{{ $detail->product->productName ?? '' }}</td>
<td class='text-center'>{{ $detail->product->productCode ?? '' }}</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-center large-td justify-content-center'>
@if (($detail->product->has_serial ?? 0) == 1 && moduleCheck('SerialCodeAddon'))
<button type="button" class="serial-cell-button serial-return-btn">
<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>
<td class='text-end price'>{{ currency_format($exclusive_price_per_unit, currency: business_currency()) }}</td>
<td class='text-end'>{{ $item_vat_percent }}%</td>
<td class='text-end vat_value'>{{ currency_format($item_vat_amount, currency: business_currency()) }}</td>
<td class='text-center large-td'>
<div class="d-flex align-items-center gap-3">
<button class="incre-decre sub-btn">
<i class="fas fa-minus icon"></i>
</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">
<button class="incre-decre sub-btn"><i class="fas fa-minus icon"></i></button>
<input type="number" step="any" value="" class="custom-number-input return-qty" placeholder="{{ __('0') }}">
<button class="incre-decre add-btn"><i class="fas fa-plus icon"></i></button>
</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
<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>
</td>
<td class="subtotal text-end">{{ currency_format(0, currency: business_currency()) }}</td>
<td class="subtotal text-end">{{ currency_format(0) }}</td>
</tr>
@endforeach
</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>
</div>
</div>
<div class="col-lg-12 delete-cancel-group mt-5">
<div class="button-group text-center">
<div class="col-lg-12 delete-cancel-group">
<div class="button-group text-center pt-5">
<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>
</div>
@@ -124,18 +118,8 @@
</div>
</div>
</div>
<input type="hidden" id="has-serial-code-addon" value="{{ moduleCheck('SerialCodeAddon') }}">
@endsection
@push('modal')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::select-serial-modal')
@endif
@endpush
@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

View File

@@ -19,13 +19,11 @@
@foreach ($sales as $sale)
@php
$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
<tr>
<td>{{ ($sales->currentPage() - 1) * $sales->perPage() + $loop->iteration }}</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 }}
</a>
</td>

View File

@@ -1,72 +1,53 @@
@if(isset($cart_contents))
@php
$modules = product_setting()->modules ?? [];
@endphp
@foreach($cart_contents as $cart)
<tr
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-update_route="{{ route('business.carts.update', $cart->rowId) }}"
data-destroy_route="{{ route('business.carts.destroy', $cart->rowId) }}">
<td>
<img class="table-img" src="{{ asset($cart->options->product_image ?? 'assets/images/products/box.svg') }}">
</td>
<td>{{ $cart->name }}</td>
<td>{{ $cart->options->product_code }}</td>
<td>{{ $cart->options->batch_no ?? '' }}</td>
<td>{{ $cart->options->product_unit_name }}</td>
<td>
<input class="text-center sales-input cart-price" type="number" step="any" min="0" value="{{ round($cart->price, 2) }}" placeholder="0">
</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)
<tr data-row_id="{{ $cart->rowId }}" data-batch_no="{{ $cart->options->batch_no ?? '' }}"
data-stock_id="{{ $cart->options->stock_id ?? '' }}"
data-update_route="{{ route('business.carts.update', $cart->rowId) }}"
data-destroy_route="{{ route('business.carts.destroy', $cart->rowId) }}">
<td>
<input class="text-center sales-input cart-discount" type="number" step="any" min="0" value="{{ $cart->options->discount ?? 0 }}" placeholder="0">
<img class="table-img" src="{{ asset($cart->options->product_image ?? 'assets/images/products/box.svg') }}">
</td>
@endif
<td class="large-td">
<div class="d-flex gap-2 align-items-center justify-content-center">
<button class="incre-decre minus-btn">
<i class="fas fa-minus icon"></i>
<td>{{ $cart->name }}</td>
<td>{{ $cart->options->product_code }}</td>
<td>{{ $cart->options->batch_no ?? '' }}</td>
<td>{{ $cart->options->product_unit_name }}</td>
<td>
<input class="text-center sales-input cart-price" type="number" step="any" min="0" value="{{ $cart->price }}"
placeholder="0">
</td>
@if ($modules['allow_product_discount'] ?? false)
<td>
<input class="text-center sales-input cart-discount" type="number" step="any" min="0"
value="{{ $cart->options->discount ?? 0 }}" placeholder="0">
</td>
@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">
<div class="d-flex gap-2 align-items-center">
<button class="incre-decre minus-btn">
<i class="fas fa-minus icon"></i>
</button>
<input type="number" step="any" value="{{ $cart->qty }}" class="dynamic-width cart-qty "
placeholder="{{ __('0') }}">
<button class="incre-decre plus-btn">
<i class="fas fa-plus icon"></i>
</button>
</div>
</td>
<td class="cart-subtotal">
{{ currency_format(($cart->price - ($cart->options->discount ?? 0)) * $cart->qty, currency: business_currency()) }}
</td>
<td>
<button class='x-btn remove-btn'>
<img src="{{ asset('assets/images/icons/x.svg') }}" alt="">
</button>
<input type="number" step="any" value="{{ $cart->qty }}" class="dynamic-width cart-qty " placeholder="{{ __('0') }}" >
<button class="incre-decre plus-btn">
<i class="fas fa-plus icon"></i>
</button>
</div>
</td>
<td class="cart-subtotal">
{{ currency_format(round(($cart->price - ($cart->options->discount ?? 0)) * $cart->qty, 2), currency: business_currency()) }}
</td>
<td>
<button class='x-btn remove-btn'>
<img src="{{ asset('assets/images/icons/x.svg') }}" alt="">
</button>
</td>
</tr>
@endforeach
@endif
</td>
</tr>
@endforeach
@endif

View File

@@ -15,7 +15,7 @@
@section('main_content')
<div class="container-fluid">
<div class="grid row sales-main-container p-lr">
<div class="grid row sales-main-container p-lr">
<div class="sales-container">
<!-- Quick Action Section -->
<div class="quick-act-header">
@@ -24,22 +24,26 @@
<h4 class='quick-act-title'>{{ __('Quick Action') }}</h4>
</div>
<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="">
{{ __('Product List') }}
</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="">
{{ __('Today Sales') }}
</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="">
{{ __('Calculator') }}
</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="">
{{ __('Dashboard') }}
</a>
@@ -52,7 +56,8 @@
<div class="row g-3">
<!-- First Row -->
<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>
<!-- Second Row -->
<div class="col-12 col-md-6">
@@ -73,12 +78,12 @@
@endforeach
</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="">
</a>
</div>
</div>
@if(moduleCheck('WarehouseAddon'))
<div class="col-6">
<div class="d-flex align-items-center">
<select required name="warehouse_id" class="form-select choices-select warehouse_id" aria-label="Select Customer">
@@ -89,7 +94,6 @@
</select>
</div>
</div>
@endif
</div>
</div>
<div class="cart-payment">
@@ -103,18 +107,17 @@
<th class="border table-background">{{ __('Batch') }}</th>
<th class="border table-background">{{ __('Unit') }}</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)
<th class="border table-background">{{ __('Discount') }}</th>
@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">{{ __('Sub Total') }}</th>
<th class="border table-background">{{ __('Action') }}</th>
</tr>
</thead>
<tbody id="sale_cart_list">
<tbody id="cart-list">
@include('business::sales.cart-list')
</tbody>
</table>
@@ -130,11 +133,13 @@
<div class="amount-info-container">
<div class="row amount-container align-items-center mb-2">
<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 class="row amount-container align-items-center mb-2">
<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 class="row amount-container align-items-center mb-2">
<h6 class="payment-title">{{ __('Due Amount') }}</h6>
@@ -160,21 +165,13 @@
<h6 class="fw-bold" id="sub_total">
{{ currency_format(0, currency: business_currency()) }}</h6>
</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 class="mb-2 d-flex align-items-center justify-content-between">
<h6>{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6>
<h6 class="fw-bold" id="vat_amount_txt">
{{ currency_format(0, currency: business_currency()) }}</h6>
</div>
<div class="row save-amount-container align-items-center mb-2">
<div class="row save-amount-container align-items-center mb-2 d-none">
<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="d-flex d-flex align-items-center gap-2">
@@ -188,7 +185,26 @@
@endforeach
</select>
</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 class="mb-2 shopping-crg-grid">
@@ -270,7 +286,6 @@ class="btn btn-brand w-100">{{ __('Brand') }}</a>
</div>
</div>
</div>
@php
$rounding_amount_option = sale_rounding();
@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="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="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')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::select-serial-modal')
@endif
@include('business::sales.calculator')
@include('business::sales.category-search')
@include('business::sales.brand-search')

View File

@@ -7,17 +7,20 @@
</div>
<div class="modal-body">
<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
<div class="row">
<div class="col-lg-6 mb-2">
<label>{{ __('Name') }}</label>
<input type="text" name="name" required class="form-control" placeholder="{{ __('Enter Name') }}">
</div>
<div class="col-lg-6 mb-2">
<label>{{ __('Phone') }}</label>
<input type="number" name="phone" class="form-control" placeholder="{{ __('Enter phone number') }}">
</div>
<div class="col-lg-6 mb-2">
<label>{{__('Party Type')}}</label>
<div class="gpt-up-down-arrow position-relative">
@@ -29,6 +32,7 @@
<span></span>
</div>
</div>
<div class="col-lg-6 mb-2">
<label>{{ __('Email') }}</label>
<input type="email" name="email" class="form-control" placeholder="{{ __('Enter Email') }}">
@@ -41,22 +45,14 @@
<label>{{ __('Due') }}</label>
<input type="number" name="due" step="any" class="form-control" placeholder="{{ __('Enter Due') }}">
</div>
<div class="col-lg-6">
<label class="img-label">{{ __('Image') }}</label>
<div class="custom-upload-wrapper">
<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>
<!-- Preview image -->
<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 class="col-lg-12">
<div class="row">
<div class="col-10">
<label class="img-label">{{ __('Image') }}</label>
<input type="file" accept="image/*" name="image" class="form-control file-input-change" data-id="image">
</div>
<div class="col-1 align-self-center mt-3">
<img src="{{ asset('assets/images/icons/upload.png') }}" id="image" class="table-img">
</div>
</div>
</div>

View File

@@ -65,87 +65,52 @@
<i class="far fa-ellipsis-v"></i>
</button>
<ul class="dropdown-menu">
@usercan('sales.read')
<li>
<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">
<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>
<img src="{{ asset('assets/images/icons/Invoic.svg') }}" alt="">
{{ __('Invoice') }}
</a>
</li>
@endusercan
@usercan('sales.read')
@php
$useTaxInvoice = moduleCheck('TaxInvoiceAddon') && invoice_setting($sale->business_id) == 'standard_a4';
@endphp
@if($useTaxInvoice)
@if ($sale->details->sum('quantities') != 0)
@usercan('sale-returns.read')
<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
href="{{ route('business.sale-returns.create', ['sale_id' => $sale->id]) }}">
<i class="fal fa-undo-alt"></i>
{{ __('Sales Return') }}
</a>
</li>
@endif
@endusercan
@if ($sale->details->sum('quantities') != 0)
@usercan('sale-returns.read')
<li>
<a
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">
<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') }}
</a>
</li>
@endusercan
@endusercan
@endif
<li>
<a href="#" class="view-payment-btn"
data-url="{{ route('business.view-payment', ['type' => 'sale', 'id' => $sale->id]) }}"
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">
<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"/>
<path d="M12 4H6" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11 7H6" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M9 10H6" stroke="#4B5563" stroke-linecap="round" stroke-linejoin="round"/>
<svg width="18" height="18" viewBox="0 0 18 18" fill="none"
xmlns="http://www.w3.org/2000/svg">
<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" />
<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>
</i> {{ __('View Payment') }}
</a>
</li>
@if (!in_array($sale->id, $salesWithReturns))
@usercan('sales.update')
<li>
<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">
<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>
<i class="fal fa-edit"></i>
{{ __('Edit') }}
</a>
</li>
@@ -154,12 +119,7 @@
<li>
<a href="{{ route('business.sales.destroy', $sale->id) }}"
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">
<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>
<i class="fal fa-trash-alt"></i>
{{ __('Delete') }}
</a>
</li>

View File

@@ -20,7 +20,7 @@
@csrf
@method('put')
<div class="row ">
<div class="row mt-3">
<div class="col-lg-4">
<label>{{ __('Customer') }}</label>
<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)
@if (!empty($product->stocks) && $product->stocks->count() > 1)
{{-- 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">
<img src="{{ asset($product->productPicture ?? 'assets/images/products/box.svg') }}" alt="">
<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-purchase_price="{{ $product->productPurchasePrice }}"
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">
{{ __('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>
</div>
<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_batch_no="{{ $stock->batch_no ?? '' }}"
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">
<img src="{{ asset($product->productPicture ?? 'assets/images/products/box.svg') }}" alt="">
<div class="product-text">
@@ -118,7 +120,7 @@ class="btn btn-danger square-btn d-flex justify-content-center align-items-cente
</div>
<div class="d-flex align-items-center justify-content-between w-100">
<div class="product-des">
{{ __('Batch') }}: {{ $stock->batch_no ?? 'N/A' }}, {{ __('Code') }}: {{ $product->productCode }}
{{ __('Batch') }}: {{ $stock->batch_no ?? 'N/A' }}
{{ $product->color ? ', Color: ' . $product->color : '' }}
<span class="product-in-stock">{{ __('In Stock') }}: {{ $stock->productStock ?? 0 }}</span>
</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">{{ __('Unit') }}</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)
<th class="border p-2 table-background">{{ __('Discount') }}</th>
@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">{{ __('Sub Total') }}</th>
<th class="border p-2 table-background">{{ __('Action') }}</th>
</tr>
</thead>
<tbody id="sale_cart_list">
<tbody id="cart-list">
@include('business::sales.cart-list')
</tbody>
</table>
</div>
<div class="col-sm-12 col-md-6 col-lg-6 mt-5">
<div class="amount-info-container inventory-amount-info-container">
<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">
{{ currency_format(0, currency: business_currency()) }}</h6>
</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 class="mb-2 d-flex align-items-center justify-content-between">
<h6>{{ __('Vat') }}</h6>
<h6 class="fw-bold" id="vat_amount_txt">
{{ currency_format(($sale->vat_amount ?? 0) != 0 ? $sale->vat_amount : (($sale->vat_percent ?? 0) != 0 ? $sale->vat_percent : 0), currency: business_currency()) }}</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="row save-amount-container align-items-center mb-2 d-none">
<h6 class="payment-title col-6">{{ __('Vat') }}</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="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>
</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">
<h6 class="payment-title col-6">{{ __('Shipping Charge') }}</h6>
<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="asset_base_url" value="{{ asset('') }}">
<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
@push('modal')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::select-serial-modal')
@endif
@include('business::sales.calculator')
@include('business::sales.customer-create')
@endpush

View File

@@ -78,7 +78,6 @@ class="ajaxform">
</a>
</div>
</div>
@if(moduleCheck('WarehouseAddon'))
<div class="col-6">
<div class="d-flex align-items-center">
<select required name="warehouse_id" class="form-select choices-select warehouse_id" aria-label="Select Customer">
@@ -89,7 +88,6 @@ class="ajaxform">
</select>
</div>
</div>
@endif
</div>
</div>
<div class="cart-payment">
@@ -103,18 +101,17 @@ class="ajaxform">
<th class="border table-background">{{ __('Batch') }}</th>
<th class="border table-background">{{ __('Unit') }}</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)
<th class="border table-background">{{ __('Discount') }}</th>
@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">{{ __('Sub Total') }}</th>
<th class="border table-background">{{ __('Action') }}</th>
</tr>
</thead>
<tbody class='text-start' id="sale_cart_list">
<tbody class='text-start' id="cart-list">
@include('business::sales.cart-list')
</tbody>
</table>
@@ -168,25 +165,12 @@ class="form-control" placeholder="{{ __('Type note...') }}">
<h6 class="fw-bold" id="sub_total">
{{ currency_format(0, currency: business_currency()) }}</h6>
</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 class="mb-2 d-flex align-items-center justify-content-between">
<h6>{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6>
<h6 class="fw-bold" id="vat_amount_txt">
{{ currency_format(($sale->vat_amount ?? 0) != 0 ? $sale->vat_amount : (($sale->vat_percent ?? 0) != 0 ? $sale->vat_percent : 0), currency: business_currency()) }}</h6>
</div>
<div class="row save-amount-container align-items-center mb-2">
<div class="row save-amount-container align-items-center mb-2 d-none">
<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="d-flex d-flex align-items-center gap-2">
@@ -207,6 +191,24 @@ class="form-control" placeholder="{{ __('Type note...') }}">
</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">
<h6 class="payment-title">{{ __('Shipping Charge') }}</h6>
<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">
@csrf
<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...') }}">
<button class="btn btn-search">
<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="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="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
@push('modal')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::select-serial-modal')
@endif
@include('business::sales.calculator')
@include('business::sales.category-search')
@include('business::sales.brand-search')

View File

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

View File

@@ -15,11 +15,11 @@
<h4>{{ __('Inventory Sales') }}</h4>
</div>
<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
<input type="hidden" name="type" value="inventory">
<div class="row ">
<div class="row mt-3">
<div class="col-lg-4">
<label>{{ __('Customer') }}</label>
<div class="input-group">
@@ -67,7 +67,7 @@ class="btn btn-danger square-btn d-flex justify-content-center align-items-cente
</div>
<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 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">{{ __('Unit') }}</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)
<th class="border p-2 table-background">{{ __('Discount') }}</th>
@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">{{ __('Sub Total') }}</th>
<th class="border p-2 table-background">{{ __('Action') }}</th>
</tr>
</thead>
<tbody id="sale_cart_list">
<tbody id="cart-list">
@include('business::sales.cart-list')
</tbody>
</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">
{{ currency_format(0, currency: business_currency()) }}</h6>
</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 class="mb-2 d-flex align-items-center justify-content-between">
<h6>{{ get_business_option('business-settings')['vat_name'] ?? 'Vat' }}</h6>
<h6 class="fw-bold" id="vat_amount_txt">
{{ currency_format(0, currency: business_currency()) }}</h6>
</div>
<div class="row save-amount-container align-items-center mb-2">
<div class="row save-amount-container align-items-center mb-2 d-none">
<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="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>
</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">
<h6 class="payment-title">{{ __('Shipping Charge') }}</h6>
<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="asset_base_url" value="{{ url('/') }}">
<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
@push('modal')
@if (moduleCheck('SerialCodeAddon'))
@include('serialcodeaddon::select-serial-modal')
@endif
@include('business::sales.calculator')
@include('business::sales.customer-create')
@endpush

View File

@@ -5,11 +5,9 @@
@endsection
@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')
@else
@include('business::sales.invoices.a4-size')
@endif
@endsection

View File

@@ -1,10 +1,9 @@
@extends('layouts.business.pdf.pdf_layout')
@section('pdf_title')
<style>
body {
font-family: notosansarmenian, sans-serif;
font-family: sans-serif;
font-size: 12px;
color: #000;
}
@@ -12,8 +11,6 @@
.invoice-container {
width: 100%;
padding: 10px;
direction: {{ app()->getLocale() == 'ar' ? 'rtl' : 'ltr' }};
text-align: {{ app()->getLocale() == 'ar' ? 'right' : 'left' }};
}
.border-none {
@@ -151,36 +148,10 @@
@include('business::pdf.fonts-css')
<style>
body {
font-family: notosansarmenian, sans-serif;
font-family: sans-serif;
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 {
width: 100%;
margin-bottom: 10px;
@@ -240,10 +211,6 @@
font-size: 11px;
margin-top: 10px;
}
.invoice-badge{
background-color: #c52127 !important;
}
</style>
@endpush
@endsection
@@ -263,7 +230,7 @@
}
@endphp
<div class="invoice-container" dir="{{ app()->getLocale() == 'ar' ? 'rtl' : 'ltr' }}">
<div class="invoice-container">
{{-- Header --}}
<table class="header-table">
<tr>
@@ -311,12 +278,12 @@
</table>
{{-- INVOICE BADGE --}}
<h3 class="invoice-badge"
<h3
style="
font-size: 20px;
font-weight: 600;
color: white;
background-color: #c52127;
padding: 5px 12px;
border-radius: 30px;
margin: 0;
@@ -333,14 +300,14 @@
{{-- Customer & Invoice Info --}}
<table class="header-table">
<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>{{ __('Address') }} : {{ $sale->party->address ?? '' }}</div>
<div>{{ __('Phone') }} : {{ $sale->party->phone ?? __('Guest') }}</div>
<div>{{ __('Remarks') }} : {{ $sale->meta['note'] ?? 'N/A' }}</div>
</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>{{ __('Date') }} : {{ formatted_date($sale->saleDate ?? '') }}</div>
<div>{{ __('Time') }} : {{ formatted_time($sale->saleDate ?? '') }}</div>
@@ -403,7 +370,7 @@
</table>
<table class="table-summery" width="100%" style="margin-top:15px;">
<table width="100%" style="margin-top:15px;">
<tr>
<!-- LEFT SIDE -->
<td width="60%" valign="top">

View File

@@ -2,25 +2,15 @@
@php
$firstStock = $product->stocks->first();
$purchasePrice = $firstStock->productPurchasePrice ?? 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);
$salePrice = $product->product_type === 'combo' ? ($product->productSalePrice ?? 0) : ($firstStock->productSalePrice ?? 0);
@endphp
<div class="single-product {{ $product->id }}"
data-product_id="{{ $product->id }}"
data-product_type="{{ $product->product_type }}"
data-has_serial="{{ $product->has_serial }}"
data-default_price="{{ $salePrice }}"
data-product_code="{{ $product->productCode }}"
data-product_unit_id="{{ $product->unit->id ?? null }}"
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="single-product {{ $product->id }}" data-product_id="{{ $product->id }}"
data-product_type="{{ $product->product_type }}" data-default_price="{{ $salePrice }}"
data-product_code="{{ $product->productCode }}" data-product_unit_id="{{ $product->unit->id ?? null }}"
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-stocks='@json($product->stocks)'
data-route="{{ route('business.carts.store') }}" data-vat_percent="{{ $product->vat->rate ?? 0 }}">
<div class="pro-img w-100">
<img src="{{ asset($product->productPicture ?? 'assets/images/products/box.svg') }}" alt="">
</div>
@@ -34,6 +24,6 @@
</div>
@empty
<div class="alert alert-danger not-found mt-1" role="alert">
{{ __('No product found') }}
No product found
</div>
@endforelse
@endforelse

View File

@@ -8,7 +8,7 @@
Route::apiResource('departments', Hrm\DepartmentController::class);
Route::apiResource('designations', Hrm\DesignationController::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('attendances', Hrm\AttendanceController::class);
Route::apiResource('holidays', Hrm\HolidayController::class);

View File

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