finishing to dev
All checks were successful
All checks were successful
This commit is contained in:
@@ -31,6 +31,16 @@ public function index(Request $request)
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->whereIn('type', ['debit', 'credit']);
|
||||
|
||||
$total_cash_in = (clone $query)
|
||||
->where('type', 'credit')
|
||||
->sum('amount');
|
||||
|
||||
$total_cash_out = (clone $query)
|
||||
->where('type', 'debit')
|
||||
->sum('amount');
|
||||
|
||||
$total_running_cash = $total_cash_in - $total_cash_out;
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
@@ -60,16 +70,6 @@ public function index(Request $request)
|
||||
$perPage = $request->input('per_page', 20);
|
||||
$cash_flows = $query->paginate($perPage)->appends($request->query());
|
||||
|
||||
$cashflow_cash_in = (clone $query)
|
||||
->where('type', 'credit')
|
||||
->sum('amount');
|
||||
|
||||
$cashflow_cash_out = (clone $query)
|
||||
->where('type', 'debit')
|
||||
->sum('amount');
|
||||
|
||||
$total_running_cash = $cashflow_cash_in - $cashflow_cash_out;
|
||||
|
||||
$firstDate = $cash_flows->first()?->date;
|
||||
|
||||
if ($firstDate) {
|
||||
@@ -83,14 +83,11 @@ public function index(Request $request)
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
'data' => view('business::cash-flow.datas', compact('cash_flows', 'cashflow_cash_in', 'cashflow_cash_out', 'opening_balance', 'total_running_cash', 'filter_from_date', 'filter_to_date', 'duration'))->render(),
|
||||
'cashflow_cash_in' => currency_format($cashflow_cash_in, 'icon', 2, business_currency()),
|
||||
'cashflow_cash_out' => currency_format($cashflow_cash_out, 'icon', 2, business_currency()),
|
||||
'total_running_cash' => currency_format($total_running_cash, 'icon', 2, business_currency()),
|
||||
'data' => view('business::cash-flow.datas', compact('cash_flows', 'total_cash_in', 'total_cash_out', 'opening_balance', 'total_running_cash', 'filter_from_date', 'filter_to_date', 'duration'))->render()
|
||||
]);
|
||||
}
|
||||
|
||||
return view('business::cash-flow.index', compact('cash_flows', 'cashflow_cash_in', 'cashflow_cash_out', 'opening_balance', 'total_running_cash', 'filter_from_date', 'filter_to_date', 'duration'));
|
||||
return view('business::cash-flow.index', compact('cash_flows', 'total_cash_in', 'total_cash_out', 'opening_balance', 'total_running_cash', 'filter_from_date', 'filter_to_date', 'duration'));
|
||||
}
|
||||
|
||||
public function exportExcel()
|
||||
@@ -103,9 +100,9 @@ public function exportCsv()
|
||||
return Excel::download(new ExportCashFlowReport, 'cash-flow.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$query = Transaction::with([
|
||||
$cash_flows = Transaction::with([
|
||||
'paymentType:id,name',
|
||||
'sale:id,party_id',
|
||||
'sale.party:id,name',
|
||||
@@ -117,47 +114,12 @@ public function exportPdf(Request $request)
|
||||
'dueCollect.party:id,name',
|
||||
])
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->whereIn('type', ['debit', 'credit']);
|
||||
->whereIn('type', ['debit', 'credit'])
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
$opening_balance = 0;
|
||||
|
||||
$this->applyDateFilter($query, $duration, 'date', $request->from_date, $request->to_date);
|
||||
|
||||
// Search filter
|
||||
if ($request->filled('search')) {
|
||||
$query->where(function ($query) use ($request) {
|
||||
$query->where('date', 'like', '%' . $request->search . '%')
|
||||
->orWhere('invoice_no', 'like', '%' . $request->search . '%')
|
||||
->orWhere('platform', 'like', '%' . $request->search . '%')
|
||||
->orWhere('amount', 'like', '%' . $request->search . '%')
|
||||
->orWhere('transaction_type', 'like', '%' . $request->search . '%')
|
||||
->orWhereHas('paymentType', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Platform filter
|
||||
if ($request->filled('platform')) {
|
||||
$query->where('platform', $request->platform);
|
||||
}
|
||||
|
||||
// Paginate data
|
||||
$cash_flows = $query->limit($request->per_page ?? 20)->get();
|
||||
|
||||
$firstDate = $cash_flows->first()?->date;
|
||||
|
||||
if ($firstDate) {
|
||||
$opening_balance = (clone $query)
|
||||
->whereDate('date', '<', $firstDate)
|
||||
->selectRaw("SUM(CASE WHEN type='credit' THEN amount ELSE 0 END) - SUM(CASE WHEN type='debit' THEN amount ELSE 0 END) as balance")
|
||||
->value('balance') ?? 0;
|
||||
} else {
|
||||
$opening_balance = 0;
|
||||
}
|
||||
|
||||
return PdfService::render('business::cash-flow.pdf', compact('cash_flows', 'opening_balance', 'duration', 'filter_from_date', 'filter_to_date'),'cash-flow-report.pdf');
|
||||
return PdfService::render('business::cash-flow.pdf', compact('cash_flows', 'opening_balance'),'cash-flow-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,54 +86,27 @@ public function exportCsv()
|
||||
return Excel::download(new ExportComboProductReport, 'combo-product-report.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$branchId = null;
|
||||
if (moduleCheck('MultiBranchAddon')) {
|
||||
$branchId = $user->branch_id ?? $user->active_branch_id;
|
||||
}
|
||||
|
||||
$search = $request->input('search');
|
||||
|
||||
$combo_products = Product::with(['combo_products.stock.product', 'unit:id,unitName', 'category:id,categoryName'])
|
||||
$combo_products = Product::with(['combo_products', 'unit:id,unitName', 'category:id,categoryName'])
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->where('product_type', 'combo')
|
||||
->withCount('combo_products as total_combo_products')
|
||||
->when($search, function ($q) use ($search) {
|
||||
$q->where(function ($q) use ($search) {
|
||||
$q->where('productName', 'like', '%' . $search . '%')
|
||||
->orWhere('productCode', 'like', '%' . $search . '%')
|
||||
->orWhereHas('category', function ($q) use ($search) {
|
||||
$q->where('categoryName', 'like', '%' . $search . '%');
|
||||
})
|
||||
->orWhereHas('unit', function ($q) use ($search) {
|
||||
$q->where('unitName', 'like', '%' . $search . '%');
|
||||
});
|
||||
});
|
||||
})
|
||||
->when($branchId, function ($q) use ($branchId) {
|
||||
$q->whereHas('combo_products.stock', function ($q) use ($branchId) {
|
||||
$q->where('branch_id', $branchId);
|
||||
});
|
||||
})
|
||||
|
||||
->latest()
|
||||
->limit($request->per_page ?? 20)->get();
|
||||
->get();
|
||||
|
||||
$combo_products->transform(function ($product) {
|
||||
$product->total_stock = $product->combo_products->sum(function ($combo) {
|
||||
return optional($combo->stock)->productStock ?? 0;
|
||||
});
|
||||
|
||||
$product->total_cost = $product->combo_products->sum(function ($combo) {
|
||||
return ($combo->quantity ?? 0) * ($combo->purchase_price ?? 0);
|
||||
});
|
||||
|
||||
return $product;
|
||||
$combo_products->transform(function ($product) {
|
||||
$product->total_stock = $product->combo_products->sum(function ($combo) {
|
||||
return optional($combo->stock)->productStock ?? 0;
|
||||
});
|
||||
|
||||
$product->total_cost = $product->combo_products->sum(function ($combo) {
|
||||
return ($combo->quantity ?? 0) * ($combo->purchase_price ?? 0);
|
||||
});
|
||||
|
||||
return $product;
|
||||
});
|
||||
|
||||
return PdfService::render('business::reports.combo-products.pdf', compact('combo_products'),'combo-product-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,31 +60,44 @@ public function index(Request $request)
|
||||
$query->where('platform', $request->platform);
|
||||
}
|
||||
|
||||
// Calculate summary data
|
||||
$all_summary_records = (clone $query)->get();
|
||||
|
||||
$total_amount = $all_summary_records->sum(function ($day_book) {
|
||||
return match ($day_book->platform) {
|
||||
'sale' => $day_book->sale?->totalAmount ?? 0,
|
||||
'sale_return' => $day_book->saleReturn?->sale?->totalAmount ?? 0,
|
||||
'purchase' => $day_book->purchase?->totalAmount ?? 0,
|
||||
'purchase_return' => $day_book->purchaseReturn?->purchase?->totalAmount ?? 0,
|
||||
'due_collect', 'due_pay' => $day_book->dueCollect?->totalDue ?? 0,
|
||||
default => 0
|
||||
};
|
||||
});
|
||||
|
||||
$total_money_in = $all_summary_records->where('type', 'credit')->sum(function ($day_book) {
|
||||
return match ($day_book->platform) {
|
||||
'sale' => $day_book->sale?->totalAmount ?? 0,
|
||||
'sale_return' => $day_book->saleReturn?->sale?->totalAmount ?? 0,
|
||||
'purchase' => $day_book->purchase?->totalAmount ?? 0,
|
||||
'purchase_return' => $day_book->purchaseReturn?->purchase?->totalAmount ?? 0,
|
||||
'due_collect', 'due_pay' => $day_book->dueCollect?->totalDue ?? 0,
|
||||
default => 0
|
||||
};
|
||||
});
|
||||
|
||||
$total_money_out = $all_summary_records->where('type', 'debit')->sum('amount');
|
||||
|
||||
// Paginate data
|
||||
$perPage = $request->input('per_page', 20);
|
||||
$day_books = $query->latest()->paginate($perPage)->appends($request->query());
|
||||
|
||||
// Calculate summary data
|
||||
$total_money_in = (clone $query)
|
||||
->where('type', 'credit')
|
||||
->sum('amount');
|
||||
|
||||
$total_money_out = (clone $query)
|
||||
->where('type', 'debit')
|
||||
->sum('amount');
|
||||
|
||||
$total_money_in_out_amount = $total_money_in + $total_money_out;
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
'data' => view('business::day-book.datas', compact('day_books', 'total_money_in_out_amount', 'total_money_in', 'total_money_out', 'filter_from_date', 'filter_to_date', 'duration'))->render(),
|
||||
'total_money_in' => currency_format($total_money_in, 'icon', 2, business_currency()),
|
||||
'total_money_out' => currency_format($total_money_out, 'icon', 2, business_currency()),
|
||||
'total_money_in_out_amount' => currency_format($total_money_in_out_amount, 'icon', 2, business_currency()),
|
||||
'data' => view('business::day-book.datas', compact('day_books', 'total_amount', 'total_money_in', 'total_money_out', 'filter_from_date', 'filter_to_date', 'duration'))->render()
|
||||
]);
|
||||
}
|
||||
|
||||
return view('business::day-book.index', compact('day_books', 'total_money_in_out_amount', 'total_money_in', 'total_money_out', 'filter_from_date', 'filter_to_date', 'duration'));
|
||||
return view('business::day-book.index', compact('day_books', 'total_amount', 'total_money_in', 'total_money_out', 'filter_from_date', 'filter_to_date', 'duration'));
|
||||
}
|
||||
|
||||
public function exportExcel()
|
||||
@@ -97,9 +110,9 @@ public function exportCsv()
|
||||
return Excel::download(new ExportDayBookReport, 'day-book.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$query = Transaction::with([
|
||||
$day_books = Transaction::with([
|
||||
'paymentType:id,name',
|
||||
'sale:id,user_id,party_id,totalAmount',
|
||||
'sale.party:id,name',
|
||||
@@ -114,37 +127,10 @@ public function exportPdf(Request $request)
|
||||
'dueCollect.user:id,name',
|
||||
])
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->whereIn('type', ['debit', 'credit']);
|
||||
->whereIn('type', ['debit', 'credit'])
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
// Apply date filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$this->applyDateFilter($query, $duration, 'date', $request->from_date, $request->to_date);
|
||||
|
||||
// Search filter
|
||||
if ($request->filled('search')) {
|
||||
$query->where(function ($query) use ($request) {
|
||||
$query->where('date', 'like', '%' . $request->search . '%')
|
||||
->orWhere('invoice_no', 'like', '%' . $request->search . '%')
|
||||
->orWhere('platform', 'like', '%' . $request->search . '%')
|
||||
->orWhere('amount', 'like', '%' . $request->search . '%')
|
||||
->orWhere('type', 'like', '%' . $request->search . '%')
|
||||
->orWhere('transaction_type', 'like', '%' . $request->search . '%')
|
||||
->orWhereHas('paymentType', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Platform filter
|
||||
if ($request->filled('platform')) {
|
||||
$query->where('platform', $request->platform);
|
||||
}
|
||||
|
||||
// Paginate data
|
||||
$day_books = $query->latest()->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::day-book.pdf', compact('day_books', 'duration', 'filter_from_date', 'filter_to_date'),'day-book-report.pdf');
|
||||
return PdfService::render('business::day-book.pdf', compact('day_books'), 'day-book-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class AcnooDiscountProductReportController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
||||
$user = auth()->user();
|
||||
|
||||
$branchId = null;
|
||||
@@ -20,7 +21,7 @@ public function index(Request $request)
|
||||
$branchId = $user->branch_id ?? $user->active_branch_id;
|
||||
}
|
||||
|
||||
$discount_products = SaleDetails::with('product:id,productName,productCode,hsn_code')
|
||||
$discount_products = SaleDetails::with('product:id,productName,productCode')
|
||||
->whereHas('product', function ($q) {
|
||||
$q->where('business_id', auth()->user()->business_id);
|
||||
})
|
||||
@@ -61,35 +62,13 @@ public function exportCsv()
|
||||
return Excel::download(new ExportDiscountProduct, 'discount-products.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$branchId = null;
|
||||
if (moduleCheck('MultiBranchAddon')) {
|
||||
$branchId = $user->branch_id ?? $user->active_branch_id;
|
||||
}
|
||||
|
||||
$discount_products = SaleDetails::with('product:id,productName,productCode,hsn_code')
|
||||
$discount_products = SaleDetails::with('product:id,productName,productCode')
|
||||
->whereHas('product', function ($q) {
|
||||
$q->where('business_id', auth()->user()->business_id);
|
||||
})
|
||||
->when(request('search'), function ($q) use ($request) {
|
||||
$q->whereHas('product', function ($q) use ($request) {
|
||||
$q->where('productName', 'like', '%' . $request->search . '%')
|
||||
->orWhere('productCode', 'like', '%' . $request->search . '%')
|
||||
->orWhere('productPurchasePrice', 'like', '%' . $request->search . '%')
|
||||
->orWhere('price', 'like', '%' . $request->search . '%')
|
||||
->orWhere('discount', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
})
|
||||
->when($branchId, function ($q) use ($branchId) {
|
||||
$q->whereHas('sale', function ($q) use ($branchId) {
|
||||
$q->where('branch_id', $branchId);
|
||||
});
|
||||
})
|
||||
->where('discount', '>', 0)
|
||||
->limit($request->per_page ?? 20)
|
||||
->get();
|
||||
|
||||
return PdfService::render('business::reports.discount-products.pdf', compact('discount_products'),'discount-product-report.pdf');
|
||||
|
||||
@@ -32,56 +32,79 @@ public function index(Request $request)
|
||||
->orWhere('credit_limit', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
})
|
||||
->when($request->type, function ($q) use ($request) {
|
||||
$q->where('type', $request->type);
|
||||
->when(request('type'), function ($q) use ($request) {
|
||||
$q->where(function ($q) use ($request) {
|
||||
$q->where('type', $request->type);
|
||||
});
|
||||
})
|
||||
->with('sales_dues')
|
||||
->latest();
|
||||
|
||||
$parties = $query->paginate($request->per_page ?? 20)->appends($request->query());
|
||||
if ($activeBranch) {
|
||||
$query->whereHas('sales_dues', function ($q) use ($activeBranch) {
|
||||
$q->where('branch_id', $activeBranch->id)
|
||||
->where('dueAmount', '>', 0);
|
||||
});
|
||||
} else {
|
||||
$query->where('due', '>', 0);
|
||||
}
|
||||
|
||||
$parties = $query->paginate($request->per_page ?? 20);
|
||||
|
||||
if ($activeBranch) {
|
||||
$parties->setCollection(
|
||||
$parties->getCollection()
|
||||
->transform(function ($customer) use ($activeBranch) {
|
||||
$party_due = $customer->sales_dues
|
||||
$customer->due = $customer->sales_dues
|
||||
->where('branch_id', $activeBranch->id)
|
||||
->sum('dueAmount');
|
||||
|
||||
if ($customer->branch_id === $activeBranch->id) {
|
||||
$openingBalanceDue = $customer->opening_balance_type === 'due'
|
||||
? ($customer->opening_balance ?? 0)
|
||||
: 0;
|
||||
|
||||
$customer->due = $openingBalanceDue + $party_due;
|
||||
} else {
|
||||
|
||||
$customer->due = $party_due;
|
||||
}
|
||||
|
||||
return $customer;
|
||||
})
|
||||
->filter(fn($customer) => $customer->due > 0)
|
||||
->values()
|
||||
);
|
||||
}
|
||||
|
||||
$total_due = $parties->sum(fn($customer) => $customer->due);
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
'data' => view('business::reports.due.datas', compact('parties', 'total_due'))->render()
|
||||
]);
|
||||
}
|
||||
|
||||
if ($activeBranch) {
|
||||
// Filter customers that have branch-specific due > 0
|
||||
$query->whereHas('sales_dues', function ($q) use ($activeBranch) {
|
||||
$q->where('branch_id', $activeBranch->id)
|
||||
->where('dueAmount', '>', 0);
|
||||
});
|
||||
} else {
|
||||
// global due > 0
|
||||
$query->where('due', '>', 0);
|
||||
}
|
||||
|
||||
$parties = $query->paginate(20)->appends($request->query());
|
||||
|
||||
// Replace customer due with branch-specific due if active branch exists
|
||||
if ($activeBranch) {
|
||||
$parties->setCollection(
|
||||
$parties->getCollection()
|
||||
->filter(fn($customer) => ($customer->due ?? 0) > 0)
|
||||
->transform(function ($customer) use ($activeBranch) {
|
||||
$customer->due = $customer->sales_dues
|
||||
->where('branch_id', $activeBranch->id)
|
||||
->sum('dueAmount');
|
||||
return $customer;
|
||||
})
|
||||
->filter(fn($customer) => $customer->due > 0)
|
||||
->values()
|
||||
);
|
||||
}
|
||||
|
||||
$customer_total_due = $parties->getCollection()->sum('due');
|
||||
// Calculate total_due
|
||||
$total_due = $parties->sum(fn($customer) => $customer->due);
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
'data' => view('business::reports.due.datas', compact('parties'))->render(),
|
||||
'customer_total_due' => currency_format($customer_total_due, currency: business_currency())
|
||||
]);
|
||||
}
|
||||
|
||||
return view('business::reports.due.due-reports', compact('parties', 'customer_total_due'));
|
||||
return view('business::reports.due.due-reports', compact('parties', 'total_due'));
|
||||
}
|
||||
|
||||
public function exportExcel()
|
||||
@@ -94,59 +117,37 @@ public function exportCsv()
|
||||
return Excel::download(new ExportDue, 'customer-due.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$user = auth()->user();
|
||||
$businessId = $user->business_id;
|
||||
$activeBranch = $user->active_branch;
|
||||
$business_id = $user->business_id;
|
||||
|
||||
$query = Party::where('business_id', $business_id)
|
||||
$query = Party::where('business_id', $businessId)
|
||||
->where('type', '!=', 'Supplier')
|
||||
->when($request->search, function ($q) use ($request) {
|
||||
$q->where(function ($q2) use ($request) {
|
||||
$q2->where('type', 'like', '%' . $request->search . '%')
|
||||
->orWhere('name', 'like', '%' . $request->search . '%')
|
||||
->orWhere('phone', 'like', '%' . $request->search . '%')
|
||||
->orWhere('credit_limit', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
})
|
||||
->when($request->type, function ($q) use ($request) {
|
||||
$q->where('type', $request->type);
|
||||
})
|
||||
->with('sales_dues')
|
||||
->latest();
|
||||
|
||||
if ($activeBranch) {
|
||||
$query->whereHas('sales_dues', function ($q) use ($activeBranch) {
|
||||
$q->where('branch_id', $activeBranch->id)
|
||||
->where('dueAmount', '>', 0);
|
||||
});
|
||||
} else {
|
||||
$query->where('due', '>', 0);
|
||||
}
|
||||
|
||||
$parties = $query->get();
|
||||
|
||||
if ($activeBranch) {
|
||||
$parties = $parties
|
||||
->transform(function ($customer) use ($activeBranch) {
|
||||
$party_due = $customer->sales_dues
|
||||
->where('branch_id', $activeBranch->id)
|
||||
->sum('dueAmount');
|
||||
|
||||
if ($customer->branch_id === $activeBranch->id) {
|
||||
$openingBalanceDue = $customer->opening_balance_type === 'due'
|
||||
? ($customer->opening_balance ?? 0)
|
||||
: 0;
|
||||
|
||||
$customer->due = $openingBalanceDue + $party_due;
|
||||
} else {
|
||||
|
||||
$customer->due = $party_due;
|
||||
}
|
||||
return $customer;
|
||||
})
|
||||
->filter(fn($customer) => $customer->due > 0)
|
||||
->take($request->per_page ?? 20)
|
||||
->values();
|
||||
} else {
|
||||
$parties = $parties
|
||||
->filter(fn($customer) => ($customer->due ?? 0) > 0)
|
||||
->take($request->per_page ?? 20)
|
||||
->values();
|
||||
$parties->transform(function ($supplier) use ($activeBranch) {
|
||||
$supplier->due = $supplier->sales_dues
|
||||
->where('branch_id', $activeBranch->id)
|
||||
->sum('dueAmount');
|
||||
return $supplier;
|
||||
})->filter(fn($supplier) => $supplier->due > 0);
|
||||
}
|
||||
|
||||
return PdfService::render('business::reports.due.pdf', compact('parties'), 'customer-due-report.pdf');
|
||||
return PdfService::render('business::reports.due.pdf', compact('parties'),'customer-due-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
use App\Models\Branch;
|
||||
use App\Models\Expense;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\PdfService;
|
||||
use App\Traits\DateFilterTrait;
|
||||
@@ -25,6 +26,10 @@ public function index(Request $request)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
|
||||
$total_expense = Expense::where('business_id', $businessId)
|
||||
->whereDate('expenseDate', Carbon::today()->format('Y-m-d'))
|
||||
->sum('amount');
|
||||
|
||||
$expenseQuery = Expense::with('category:id,categoryName', 'payment_type:id,name', 'branch:id,name', 'transactions')
|
||||
->where('business_id', $businessId);
|
||||
|
||||
@@ -85,40 +90,10 @@ public function exportCsv()
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
{
|
||||
$expenseQuery = Expense::with('category:id,categoryName', 'payment_type:id,name', 'branch:id,name', 'transactions')
|
||||
->where('business_id', auth()->user()->business_id);
|
||||
$expense_reports = Expense::with('category:id,categoryName', 'payment_type:id,name', 'branch:id,name', 'transactions')->where('business_id', auth()->user()->business_id)
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
$expenseQuery->when($request->branch_id, function ($q) use ($request) {
|
||||
$q->where('branch_id', $request->branch_id);
|
||||
});
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$this->applyDateFilter($expenseQuery, $duration, 'expenseDate', $request->from_date, $request->to_date);
|
||||
|
||||
// Search Filter
|
||||
if ($request->filled('search')) {
|
||||
$expenseQuery->where(function ($query) use ($request) {
|
||||
$query->where('expanseFor', 'like', '%' . $request->search . '%')
|
||||
->orWhere('paymentType', 'like', '%' . $request->search . '%')
|
||||
->orWhere('referenceNo', 'like', '%' . $request->search . '%')
|
||||
->orWhere('amount', 'like', '%' . $request->search . '%')
|
||||
->orWhereHas('category', function ($q) use ($request) {
|
||||
$q->where('categoryName', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('payment_type', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('branch', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$expense_reports = $expenseQuery->latest()->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::reports.expense.pdf', compact('expense_reports', 'duration', 'filter_from_date', 'filter_to_date'),'expenses-report.pdf');
|
||||
return PdfService::render('business::reports.expense.pdf', compact('expense_reports'),'expenses-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,46 +80,17 @@ public function exportCsv()
|
||||
return Excel::download(new ExportExpiredProductReport, 'expired-product-reports.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
$expiredProductsQuery = Product::with(['unit:id,unitName', 'brand:id,brandName', 'category:id,categoryName', 'stocks'])
|
||||
$expired_products = Product::with('unit:id,unitName', 'brand:id,brandName', 'category:id,categoryName', 'stocks')
|
||||
->withSum('stocks', 'productStock')
|
||||
->where('business_id', $businessId)
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->whereHas('stocks', function ($query) {
|
||||
$query->whereDate('expire_date', '<=', today())->where('productStock', '>', 0);
|
||||
});
|
||||
$query->whereDate('expire_date', '<', today())->where('productStock', '>', 0);
|
||||
})
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$expiredProductsQuery->whereHas('stocks', function ($q) use ($duration, $request) {
|
||||
$this->applyDateFilter($q, $duration, 'expire_date', $request->from_date, $request->to_date);
|
||||
});
|
||||
|
||||
// Search Filter
|
||||
if ($request->filled('search')) {
|
||||
$search = $request->search;
|
||||
$expiredProductsQuery->where(function ($query) use ($search) {
|
||||
$query->where('productName', 'like', '%' . $search . '%')
|
||||
->orWhere('productCode', 'like', '%' . $search . '%')
|
||||
->orWhere('productPurchasePrice', 'like', '%' . $search . '%')
|
||||
->orWhere('productSalePrice', 'like', '%' . $search . '%')
|
||||
->orWhereHas('category', function ($q) use ($search) {
|
||||
$q->where('categoryName', 'like', '%' . $search . '%');
|
||||
})
|
||||
->orWhereHas('brand', function ($q) use ($search) {
|
||||
$q->where('brandName', 'like', '%' . $search . '%');
|
||||
})
|
||||
->orWhereHas('unit', function ($q) use ($search) {
|
||||
$q->where('unitName', 'like', '%' . $search . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$expired_products = $expiredProductsQuery->latest()->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::reports.expired-products.pdf', compact('expired_products', 'duration', 'filter_from_date', 'filter_to_date'),'expired-product-report.pdf');
|
||||
return PdfService::render('business::reports.expired-products.pdf', compact('expired_products'),'expired-product-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,36 +83,10 @@ public function exportCsv()
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
{
|
||||
$incomeQuery = Income::with('category:id,categoryName', 'payment_type:id,name', 'branch:id,name', 'transactions')
|
||||
->where('business_id', auth()->user()->business_id);
|
||||
$income_reports = Income::with('category:id,categoryName', 'payment_type:id,name', 'branch:id,name', 'transactions')->where('business_id', auth()->user()->business_id)
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
// Branch filter
|
||||
if ($request->branch_id) {
|
||||
$incomeQuery->where('branch_id', $request->branch_id);
|
||||
}
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$this->applyDateFilter($incomeQuery, $duration, 'incomeDate', $request->from_date, $request->to_date);
|
||||
|
||||
// Search filter
|
||||
if ($request->filled('search')) {
|
||||
$search = $request->search;
|
||||
$incomeQuery->where(function ($query) use ($search) {
|
||||
$query->where('incomeFor', 'like', '%' . $search . '%')
|
||||
->orWhere('paymentType', 'like', '%' . $search . '%')
|
||||
->orWhere('amount', 'like', '%' . $search . '%')
|
||||
->orWhere('referenceNo', 'like', '%' . $search . '%')
|
||||
->orWhereHas('category', fn($q) => $q->where('categoryName', 'like', '%' . $search . '%'))
|
||||
->orWhereHas('payment_type', fn($q) => $q->where('name', 'like', '%' . $search . '%'))
|
||||
->orWhereHas('branch', fn($q) => $q->where('name', 'like', '%' . $search . '%'));
|
||||
});
|
||||
}
|
||||
|
||||
$income_reports = $incomeQuery->latest()->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::reports.income.pdf', compact('income_reports', 'duration', 'filter_from_date', 'filter_to_date'),'incomes-report.pdf');
|
||||
return PdfService::render('business::reports.income.pdf', compact('income_reports'),'incomes-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,14 +33,14 @@ public function lossProfitDetails()
|
||||
$query->where('business_id', $businessId);
|
||||
})
|
||||
->whereDate('created_at', '<', $today)
|
||||
->sum(DB::raw('"productPurchasePrice" * "productStock"'));
|
||||
->sum(DB::raw('productPurchasePrice * productStock'));
|
||||
|
||||
// Closing stock (up to today) from stocks table
|
||||
$closing_stock_by_purchase = Stock::whereHas('product', function ($query) use ($businessId) {
|
||||
$query->where('business_id', $businessId);
|
||||
})
|
||||
->whereDate('created_at', '<=', $today)
|
||||
->sum(DB::raw('"productPurchasePrice" * "productStock"'));
|
||||
->sum(DB::raw('productPurchasePrice * productStock'));
|
||||
|
||||
$total_purchase_price = (clone $purchaseQuery)->sum('totalAmount');
|
||||
$total_purchase_shipping_charge = (clone $purchaseQuery)->sum('shipping_charge');
|
||||
@@ -59,13 +59,13 @@ public function lossProfitDetails()
|
||||
$query->where('business_id', $businessId);
|
||||
})
|
||||
->whereDate('created_at', '<', $today)
|
||||
->sum(DB::raw('"productSalePrice" * "productStock"'));
|
||||
->sum(DB::raw('productSalePrice * productStock'));
|
||||
|
||||
$closing_stock_by_sale = Stock::whereHas('product', function ($query) use ($businessId) {
|
||||
$query->where('business_id', $businessId);
|
||||
})
|
||||
->whereDate('created_at', '<=', $today)
|
||||
->sum(DB::raw('"productSalePrice" * "productStock"'));
|
||||
->sum(DB::raw('productSalePrice * productStock'));
|
||||
|
||||
$total_sale_price = (clone $salesQuery)->sum('totalAmount');
|
||||
$total_sale_shipping_charge = (clone $salesQuery)->sum('shipping_charge');
|
||||
@@ -135,14 +135,14 @@ public function lossProfitFilter(Request $request)
|
||||
$q->where('business_id', $businessId);
|
||||
})
|
||||
->whereDate('created_at', '<', $startDate)
|
||||
->sum(DB::raw('"productPurchasePrice" * "productStock"'));
|
||||
->sum(DB::raw('productPurchasePrice * productStock'));
|
||||
|
||||
// Closing stock by purchase (up to end date)
|
||||
$closing_stock_by_purchase = Stock::whereHas('product', function ($q) use ($businessId) {
|
||||
$q->where('business_id', $businessId);
|
||||
})
|
||||
->whereDate('created_at', '<=', $endDate)
|
||||
->sum(DB::raw('"productPurchasePrice" * "productStock"'));
|
||||
->sum(DB::raw('productPurchasePrice * productStock'));
|
||||
|
||||
$total_purchase_price = (clone $purchaseQuery)->sum('totalAmount');
|
||||
$total_purchase_shipping_charge = (clone $purchaseQuery)->sum('shipping_charge');
|
||||
@@ -159,14 +159,14 @@ public function lossProfitFilter(Request $request)
|
||||
$q->where('business_id', $businessId);
|
||||
})
|
||||
->whereDate('created_at', '<', $startDate)
|
||||
->sum(DB::raw('"productSalePrice" * "productStock"'));
|
||||
->sum(DB::raw('productSalePrice * productStock'));
|
||||
|
||||
// Closing stock by sale
|
||||
$closing_stock_by_sale = Stock::whereHas('product', function ($q) use ($businessId) {
|
||||
$q->where('business_id', $businessId);
|
||||
})
|
||||
->whereDate('created_at', '<=', $endDate)
|
||||
->sum(DB::raw('"productSalePrice" * "productStock"'));
|
||||
->sum(DB::raw('productSalePrice * productStock'));
|
||||
|
||||
$total_sale_price = (clone $salesQuery)->sum('totalAmount');
|
||||
$total_sale_shipping_charge = (clone $salesQuery)->sum('shipping_charge');
|
||||
|
||||
@@ -7,19 +7,17 @@
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\PdfService;
|
||||
use App\Traits\DateRangeTrait;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Business\App\Exports\ExportLossProfitHistory;
|
||||
|
||||
class AcnooLossProfitHistoryController extends Controller
|
||||
{
|
||||
use DateFilterTrait, DateRangeTrait;
|
||||
use DateFilterTrait;
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
$businessId = $user->business_id;
|
||||
$perPage = request('per_page') ?? 20;
|
||||
|
||||
$branchId = null;
|
||||
if (moduleCheck('MultiBranchAddon')) {
|
||||
@@ -27,59 +25,42 @@ public function index(Request $request)
|
||||
}
|
||||
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$salesQuery = DB::table('sales')
|
||||
->select(
|
||||
DB::raw('"saleDate"::date as date'),
|
||||
DB::raw("
|
||||
CASE
|
||||
WHEN \"lossProfit\" >= 0 THEN 'positive'
|
||||
ELSE 'negative'
|
||||
END as profit_type
|
||||
"),
|
||||
DB::raw('DATE("saleDate") as date'),
|
||||
DB::raw('SUM(actual_total_amount) as total_sales'),
|
||||
DB::raw('SUM("lossProfit") as total_sale_income')
|
||||
)
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) =>
|
||||
$q->where('branch_id', $branchId)
|
||||
$q->where('branch_id', $branchId)
|
||||
)
|
||||
->groupBy(
|
||||
DB::raw('"saleDate"::date'),
|
||||
DB::raw("
|
||||
CASE
|
||||
WHEN \"lossProfit\" >= 0 THEN 'positive'
|
||||
ELSE 'negative'
|
||||
END
|
||||
")
|
||||
);
|
||||
->groupBy(DB::raw('DATE("saleDate")'));
|
||||
|
||||
$this->applyDateFilter($salesQuery, $duration, 'saleDate', $request->from_date, $request->to_date);
|
||||
|
||||
$dailySales = $salesQuery->limit($perPage)->get();
|
||||
$dailySales = $salesQuery->get();
|
||||
|
||||
$sale_datas = $dailySales->map(fn ($sale) => (object)[
|
||||
'type' => 'Sale',
|
||||
'date' => $sale->date,
|
||||
'profit_type' => $sale->profit_type,
|
||||
'total_sales' => $sale->total_sales,
|
||||
'total_incomes' => $sale->total_sale_income,
|
||||
]);
|
||||
|
||||
$incomeQuery = DB::table('incomes')
|
||||
->select(
|
||||
DB::raw('"incomeDate"::date as date'),
|
||||
DB::raw('DATE("incomeDate") as date'),
|
||||
DB::raw('SUM(amount) as total_incomes')
|
||||
)
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) =>
|
||||
$q->where('branch_id', $branchId)
|
||||
)
|
||||
->groupBy(DB::raw('"incomeDate"::date'));
|
||||
->groupBy(DB::raw('DATE("incomeDate")'));
|
||||
|
||||
$this->applyDateFilter($incomeQuery, $duration, 'incomeDate', $request->from_date, $request->to_date);
|
||||
$dailyIncomes = $incomeQuery->limit($perPage)->get();
|
||||
$dailyIncomes = $incomeQuery->get();
|
||||
|
||||
$income_datas = $dailyIncomes->map(fn ($income) => (object)[
|
||||
'type' => 'Income',
|
||||
@@ -99,10 +80,7 @@ public function index(Request $request)
|
||||
$mergedIncomeSaleData->push($income);
|
||||
}
|
||||
|
||||
// multiple sale rows handle
|
||||
$salesOfDate = $sale_datas->where('date', $date);
|
||||
|
||||
foreach ($salesOfDate as $sale) {
|
||||
if ($sale = $sale_datas->firstWhere('date', $date)) {
|
||||
$mergedIncomeSaleData->push($sale);
|
||||
}
|
||||
}
|
||||
@@ -112,32 +90,32 @@ public function index(Request $request)
|
||||
if (moduleCheck('HrmAddon')) {
|
||||
$payrollQuery = DB::table('payrolls')
|
||||
->select(
|
||||
DB::raw('"date"::date as date'),
|
||||
DB::raw('DATE("date") as date'),
|
||||
DB::raw('SUM(amount) as total_payrolls')
|
||||
)
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) =>
|
||||
$q->where('branch_id', $branchId)
|
||||
)
|
||||
->groupBy(DB::raw('"date"::date'));
|
||||
->groupBy(DB::raw('DATE("date")'));
|
||||
|
||||
$this->applyDateFilter($payrollQuery, $duration, 'date', $request->from_date, $request->to_date);
|
||||
$dailyPayrolls = $payrollQuery->limit($perPage)->get();
|
||||
$dailyPayrolls = $payrollQuery->get();
|
||||
}
|
||||
|
||||
$expenseQuery = DB::table('expenses')
|
||||
->select(
|
||||
DB::raw('"expenseDate"::date as date'),
|
||||
DB::raw('DATE("expenseDate") as date'),
|
||||
DB::raw('SUM(amount) as total_expenses_only')
|
||||
)
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) =>
|
||||
$q->where('branch_id', $branchId)
|
||||
)
|
||||
->groupBy(DB::raw('"expenseDate"::date'));
|
||||
->groupBy(DB::raw('DATE("expenseDate")'));
|
||||
|
||||
$this->applyDateFilter($expenseQuery, $duration, 'expenseDate', $request->from_date, $request->to_date);
|
||||
$dailyExpenses = $expenseQuery->limit($perPage)->get();
|
||||
$dailyExpenses = $expenseQuery->get();
|
||||
|
||||
$mergedExpenseData = collect();
|
||||
$allExpenseDates = $dailyExpenses->pluck('date')
|
||||
@@ -170,6 +148,34 @@ public function index(Request $request)
|
||||
$totalExpenses = $mergedExpenseData->sum('total_expenses');
|
||||
$netProfit = $grossIncomeProfit - $totalExpenses;
|
||||
|
||||
$allTimeSales = DB::table('sales')
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||
->sum('actual_total_amount');
|
||||
|
||||
$allTimeIncomes = DB::table('incomes')
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||
->sum('amount');
|
||||
|
||||
$allTimePayrolls = moduleCheck('HrmAddon')
|
||||
? DB::table('payrolls')
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||
->sum('amount')
|
||||
: 0;
|
||||
|
||||
$allTimeExpensesOnly = DB::table('expenses')
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||
->sum('amount');
|
||||
|
||||
$allTimeSaleProfit = DB::table('sales')->where('business_id', $businessId)->when($branchId, fn ($q) => $q->where('branch_id', $branchId))->sum('lossProfit');
|
||||
|
||||
$cardGrossProfit = $allTimeIncomes + $allTimeSaleProfit;
|
||||
$totalCardExpenses = $allTimePayrolls + $allTimeExpensesOnly;
|
||||
$cardNetProfit = $cardGrossProfit - $totalCardExpenses;
|
||||
|
||||
return view('business::loss-profit-histories.index', compact(
|
||||
'mergedIncomeSaleData',
|
||||
'mergedExpenseData',
|
||||
@@ -177,9 +183,9 @@ public function index(Request $request)
|
||||
'grossIncomeProfit',
|
||||
'totalExpenses',
|
||||
'netProfit',
|
||||
'duration',
|
||||
'filter_from_date',
|
||||
'filter_to_date'
|
||||
'cardGrossProfit',
|
||||
'totalCardExpenses',
|
||||
'cardNetProfit'
|
||||
));
|
||||
}
|
||||
|
||||
@@ -193,158 +199,111 @@ public function exportCsv()
|
||||
return Excel::download(new ExportLossProfitHistory, 'loss-profit-history.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$user = auth()->user();
|
||||
$businessId = $user->business_id;
|
||||
$perPage = request('per_page') ?? 20;
|
||||
|
||||
$branchId = null;
|
||||
if (moduleCheck('MultiBranchAddon')) {
|
||||
$branchId = $user->branch_id ?? $user->active_branch_id;
|
||||
}
|
||||
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$salesQuery = DB::table('sales')
|
||||
// SALES
|
||||
$dailySales = DB::table('sales')
|
||||
->select(
|
||||
DB::raw('"saleDate"::date as date'),
|
||||
DB::raw("
|
||||
CASE
|
||||
WHEN \"lossProfit\" >= 0 THEN 'positive'
|
||||
ELSE 'negative'
|
||||
END as profit_type
|
||||
"),
|
||||
DB::raw('DATE("saleDate") as date'),
|
||||
DB::raw('SUM(actual_total_amount) as total_sales'),
|
||||
DB::raw('SUM("lossProfit") as total_sale_income')
|
||||
)
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) =>
|
||||
$q->where('branch_id', $branchId)
|
||||
)
|
||||
->groupBy(
|
||||
DB::raw('"saleDate"::date'),
|
||||
DB::raw("
|
||||
CASE
|
||||
WHEN \"lossProfit\" >= 0 THEN 'positive'
|
||||
ELSE 'negative'
|
||||
END
|
||||
")
|
||||
);
|
||||
|
||||
$this->applyDateFilter($salesQuery, $duration, 'saleDate', $request->from_date, $request->to_date);
|
||||
|
||||
$dailySales = $salesQuery->limit($perPage)->get();
|
||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||
->groupBy(DB::raw('DATE(saleDate)'))
|
||||
->get();
|
||||
|
||||
$sale_datas = $dailySales->map(fn ($sale) => (object)[
|
||||
'type' => 'Sale',
|
||||
'date' => $sale->date,
|
||||
'profit_type' => $sale->profit_type,
|
||||
'total_sales' => $sale->total_sales,
|
||||
'total_incomes' => $sale->total_sale_income,
|
||||
'type' => 'Sale',
|
||||
'date' => $sale->date,
|
||||
'total_sales' => $sale->total_sales,
|
||||
'total_incomes' => $sale->total_sale_income,
|
||||
]);
|
||||
|
||||
$incomeQuery = DB::table('incomes')
|
||||
// INCOME
|
||||
$dailyIncomes = DB::table('incomes')
|
||||
->select(
|
||||
DB::raw('"incomeDate"::date as date'),
|
||||
DB::raw('DATE("incomeDate") as date'),
|
||||
DB::raw('SUM(amount) as total_incomes')
|
||||
)
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) =>
|
||||
$q->where('branch_id', $branchId)
|
||||
)
|
||||
->groupBy(DB::raw('"incomeDate"::date'));
|
||||
|
||||
$this->applyDateFilter($incomeQuery, $duration, 'incomeDate', $request->from_date, $request->to_date);
|
||||
$dailyIncomes = $incomeQuery->limit($perPage)->get();
|
||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||
->groupBy(DB::raw('DATE(incomeDate)'))
|
||||
->get();
|
||||
|
||||
$income_datas = $dailyIncomes->map(fn ($income) => (object)[
|
||||
'type' => 'Income',
|
||||
'date' => $income->date,
|
||||
'type' => 'Income',
|
||||
'date' => $income->date,
|
||||
'total_incomes' => $income->total_incomes,
|
||||
]);
|
||||
|
||||
// MERGE SALE + INCOME
|
||||
$mergedIncomeSaleData = collect();
|
||||
$allDates = $dailySales->pluck('date')
|
||||
->merge($dailyIncomes->pluck('date'))
|
||||
->unique()
|
||||
->sort();
|
||||
|
||||
$allDates = $dailySales->pluck('date')->merge($dailyIncomes->pluck('date'))->unique()->sort();
|
||||
foreach ($allDates as $date) {
|
||||
|
||||
if ($income = $income_datas->firstWhere('date', $date)) {
|
||||
$mergedIncomeSaleData->push($income);
|
||||
}
|
||||
|
||||
// multiple sale rows handle
|
||||
$salesOfDate = $sale_datas->where('date', $date);
|
||||
|
||||
foreach ($salesOfDate as $sale) {
|
||||
if ($sale = $sale_datas->firstWhere('date', $date)) {
|
||||
$mergedIncomeSaleData->push($sale);
|
||||
}
|
||||
}
|
||||
|
||||
// PAYROLL
|
||||
$dailyPayrolls = collect();
|
||||
|
||||
if (moduleCheck('HrmAddon')) {
|
||||
$payrollQuery = DB::table('payrolls')
|
||||
$dailyPayrolls = DB::table('payrolls')
|
||||
->select(
|
||||
DB::raw('"date"::date as date'),
|
||||
DB::raw('DATE("date") as date'),
|
||||
DB::raw('SUM(amount) as total_payrolls')
|
||||
)
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) =>
|
||||
$q->where('branch_id', $branchId)
|
||||
)
|
||||
->groupBy(DB::raw('"date"::date'));
|
||||
|
||||
$this->applyDateFilter($payrollQuery, $duration, 'date', $request->from_date, $request->to_date);
|
||||
$dailyPayrolls = $payrollQuery->limit($perPage)->get();
|
||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||
->groupBy(DB::raw('DATE(date)'))
|
||||
->get();
|
||||
}
|
||||
|
||||
$expenseQuery = DB::table('expenses')
|
||||
// EXPENSES
|
||||
$dailyExpenses = DB::table('expenses')
|
||||
->select(
|
||||
DB::raw('"expenseDate"::date as date'),
|
||||
DB::raw('DATE("expenseDate") as date'),
|
||||
DB::raw('SUM(amount) as total_expenses_only')
|
||||
)
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) =>
|
||||
$q->where('branch_id', $branchId)
|
||||
)
|
||||
->groupBy(DB::raw('"expenseDate"::date'));
|
||||
|
||||
$this->applyDateFilter($expenseQuery, $duration, 'expenseDate', $request->from_date, $request->to_date);
|
||||
$dailyExpenses = $expenseQuery->limit($perPage)->get();
|
||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||
->groupBy(DB::raw('DATE(expenseDate)'))
|
||||
->get();
|
||||
|
||||
$mergedExpenseData = collect();
|
||||
$allExpenseDates = $dailyExpenses->pluck('date')
|
||||
->merge($dailyPayrolls->pluck('date'))
|
||||
->unique()
|
||||
->sort();
|
||||
|
||||
$allExpenseDates = $dailyExpenses->pluck('date')->merge($dailyPayrolls->pluck('date'))->unique()->sort();
|
||||
foreach ($allExpenseDates as $date) {
|
||||
|
||||
if ($expense = $dailyExpenses->firstWhere('date', $date)) {
|
||||
$mergedExpenseData->push((object)[
|
||||
'type' => 'Expense',
|
||||
'date' => $date,
|
||||
'type' => 'Expense',
|
||||
'date' => $date,
|
||||
'total_expenses' => $expense->total_expenses_only,
|
||||
]);
|
||||
}
|
||||
|
||||
if ($payroll = $dailyPayrolls->firstWhere('date', $date)) {
|
||||
$mergedExpenseData->push((object)[
|
||||
'type' => 'Payroll',
|
||||
'date' => $date,
|
||||
'type' => 'Payroll',
|
||||
'date' => $date,
|
||||
'total_expenses' => $payroll->total_payrolls,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// SUMMARY
|
||||
$grossSaleProfit = $sale_datas->sum('total_sales');
|
||||
$grossIncomeProfit = $income_datas->sum('total_incomes') + $sale_datas->sum('total_incomes');
|
||||
|
||||
$totalExpenses = $mergedExpenseData->sum('total_expenses');
|
||||
$netProfit = $grossIncomeProfit - $totalExpenses;
|
||||
|
||||
@@ -357,10 +316,7 @@ public function exportPdf(Request $request)
|
||||
'grossSaleProfit',
|
||||
'grossIncomeProfit',
|
||||
'totalExpenses',
|
||||
'netProfit',
|
||||
'duration',
|
||||
'filter_to_date',
|
||||
'filter_from_date'
|
||||
'netProfit'
|
||||
),
|
||||
'loss-profit-history.pdf'
|
||||
);
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
use App\Traits\DateFilterTrait;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Traits\DateRangeTrait;
|
||||
|
||||
class AcnooLossProfitHistoryReportController extends Controller
|
||||
{
|
||||
use DateFilterTrait, DateRangeTrait;
|
||||
use DateFilterTrait;
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
@@ -23,56 +22,39 @@ public function index(Request $request)
|
||||
}
|
||||
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$salesQuery = DB::table('sales')
|
||||
->select(
|
||||
DB::raw('"saleDate"::date as date'),
|
||||
DB::raw("
|
||||
CASE
|
||||
WHEN \"lossProfit\" >= 0 THEN 'positive'
|
||||
ELSE 'negative'
|
||||
END as profit_type
|
||||
"),
|
||||
DB::raw('DATE("saleDate") as date'),
|
||||
DB::raw('SUM(actual_total_amount) as total_sales'),
|
||||
DB::raw('SUM("lossProfit") as total_sale_income')
|
||||
)
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) =>
|
||||
$q->where('branch_id', $branchId)
|
||||
$q->where('branch_id', $branchId)
|
||||
)
|
||||
->groupBy(
|
||||
DB::raw('"saleDate"::date'),
|
||||
DB::raw("
|
||||
CASE
|
||||
WHEN \"lossProfit\" >= 0 THEN 'positive'
|
||||
ELSE 'negative'
|
||||
END
|
||||
")
|
||||
);
|
||||
->groupBy(DB::raw('DATE("saleDate")'));
|
||||
|
||||
$this->applyDateFilter($salesQuery, $duration, 'saleDate', $request->from_date, $request->to_date);
|
||||
|
||||
$dailySales = $salesQuery->get();
|
||||
|
||||
$sale_datas = $dailySales->map(fn ($sale) => (object)[
|
||||
'type' => 'Sale',
|
||||
'date' => $sale->date,
|
||||
'profit_type' => $sale->profit_type,
|
||||
'total_sales' => $sale->total_sales,
|
||||
'total_incomes' => $sale->total_sale_income,
|
||||
]);
|
||||
|
||||
$incomeQuery = DB::table('incomes')
|
||||
->select(
|
||||
DB::raw('"incomeDate"::date as date'),
|
||||
DB::raw('DATE("incomeDate") as date'),
|
||||
DB::raw('SUM(amount) as total_incomes')
|
||||
)
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) =>
|
||||
$q->where('branch_id', $branchId)
|
||||
)
|
||||
->groupBy(DB::raw('"incomeDate"::date'));
|
||||
->groupBy(DB::raw('DATE("incomeDate")'));
|
||||
|
||||
$this->applyDateFilter($incomeQuery, $duration, 'incomeDate', $request->from_date, $request->to_date);
|
||||
$dailyIncomes = $incomeQuery->get();
|
||||
@@ -95,10 +77,7 @@ public function index(Request $request)
|
||||
$mergedIncomeSaleData->push($income);
|
||||
}
|
||||
|
||||
// multiple sale rows handle
|
||||
$salesOfDate = $sale_datas->where('date', $date);
|
||||
|
||||
foreach ($salesOfDate as $sale) {
|
||||
if ($sale = $sale_datas->firstWhere('date', $date)) {
|
||||
$mergedIncomeSaleData->push($sale);
|
||||
}
|
||||
}
|
||||
@@ -108,14 +87,14 @@ public function index(Request $request)
|
||||
if (moduleCheck('HrmAddon')) {
|
||||
$payrollQuery = DB::table('payrolls')
|
||||
->select(
|
||||
DB::raw('"date"::date as date'),
|
||||
DB::raw('DATE("date") as date'),
|
||||
DB::raw('SUM(amount) as total_payrolls')
|
||||
)
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) =>
|
||||
$q->where('branch_id', $branchId)
|
||||
)
|
||||
->groupBy(DB::raw('"date"::date'));
|
||||
->groupBy(DB::raw('DATE("date")'));
|
||||
|
||||
$this->applyDateFilter($payrollQuery, $duration, 'date', $request->from_date, $request->to_date);
|
||||
$dailyPayrolls = $payrollQuery->get();
|
||||
@@ -123,14 +102,14 @@ public function index(Request $request)
|
||||
|
||||
$expenseQuery = DB::table('expenses')
|
||||
->select(
|
||||
DB::raw('"expenseDate"::date as date'),
|
||||
DB::raw('DATE("expenseDate") as date'),
|
||||
DB::raw('SUM(amount) as total_expenses_only')
|
||||
)
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) =>
|
||||
$q->where('branch_id', $branchId)
|
||||
)
|
||||
->groupBy(DB::raw('"expenseDate"::date'));
|
||||
->groupBy(DB::raw('DATE("expenseDate")'));
|
||||
|
||||
$this->applyDateFilter($expenseQuery, $duration, 'expenseDate', $request->from_date, $request->to_date);
|
||||
$dailyExpenses = $expenseQuery->get();
|
||||
@@ -166,6 +145,34 @@ public function index(Request $request)
|
||||
$totalExpenses = $mergedExpenseData->sum('total_expenses');
|
||||
$netProfit = $grossIncomeProfit - $totalExpenses;
|
||||
|
||||
$allTimeSales = DB::table('sales')
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||
->sum('actual_total_amount');
|
||||
|
||||
$allTimeIncomes = DB::table('incomes')
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||
->sum('amount');
|
||||
|
||||
$allTimePayrolls = moduleCheck('HrmAddon')
|
||||
? DB::table('payrolls')
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||
->sum('amount')
|
||||
: 0;
|
||||
|
||||
$allTimeExpensesOnly = DB::table('expenses')
|
||||
->where('business_id', $businessId)
|
||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||
->sum('amount');
|
||||
|
||||
$allTimeSaleProfit = DB::table('sales')->where('business_id', $businessId)->when($branchId, fn ($q) => $q->where('branch_id', $branchId))->sum('lossProfit');
|
||||
|
||||
$cardGrossProfit = $allTimeIncomes + $allTimeSaleProfit;
|
||||
$totalCardExpenses = $allTimePayrolls + $allTimeExpensesOnly;
|
||||
$cardNetProfit = $cardGrossProfit - $totalCardExpenses;
|
||||
|
||||
return view('business::loss-profit-histories.index', compact(
|
||||
'mergedIncomeSaleData',
|
||||
'mergedExpenseData',
|
||||
@@ -173,9 +180,9 @@ public function index(Request $request)
|
||||
'grossIncomeProfit',
|
||||
'totalExpenses',
|
||||
'netProfit',
|
||||
'duration',
|
||||
'filter_from_date',
|
||||
'filter_to_date'
|
||||
'cardGrossProfit',
|
||||
'totalCardExpenses',
|
||||
'cardNetProfit'
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Party;
|
||||
use App\Models\Sale;
|
||||
use App\Services\PdfService;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Business\App\Exports\ExportPartyLossProfit;
|
||||
@@ -13,6 +14,12 @@ class AcnooPartyLossProfitController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$sale = Sale::where('business_id', auth()->user()->business_id)->whereNotNull('party_id')->get();
|
||||
|
||||
$totalAmount = $sale->sum('totalAmount');
|
||||
$totalProfit = $sale->where('lossProfit', '>', 0)->sum('lossProfit') ?? 0;
|
||||
$totalLoss = $sale->where('lossProfit', '<', 0)->sum('lossProfit') ?? 0;
|
||||
|
||||
$parties = Party::with('sales')
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->where('type', '!=', 'Supplier')
|
||||
@@ -25,20 +32,13 @@ public function index(Request $request)
|
||||
->paginate($request->per_page ?? 20)
|
||||
->appends($request->query());
|
||||
|
||||
$totalSaleAmount = $parties->sum(fn($party) => $party->sales?->sum('totalAmount') ?? 0);
|
||||
$totalProfit = $parties->sum(fn($party) => $party->sales?->where('lossProfit', '>', 0)->sum('lossProfit') ?? 0);
|
||||
$totalLoss = $parties->sum(fn($party) => $party->sales?->where('lossProfit', '<', 0)->sum('lossProfit') ?? 0);
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
'data' => view('business::party-reports.loss-profit.datas', compact('parties', 'totalSaleAmount', 'totalProfit', 'totalLoss'))->render(),
|
||||
'totalSaleAmount' => currency_format($totalSaleAmount, currency: business_currency()),
|
||||
'totalProfit' => currency_format($totalProfit, currency: business_currency()),
|
||||
'totalLoss' => currency_format($totalLoss, currency: business_currency()),
|
||||
'data' => view('business::party-reports.loss-profit.datas', compact('parties'))->render()
|
||||
]);
|
||||
}
|
||||
|
||||
return view('business::party-reports.loss-profit.index', compact('parties', 'totalSaleAmount', 'totalProfit', 'totalLoss'));
|
||||
return view('business::party-reports.loss-profit.index', compact('parties', 'totalAmount', 'totalProfit', 'totalLoss'));
|
||||
}
|
||||
|
||||
public function exportExcel()
|
||||
@@ -51,24 +51,18 @@ public function exportCsv()
|
||||
return Excel::download(new ExportPartyLossProfit, 'party-loss-profit.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$parties = Party::with('sales')
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->where('type', '!=', 'Supplier')
|
||||
->when($request->search, function ($query) use ($request) {
|
||||
$query->where(function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
})
|
||||
->latest()
|
||||
->limit($request->per_page ?? 20)
|
||||
->get();
|
||||
|
||||
return PdfService::render('business::party-reports.loss-profit.pdf', compact('parties'),'party-loss-profit-report.pdf');
|
||||
}
|
||||
|
||||
public function view(string $id)
|
||||
public function view($id)
|
||||
{
|
||||
$party = Party::with('sales.details', 'sales.details.product')
|
||||
->where('id', $id)
|
||||
|
||||
@@ -45,8 +45,8 @@ public function index(Request $request)
|
||||
->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)
|
||||
@@ -93,8 +93,8 @@ public function exportPdf()
|
||||
})
|
||||
->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')
|
||||
->get();
|
||||
|
||||
@@ -51,7 +51,7 @@ public function index(Request $request)
|
||||
return view('business::product-purchase-history-report.index', compact('products', 'total_purchase_qty', 'total_sale_qty', 'filter_from_date', 'filter_to_date', 'duration'));
|
||||
}
|
||||
|
||||
public function show(Request $request, string $id)
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
@@ -65,7 +65,7 @@ public function show(Request $request, string $id)
|
||||
->whereHas('purchase', function ($purchase) use ($duration, $request) {
|
||||
$this->applyDateFilter($purchase, $duration, 'purchaseDate', $request->from_date, $request->to_date);
|
||||
})
|
||||
->with('purchase:id,party_id,invoiceNumber,purchaseDate', 'purchase.party:id,name')
|
||||
->with('purchase:id,invoiceNumber,purchaseDate')
|
||||
->select('id', 'purchase_id', 'product_id', 'quantities', 'productPurchasePrice');
|
||||
|
||||
$purchaseDetailsQuery->when(filled($request->search), function ($q) use ($request) {
|
||||
@@ -76,9 +76,6 @@ public function show(Request $request, string $id)
|
||||
->orWhereHas('purchase', function ($q) use ($search) {
|
||||
$q->where('invoiceNumber', 'like', "%{$search}%")
|
||||
->orWhere('purchaseDate', 'like', "%{$search}%");
|
||||
})
|
||||
->orWhereHas('purchase.party', function ($q) use ($search) {
|
||||
$q->where('name', 'like', "%{$search}%");
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -92,7 +89,8 @@ public function show(Request $request, string $id)
|
||||
]);
|
||||
}
|
||||
|
||||
return view('business::product-purchase-history-report.details',
|
||||
return view(
|
||||
'business::product-purchase-history-report.details',
|
||||
compact('product', 'purchaseDetails', 'filter_from_date', 'filter_to_date', 'duration')
|
||||
);
|
||||
}
|
||||
@@ -110,20 +108,9 @@ public function exportCsv()
|
||||
public function exportPdf(Request $request)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$productQuery = Product::with(['saleDetails', 'purchaseDetails', 'purchaseDetails.purchase', 'stocks', 'combo_products'])
|
||||
->where('business_id', $businessId)
|
||||
->whereHas('purchaseDetails.purchase', function ($purchase) use ($duration, $request) {
|
||||
$this->applyDateFilter($purchase, $duration, 'purchaseDate', $request->from_date, $request->to_date);
|
||||
});
|
||||
|
||||
$productQuery->when($request->search, function ($q) use ($request) {
|
||||
$q->where('productName', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
|
||||
$products = $productQuery->limit($request->per_page ?? 20)->get();
|
||||
$productQuery = Product::with('saleDetails', 'purchaseDetails', 'stocks', 'combo_products')->where('business_id', $businessId);
|
||||
$products = $productQuery->get();
|
||||
|
||||
$total_purchase_qty = $products->sum(function ($product) {
|
||||
return $product->purchaseDetails->sum('quantities');
|
||||
@@ -133,54 +120,31 @@ public function exportPdf(Request $request)
|
||||
return $product->saleDetails->sum('quantities');
|
||||
});
|
||||
|
||||
return PdfService::render('business::product-purchase-history-report.pdf', compact('products', 'total_purchase_qty', 'total_sale_qty', 'duration', 'filter_from_date', 'filter_to_date'), 'product-purchase-history.pdf');
|
||||
return PdfService::render('business::product-purchase-history-report.pdf', compact('products', 'total_purchase_qty', 'total_sale_qty'), 'product-purchase-history.pdf');
|
||||
}
|
||||
|
||||
public function exportDetailExcel(string $id)
|
||||
public function exportDetailExcel($id)
|
||||
{
|
||||
return Excel::download(new ExportProductPurchaseHistoryDetailReport($id), 'product-purchase-history-details.xlsx');
|
||||
}
|
||||
|
||||
public function exportDetailCsv(string $id)
|
||||
public function exportDetailCsv($id)
|
||||
{
|
||||
return Excel::download(new ExportProductPurchaseHistoryDetailReport($id), 'product-purchase-history-details.csv');
|
||||
}
|
||||
|
||||
public function exportDetailPdf(Request $request, string $id)
|
||||
public function exportDetailPdf(Request $request, $id)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$product = Product::select('id', 'business_id', 'productName')
|
||||
->where('business_id', $businessId)
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->findOrFail($id);
|
||||
|
||||
$purchaseDetailsQuery = $product->purchaseDetails()
|
||||
->whereHas('purchase', function ($purchase) use ($duration, $request) {
|
||||
$this->applyDateFilter($purchase, $duration, 'purchaseDate', $request->from_date, $request->to_date);
|
||||
})
|
||||
->with('purchase:id,party_id,invoiceNumber,purchaseDate', 'purchase.party:id,name')
|
||||
->with('purchase:id,invoiceNumber,purchaseDate')
|
||||
->select('id', 'purchase_id', 'product_id', 'quantities', 'productPurchasePrice');
|
||||
|
||||
$purchaseDetailsQuery->when(filled($request->search), function ($q) use ($request) {
|
||||
$search = $request->search;
|
||||
$q->where(function ($q) use ($search) {
|
||||
$q->where('productPurchasePrice', 'like', "%{$search}%")
|
||||
->orWhere('quantities', 'like', "%{$search}%")
|
||||
->orWhereHas('purchase', function ($q) use ($search) {
|
||||
$q->where('invoiceNumber', 'like', "%{$search}%")
|
||||
->orWhere('purchaseDate', 'like', "%{$search}%");
|
||||
})
|
||||
->orWhereHas('purchase.party', function ($q) use ($search) {
|
||||
$q->where('name', 'like', "%{$search}%");
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
$purchaseDetails = $purchaseDetailsQuery->get();
|
||||
|
||||
$purchaseDetails = $purchaseDetailsQuery->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::product-purchase-history-report.pdf-detail', compact('product', 'purchaseDetails', 'duration', 'filter_from_date', 'filter_to_date'), 'product-purchase-history-details.pdf');
|
||||
return PdfService::render('business::product-purchase-history-report.pdf-detail', compact('product', 'purchaseDetails'), 'product-purchase-history-details.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,19 @@ public function index(Request $request)
|
||||
$q->where('business_id', auth()->user()->business_id);
|
||||
});
|
||||
|
||||
$query->when(request('search'), function ($q) use ($request) {
|
||||
$q->whereHas('product', function ($q) use ($request) {
|
||||
$q->where('productName', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('purchase', function ($q) use ($request) {
|
||||
$q->where('invoiceNumber', 'like', '%' . $request->search . '%')
|
||||
->orWhere('purchaseDate', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('purchase.party', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
@@ -30,21 +43,6 @@ public function index(Request $request)
|
||||
$this->applyDateFilter($q, $duration, 'purchaseDate', $request->from_date, $request->to_date);
|
||||
});
|
||||
|
||||
$query->when(request('search'), function ($q) use ($request) {
|
||||
$q->where(function ($q) use ($request) {
|
||||
$q->whereHas('product', function ($q) use ($request) {
|
||||
$q->where('productName', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('purchase', function ($q) use ($request) {
|
||||
$q->where('invoiceNumber', 'like', '%' . $request->search . '%')
|
||||
->orWhere('purchaseDate', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('purchase.party', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$product_purchases = $query->paginate($request->per_page ?? 20)->appends($request->query());
|
||||
|
||||
if ($request->ajax()) {
|
||||
@@ -66,38 +64,14 @@ public function exportCsv()
|
||||
return Excel::download(new ExportProductPurchaseReport, 'product-purchase.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$query = PurchaseDetails::with('product:id,productName', 'purchase:id,party_id,invoiceNumber,purchaseDate', 'purchase.party:id,name')
|
||||
$product_purchases = PurchaseDetails::with('product:id,productName', 'purchase:id,party_id,invoiceNumber,purchaseDate', 'purchase.party:id,name')
|
||||
->whereHas('purchase', function ($q) {
|
||||
$q->where('business_id', auth()->user()->business_id);
|
||||
});
|
||||
})
|
||||
->get();
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$query->whereHas('purchase', function ($q) use ($duration, $request) {
|
||||
$this->applyDateFilter($q, $duration, 'purchaseDate', $request->from_date, $request->to_date);
|
||||
});
|
||||
|
||||
$query->when(request('search'), function ($q) use ($request) {
|
||||
$q->where(function ($q) use ($request) {
|
||||
$q->whereHas('product', function ($q) use ($request) {
|
||||
$q->where('productName', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('purchase', function ($q) use ($request) {
|
||||
$q->where('invoiceNumber', 'like', '%' . $request->search . '%')
|
||||
->orWhere('purchaseDate', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('purchase.party', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$product_purchases = $query->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::reports.product-purchase.pdf', compact('product_purchases', 'duration', 'filter_from_date', 'filter_to_date'), 'product-purchase-report.pdf');
|
||||
return PdfService::render('business::reports.product-purchase.pdf', compact('product_purchases'),'product-purchase-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public function index(Request $request)
|
||||
return view('business::product-sale-history-report.index', compact('products', 'total_purchase_qty', 'total_sale_qty', 'total_sale_price', 'filter_from_date', 'filter_to_date', 'duration'));
|
||||
}
|
||||
|
||||
public function show(Request $request, string $id)
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
@@ -82,9 +82,6 @@ public function show(Request $request, string $id)
|
||||
->orWhereHas('sale', function ($q) use ($search) {
|
||||
$q->where('invoiceNumber', 'like', "%{$search}%")
|
||||
->orWhere('saleDate', 'like', "%{$search}%");
|
||||
})
|
||||
->orWhereHas('sale.party', function ($q) use ($search) {
|
||||
$q->where('name', 'like', "%{$search}%");
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -114,20 +111,9 @@ public function exportCsv()
|
||||
public function exportPdf(Request $request)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$productQuery = Product::with(['saleDetails', 'purchaseDetails', 'saleDetails.sale', 'stocks', 'combo_products'])
|
||||
->where('business_id', $businessId)
|
||||
->whereHas('saleDetails.sale', function ($sale) use ($duration, $request) {
|
||||
$this->applyDateFilter($sale, $duration, 'saleDate', $request->from_date, $request->to_date);
|
||||
});
|
||||
|
||||
$productQuery->when($request->search, function ($q) use ($request) {
|
||||
$q->where('productName', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
|
||||
$products = $productQuery->limit($request->per_page ?? 20)->get();
|
||||
$productQuery = Product::with('saleDetails', 'purchaseDetails', 'stocks', 'combo_products')->where('business_id', $businessId);
|
||||
$products = $productQuery->get();
|
||||
|
||||
$total_single_sale_price = $products->sum(function ($product) {
|
||||
return $product->saleDetails->sum('price');
|
||||
@@ -143,54 +129,31 @@ public function exportPdf(Request $request)
|
||||
return $product->saleDetails->sum('quantities');
|
||||
});
|
||||
|
||||
return PdfService::render('business::product-sale-history-report.pdf', compact('products', 'total_purchase_qty', 'total_sale_qty', 'total_sale_price', 'filter_from_date', 'filter_to_date', 'duration'), 'product-sale-history.pdf');
|
||||
return PdfService::render('business::product-sale-history-report.pdf', compact('products', 'total_purchase_qty', 'total_sale_qty', 'total_sale_price'), 'product-sale-history.pdf');
|
||||
}
|
||||
|
||||
public function exportDetailExcel(string $id)
|
||||
public function exportDetailExcel($id)
|
||||
{
|
||||
return Excel::download(new ExportProductSaleHistoryDetailReport($id), 'product-sale-history-details.xlsx');
|
||||
}
|
||||
|
||||
public function exportDetailCsv(string $id)
|
||||
public function exportDetailCsv($id)
|
||||
{
|
||||
return Excel::download(new ExportProductSaleHistoryDetailReport($id), 'product-sale-history-details.csv');
|
||||
}
|
||||
|
||||
public function exportDetailPdf(Request $request, string $id)
|
||||
public function exportDetailPdf(Request $request, $id)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$product = Product::select('id', 'business_id', 'productName')
|
||||
->where('business_id', $businessId)
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->findOrFail($id);
|
||||
|
||||
$saleDetailsQuery = $product->saleDetails()
|
||||
->whereHas('sale', function ($sale) use ($duration, $request) {
|
||||
$this->applyDateFilter($sale, $duration, 'saleDate', $request->from_date, $request->to_date);
|
||||
})
|
||||
->with('sale:id,party_id,invoiceNumber,saleDate', 'sale.party:id,name')
|
||||
->select('id', 'sale_id', 'product_id', 'quantities', 'lossprofit', 'price', 'productPurchasePrice');
|
||||
|
||||
$saleDetailsQuery->when(filled($request->search), function ($q) use ($request) {
|
||||
$search = $request->search;
|
||||
$q->where(function ($q) use ($search) {
|
||||
$q->where('price', 'like', "%{$search}%")
|
||||
->orWhere('quantities', 'like', "%{$search}%")
|
||||
->orWhereHas('sale', function ($q) use ($search) {
|
||||
$q->where('invoiceNumber', 'like', "%{$search}%")
|
||||
->orWhere('saleDate', 'like', "%{$search}%");
|
||||
})
|
||||
->orWhereHas('sale.party', function ($q) use ($search) {
|
||||
$q->where('name', 'like', "%{$search}%");
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
$saleDetails = $saleDetailsQuery->get();
|
||||
|
||||
$saleDetails = $saleDetailsQuery->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::product-sale-history-report.pdf-detail', compact('product', 'saleDetails', 'duration', 'filter_from_date', 'filter_to_date'), 'product-sale-history-details.pdf');
|
||||
return PdfService::render('business::product-sale-history-report.pdf-detail', compact('product', 'saleDetails'), 'product-sale-history-details.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Modules\Business\App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\SaleDetails;
|
||||
use App\Models\Sale;
|
||||
use App\Services\PdfService;
|
||||
use App\Traits\DateFilterTrait;
|
||||
use App\Traits\DateRangeTrait;
|
||||
@@ -17,34 +17,26 @@ class AcnooProductSaleReportController extends Controller
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = SaleDetails::with('product:id,productName', 'sale:id,party_id,invoiceNumber,saleDate', 'sale.party:id,name')
|
||||
->whereHas('sale', function ($q) {
|
||||
$q->where('business_id', auth()->user()->business_id);
|
||||
});
|
||||
$query = Sale::with('details:id,sale_id,product_id,quantities,price', 'details.product:id,productName', 'party:id,name')
|
||||
->where('business_id', auth()->user()->business_id);
|
||||
|
||||
$query->when(request('search'), function ($q) use ($request) {
|
||||
$q->where(function ($q) use ($request) {
|
||||
$q->where('invoiceNumber', 'like', '%' . $request->search . '%')
|
||||
->orWhere('saleDate', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('details.product', function ($q) use ($request) {
|
||||
$q->where('productName', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('party', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$query->whereHas('sale', function ($q) use ($duration, $request) {
|
||||
$this->applyDateFilter($q, $duration, 'saleDate', $request->from_date, $request->to_date);
|
||||
});
|
||||
|
||||
// Search Filter
|
||||
$query->when(request('search'), function ($q) use ($request) {
|
||||
$q->where(function ($q) use ($request) {
|
||||
$q->whereHas('product', function ($q) use ($request) {
|
||||
$q->where('productName', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('sale', function ($q) use ($request) {
|
||||
$q->where('invoiceNumber', 'like', '%' . $request->search . '%')
|
||||
->orWhere('saleDate', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('sale.party', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
});
|
||||
$this->applyDateFilter($query, $duration, 'saleDate', $request->from_date, $request->to_date);
|
||||
|
||||
$product_sales = $query->paginate($request->per_page ?? 20)->appends($request->query());
|
||||
|
||||
@@ -67,39 +59,13 @@ public function exportCsv()
|
||||
return Excel::download(new ExportProductSaleReport, 'product-sales.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$query = SaleDetails::with('product:id,productName', 'sale:id,party_id,invoiceNumber,saleDate', 'sale.party:id,name')
|
||||
->whereHas('sale', function ($q) {
|
||||
$q->where('business_id', auth()->user()->business_id);
|
||||
});
|
||||
$product_sales = Sale::with('details:id,sale_id,product_id,quantities,price', 'details.product:id,productName', 'party:id,name')
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$query->whereHas('sale', function ($q) use ($duration, $request) {
|
||||
$this->applyDateFilter($q, $duration, 'saleDate', $request->from_date, $request->to_date);
|
||||
});
|
||||
|
||||
// Search Filter
|
||||
$query->when(request('search'), function ($q) use ($request) {
|
||||
$q->where(function ($q) use ($request) {
|
||||
$q->whereHas('product', function ($q) use ($request) {
|
||||
$q->where('productName', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('sale', function ($q) use ($request) {
|
||||
$q->where('invoiceNumber', 'like', '%' . $request->search . '%')
|
||||
->orWhere('saleDate', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('sale.party', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$product_sales = $query->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::reports.product-sale.pdf', compact('product_sales', 'duration', 'filter_from_date', 'filter_to_date'), 'product-sale-report.pdf');
|
||||
return PdfService::render('business::reports.product-sale.pdf', compact('product_sales'),'product-sale-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,10 @@ public function index(Request $request)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
|
||||
$total_purchase = Purchase::where('business_id', $businessId)
|
||||
->whereDate('purchaseDate', Carbon::today())
|
||||
->sum('totalAmount');
|
||||
|
||||
$purchasesQuery = Purchase::with('user:id,name', 'party:id,name,email,phone,type', 'payment_type:id,name', 'branch:id,name', 'transactions')
|
||||
->where('business_id', $businessId);
|
||||
|
||||
@@ -85,38 +89,11 @@ public function exportCsv()
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
{
|
||||
$purchasesQuery = Purchase::with('user:id,name', 'party:id,name,email,phone,type', 'payment_type:id,name', 'branch:id,name', 'transactions')
|
||||
->where('business_id', auth()->user()->business_id);
|
||||
$purchases = Purchase::with('user:id,name', 'party:id,name,email,phone,type', 'payment_type:id,name', 'branch:id,name', 'transactions')
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
$purchasesQuery->when($request->branch_id, function ($q) use ($request) {
|
||||
$q->where('branch_id', $request->branch_id);
|
||||
});
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$this->applyDateFilter($purchasesQuery, $duration, 'purchaseDate', $request->from_date, $request->to_date);
|
||||
|
||||
// Search Filter
|
||||
if ($request->filled('search')) {
|
||||
$purchasesQuery->where(function ($query) use ($request) {
|
||||
$query->where('paymentType', 'like', '%' . $request->search . '%')
|
||||
->orWhere('invoiceNumber', 'like', '%' . $request->search . '%')
|
||||
->orWhereHas('party', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('payment_type', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('branch', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$purchases = $purchasesQuery->latest()->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::reports.purchase.pdf', compact('purchases', 'duration', 'filter_from_date', 'filter_to_date'), 'purchases-report.pdf');
|
||||
return PdfService::render('business::reports.purchase.pdf', compact('purchases'), 'purchases-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
use App\Models\Purchase;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\PurchaseReturnDetail;
|
||||
use App\Services\PdfService;
|
||||
use App\Traits\DateFilterTrait;
|
||||
use App\Traits\DateRangeTrait;
|
||||
@@ -25,6 +26,12 @@ public function index(Request $request)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
|
||||
$total_purchase_return = PurchaseReturnDetail::whereHas('purchaseReturn', function ($query) use ($businessId) {
|
||||
$query->whereHas('purchase', function ($q) use ($businessId) {
|
||||
$q->where('business_id', $businessId);
|
||||
});
|
||||
})->sum('return_amount');
|
||||
|
||||
$purchasesQuery = Purchase::with([
|
||||
'user:id,name',
|
||||
'branch:id,name',
|
||||
@@ -47,9 +54,7 @@ public function index(Request $request)
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$purchasesQuery->whereHas('purchaseReturns', function ($query) use ($duration, $request) {
|
||||
$this->applyDateFilter($query, $duration, 'return_date', $request->from_date, $request->to_date);
|
||||
});
|
||||
$this->applyDateFilter($purchasesQuery, $duration, 'purchaseDate', $request->from_date, $request->to_date);
|
||||
|
||||
// Search Filter
|
||||
if ($request->filled('search')) {
|
||||
@@ -64,19 +69,17 @@ public function index(Request $request)
|
||||
});
|
||||
}
|
||||
|
||||
// Calculate Total Purchase Return Amount in the Selected Date Range
|
||||
$total_purchase_return = PurchaseReturnDetail::whereHas('purchaseReturn', function ($query) use ($businessId) {
|
||||
$query->whereHas('purchase', function ($q) use ($businessId) {
|
||||
$q->where('business_id', $businessId);
|
||||
});
|
||||
})->sum('return_amount');
|
||||
|
||||
// Pagination
|
||||
$perPage = $request->input('per_page', 20);
|
||||
$purchases = $purchasesQuery->latest()->paginate($perPage)->appends($request->query());
|
||||
|
||||
$total_purchase_return = (clone $purchasesQuery)
|
||||
->with('purchaseReturns.details')
|
||||
->get()
|
||||
->sum(function ($sale) {
|
||||
return $sale->purchaseReturns->sum(function ($return) {
|
||||
return $return->details->sum('return_amount');
|
||||
});
|
||||
});
|
||||
|
||||
// Handle AJAX Request
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
@@ -102,7 +105,7 @@ public function exportCsv()
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
{
|
||||
$purchasesQuery = Purchase::with([
|
||||
$purchases = Purchase::with([
|
||||
'user:id,name',
|
||||
'branch:id,name',
|
||||
'party:id,name,email,phone,type',
|
||||
@@ -114,35 +117,10 @@ public function exportPdf(Request $request)
|
||||
}
|
||||
])
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->whereHas('purchaseReturns');
|
||||
->whereHas('purchaseReturns')
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
$purchasesQuery->when($request->branch_id, function ($q) use ($request) {
|
||||
$q->where('branch_id', $request->branch_id);
|
||||
});
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$purchasesQuery->whereHas('purchaseReturns', function ($query) use ($duration, $request) {
|
||||
$this->applyDateFilter($query, $duration, 'return_date', $request->from_date, $request->to_date);
|
||||
});
|
||||
|
||||
// Search Filter
|
||||
if ($request->filled('search')) {
|
||||
$purchasesQuery->where(function ($query) use ($request) {
|
||||
$query->where('invoiceNumber', 'like', '%' . $request->search . '%')
|
||||
->orWhereHas('party', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('branch', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$purchases = $purchasesQuery->latest()->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::reports.purchase-return.pdf', compact('purchases', 'duration', 'filter_from_date', 'filter_to_date'), 'purchase-return-report.pdf');
|
||||
return PdfService::render('business::reports.purchase-return.pdf', compact('purchases'), 'purchase-return-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
use App\Models\Sale;
|
||||
use App\Models\Branch;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\PdfService;
|
||||
use App\Traits\DateFilterTrait;
|
||||
@@ -25,8 +26,11 @@ public function index(Request $request)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
|
||||
$salesQuery = Sale::with('user:id,name', 'party:id,name,email,phone,type', 'payment_type:id,name', 'branch:id,name', 'transactions')->where('business_id', $businessId);
|
||||
$total_sale = Sale::where('business_id', $businessId)
|
||||
->whereDate('saleDate', Carbon::today())
|
||||
->sum('totalAmount');
|
||||
|
||||
$salesQuery = Sale::with('user:id,name', 'party:id,name,email,phone,type', 'payment_type:id,name', 'branch:id,name', 'transactions')->where('business_id', $businessId);
|
||||
$salesQuery->when($request->branch_id, function ($q) use ($request) {
|
||||
$q->where('branch_id', $request->branch_id);
|
||||
});
|
||||
@@ -84,38 +88,10 @@ public function exportCsv()
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
{
|
||||
$salesQuery = Sale::with('user:id,name', 'party:id,name,email,phone,type', 'payment_type:id,name', 'branch:id,name', 'transactions')
|
||||
->where('business_id', auth()->user()->business_id);
|
||||
$sales = Sale::with('user:id,name', 'party:id,name,email,phone,type', 'payment_type:id,name', 'branch:id,name', 'transactions')->where('business_id', auth()->user()->business_id)
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
$salesQuery->when($request->branch_id, function ($q) use ($request) {
|
||||
$q->where('branch_id', $request->branch_id);
|
||||
});
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$this->applyDateFilter($salesQuery, $duration, 'saleDate', $request->from_date, $request->to_date);
|
||||
|
||||
// Search Filter
|
||||
if ($request->filled('search')) {
|
||||
$salesQuery->where(function ($query) use ($request) {
|
||||
$query->where('paymentType', 'like', '%' . $request->search . '%')
|
||||
->orWhere('invoiceNumber', 'like', '%' . $request->search . '%')
|
||||
->orWhereHas('party', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('payment_type', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('branch', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$sales = $salesQuery->latest()->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::reports.sales.pdf', compact('sales', 'duration', 'filter_from_date', 'filter_to_date'),'sales-report.pdf');
|
||||
return PdfService::render('business::reports.sales.pdf', compact('sales'),'sales-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
use App\Models\Sale;
|
||||
use App\Models\Branch;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\SaleReturnDetails;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\PdfService;
|
||||
use App\Traits\DateFilterTrait;
|
||||
@@ -23,6 +24,12 @@ public function __construct()
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$total_sale_return = SaleReturnDetails::whereHas('saleReturn', function ($query) {
|
||||
$query->whereHas('sale', function ($q) {
|
||||
$q->where('business_id', auth()->user()->business_id);
|
||||
});
|
||||
})->sum('return_amount');
|
||||
|
||||
$businessId = auth()->user()->business_id;
|
||||
|
||||
$salesQuery = Sale::with([
|
||||
@@ -37,7 +44,9 @@ public function index(Request $request)
|
||||
->with('branch:id,name');
|
||||
}
|
||||
])
|
||||
|
||||
->where('business_id', $businessId)
|
||||
|
||||
->when($request->branch_id, function ($q) use ($request) {
|
||||
$q->where('branch_id', $request->branch_id);
|
||||
})->whereHas('saleReturns');
|
||||
@@ -46,9 +55,7 @@ public function index(Request $request)
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$salesQuery->whereHas('saleReturns', function ($query) use ($request, $duration) {
|
||||
$this->applyDateFilter($query, $duration, 'return_date', $request->from_date, $request->to_date);
|
||||
});
|
||||
$this->applyDateFilter($salesQuery, $duration, 'saleDate', $request->from_date, $request->to_date);
|
||||
|
||||
// Search Filter
|
||||
if ($request->filled('search')) {
|
||||
@@ -63,18 +70,15 @@ public function index(Request $request)
|
||||
});
|
||||
}
|
||||
|
||||
$total_sale_return = SaleReturnDetails::whereHas('saleReturn', function ($query) use ($businessId) {
|
||||
$query->whereHas('sale', function ($q) use ($businessId) {
|
||||
$q->where('business_id', $businessId);
|
||||
});
|
||||
})->sum('return_amount');
|
||||
|
||||
$perPage = $request->input('per_page', 20);
|
||||
$sales = $salesQuery->latest()->paginate($perPage)->appends($request->query());
|
||||
|
||||
$total_sale_return = (clone $salesQuery)
|
||||
->with('saleReturns.details')
|
||||
->get()
|
||||
->sum(function ($sale) {
|
||||
return $sale->saleReturns->sum(function ($return) {
|
||||
return $return->details->sum('return_amount');
|
||||
});
|
||||
});
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
'data' => view('business::reports.sales-return.datas', compact('sales', 'filter_from_date', 'filter_to_date', 'duration'))->render(),
|
||||
@@ -99,7 +103,7 @@ public function exportCsv()
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
{
|
||||
$salesQuery = Sale::with([
|
||||
$sales = Sale::with([
|
||||
'user:id,name',
|
||||
'party:id,name',
|
||||
'branch:id,name',
|
||||
@@ -112,33 +116,10 @@ public function exportPdf(Request $request)
|
||||
}
|
||||
])
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->when($request->branch_id, function ($q) use ($request) {
|
||||
$q->where('branch_id', $request->branch_id);
|
||||
})->whereHas('saleReturns');
|
||||
->whereHas('saleReturns')
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$salesQuery->whereHas('saleReturns', function ($query) use ($duration, $request) {
|
||||
$this->applyDateFilter($query, $duration, 'return_date', $request->from_date, $request->to_date);
|
||||
});
|
||||
|
||||
// Search Filter
|
||||
if ($request->filled('search')) {
|
||||
$salesQuery->where(function ($query) use ($request) {
|
||||
$query->where('invoiceNumber', 'like', '%' . $request->search . '%')
|
||||
->orWhereHas('party', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('branch', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$sales = $salesQuery->latest()->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::reports.sales-return.pdf', compact('sales', 'duration', 'filter_from_date', 'filter_to_date'), 'sales-return-report.pdf');
|
||||
return PdfService::render('business::reports.sales-return.pdf', compact('sales'), 'sales-return-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
namespace Modules\Business\App\Http\Controllers;
|
||||
|
||||
use App\Models\Stock;
|
||||
use App\Models\Product;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\PdfService;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
@@ -20,42 +22,31 @@ public function index(Request $request)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
|
||||
$productsQuery = Product::with(['stocks' => function ($q) {
|
||||
$q->select('id', 'product_id', 'productStock', 'productPurchasePrice', 'productSalePrice');
|
||||
}])
|
||||
->where('business_id', $businessId)
|
||||
->where('product_type', '!=', 'combo');
|
||||
$total_stock_value = Stock::whereHas('product', function ($q) use ($businessId) {
|
||||
$q->where('business_id', $businessId);
|
||||
})->sum(DB::raw('"productPurchasePrice" * "productStock"'));
|
||||
|
||||
if ($request->search) {
|
||||
$productsQuery->where(function ($q) use ($request) {
|
||||
$q->where('productName', 'like', '%' . $request->search . '%')
|
||||
->orWhereHas('stocks', function ($stock) use ($request) {
|
||||
$stock->where('productSalePrice', 'like', '%' . $request->search . '%')
|
||||
->orWhere('productPurchasePrice', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
$total_qty = Stock::whereHas('product', function ($q) use ($businessId) {
|
||||
$q->where('business_id', $businessId);
|
||||
})->sum('productStock');
|
||||
|
||||
$stock_reports = $productsQuery
|
||||
$stock_reports = Product::with('stocks')
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->where('product_type', '!=', 'combo')
|
||||
->when($request->search, function ($query) use ($request) {
|
||||
$query->where(function ($q) use ($request) {
|
||||
$q->where('productName', 'like', '%' . $request->search . '%')
|
||||
->orwhere('productSalePrice', 'like', '%' . $request->search . '%')
|
||||
->orwhere('productPurchasePrice', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
})
|
||||
->withSum('stocks', 'productStock')
|
||||
->latest()
|
||||
->paginate($request->per_page ?? 20)
|
||||
->appends($request->query());
|
||||
|
||||
$total_qty = $stock_reports->getCollection()->sum(function ($product) {
|
||||
return $product->stocks->sum('productStock');
|
||||
});
|
||||
|
||||
$total_stock_value = $stock_reports->getCollection()->sum(function ($product) {
|
||||
return $product->stocks->sum(function ($stock) {
|
||||
return $stock->productStock * $stock->productPurchasePrice;
|
||||
});
|
||||
});
|
||||
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
'data' => view('business::reports.stocks.datas', compact('stock_reports'))->render(),
|
||||
'total_stock_value' => currency_format($total_stock_value, currency: business_currency()),
|
||||
'total_qty' => $total_qty
|
||||
'data' => view('business::reports.stocks.datas', compact('stock_reports'))->render()
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -72,29 +63,21 @@ public function exportCsv()
|
||||
return Excel::download(new ExportCurrentStockReport, 'current-stock-report.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$productsQuery = Product::with(['stocks' => function ($q) {
|
||||
$q->select('id', 'product_id', 'productStock', 'productPurchasePrice', 'productSalePrice');
|
||||
}])
|
||||
$query = Product::with('stocks')
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->where('product_type', '!=', 'combo');
|
||||
|
||||
if ($request->search) {
|
||||
$productsQuery->where(function ($q) use ($request) {
|
||||
$q->where('productName', 'like', '%' . $request->search . '%')
|
||||
->orWhereHas('stocks', function ($stock) use ($request) {
|
||||
$stock->where('productSalePrice', 'like', '%' . $request->search . '%')
|
||||
->orWhere('productPurchasePrice', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
if (request('alert_qty')) {
|
||||
$stock_reports = $query->get()->filter(function ($product) {
|
||||
$totalStock = $product->stocks->sum('productStock');
|
||||
return $totalStock <= $product->alert_qty;
|
||||
});
|
||||
} else {
|
||||
$stock_reports = $query->latest()->get();
|
||||
}
|
||||
|
||||
$stock_reports = $productsQuery
|
||||
->latest()
|
||||
->limit($request->per_page ?? 20)
|
||||
->get();
|
||||
|
||||
return PdfService::render('business::reports.stocks.pdf', compact('stock_reports'), 'stock-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,42 +72,16 @@ public function exportCsv()
|
||||
return Excel::download(new ExportSubscription, 'subscribers.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$subscriberQuery = PlanSubscribe::with(['plan:id,subscriptionName','business:id,companyName,business_category_id,pictureUrl','business.category:id,name','gateway:id,name'])->where('business_id', auth()->user()->business_id);
|
||||
$subscribers = PlanSubscribe::with(['plan:id,subscriptionName','business:id,companyName,business_category_id,pictureUrl','business.category:id,name','gateway:id,name'])->where('business_id', auth()->user()->business_id)
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$this->applyDateFilter($subscriberQuery, $duration, 'created_at', $request->from_date, $request->to_date);
|
||||
|
||||
// Search Filter
|
||||
if ($request->filled('search')) {
|
||||
$search = $request->search;
|
||||
$subscriberQuery->where(function ($query) use ($search) {
|
||||
$query->where('duration', 'like', '%' . $search . '%')
|
||||
->orWhereHas('plan', function ($q) use ($search) {
|
||||
$q->where('subscriptionName', 'like', '%' . $search . '%');
|
||||
})
|
||||
->orWhereHas('gateway', function ($q) use ($search) {
|
||||
$q->where('name', 'like', '%' . $search . '%');
|
||||
})
|
||||
->orWhereHas('business', function ($q) use ($search) {
|
||||
$q->where('companyName', 'like', '%' . $search . '%')
|
||||
->orWhereHas('category', function ($q) use ($search) {
|
||||
$q->where('name', 'like', '%' . $search . '%');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$subscribers = $subscriberQuery->latest()->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::reports.subscription-reports.pdf', compact('subscribers', 'duration', 'filter_from_date', 'filter_to_date'),'subscription-reports.pdf');
|
||||
return PdfService::render('business::reports.subscription-reports.pdf', compact('subscribers'),'subscription-reports.pdf');
|
||||
}
|
||||
|
||||
public function getInvoice(string $invoice_id)
|
||||
public function getInvoice($invoice_id)
|
||||
{
|
||||
$subscriber = PlanSubscribe::with(['plan:id,subscriptionName','business:id,companyName,business_category_id,pictureUrl,phoneNumber,email,address,meta','business.category:id,name','gateway:id,name'])->where('business_id', auth()->user()->business_id)->findOrFail($invoice_id);
|
||||
return view('business::reports.subscription-reports.invoice', compact('subscriber'));
|
||||
|
||||
@@ -35,52 +35,82 @@ public function index(Request $request)
|
||||
->with('purchases_dues')
|
||||
->latest();
|
||||
|
||||
$parties = $query
|
||||
->paginate($request->per_page ?? 20)
|
||||
->appends($request->query());
|
||||
// Branch-aware due filter
|
||||
if ($activeBranch) {
|
||||
$query->whereHas('purchases_dues', function ($q) use ($activeBranch) {
|
||||
$q->where('branch_id', $activeBranch->id)
|
||||
->where('dueAmount', '>', 0);
|
||||
});
|
||||
} else {
|
||||
$query->where('due', '>', 0);
|
||||
}
|
||||
|
||||
$parties = $query->paginate($request->per_page ?? 20);
|
||||
|
||||
// Replace $supplier->due with branch-specific due if active branch exists
|
||||
if ($activeBranch) {
|
||||
$parties->setCollection(
|
||||
$parties->getCollection()
|
||||
->transform(function ($supplier) use ($activeBranch) {
|
||||
$party_due = $supplier->purchases_dues
|
||||
$supplier->due = $supplier->purchases_dues
|
||||
->where('branch_id', $activeBranch->id)
|
||||
->sum('dueAmount');
|
||||
|
||||
if ($supplier->branch_id === $activeBranch->id) {
|
||||
$openingBalanceDue = $supplier->opening_balance_type === 'due'
|
||||
? ($supplier->opening_balance ?? 0)
|
||||
: 0;
|
||||
|
||||
$supplier->due = $openingBalanceDue + $party_due;
|
||||
} else {
|
||||
$supplier->due = $party_due;
|
||||
}
|
||||
|
||||
return $supplier;
|
||||
})
|
||||
->filter(fn($supplier) => $supplier->due > 0)
|
||||
->values()
|
||||
);
|
||||
}
|
||||
|
||||
// Calculate total_due
|
||||
$total_due = $parties->sum(function ($supplier) {
|
||||
return $supplier->due;
|
||||
});
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
'data' => view('business::reports.supplier-due.datas', compact('parties', 'total_due'))->render()
|
||||
]);
|
||||
}
|
||||
|
||||
if ($activeBranch) {
|
||||
// Filter parties that have branch-specific due > 0
|
||||
$query->whereHas('purchases_dues', function ($q) use ($activeBranch) {
|
||||
$q->where('branch_id', $activeBranch->id)
|
||||
->where('dueAmount', '>', 0);
|
||||
});
|
||||
} else {
|
||||
$query->where('due', '>', 0);
|
||||
}
|
||||
|
||||
$parties = $query->paginate(20)->appends($request->query());
|
||||
|
||||
// Calculate total due
|
||||
$total_due = $parties->sum(function ($supplier) use ($activeBranch) {
|
||||
if ($activeBranch) {
|
||||
return $supplier->purchases_dues
|
||||
->where('branch_id', $activeBranch->id)
|
||||
->sum('dueAmount');
|
||||
}
|
||||
return $supplier->due;
|
||||
});
|
||||
|
||||
// Replace $supplier->due with branch-specific due if active branch exists
|
||||
if ($activeBranch) {
|
||||
$parties->setCollection(
|
||||
$parties->getCollection()
|
||||
->filter(fn($supplier) => ($supplier->due ?? 0) > 0)
|
||||
->transform(function ($supplier) use ($activeBranch) {
|
||||
$supplier->due = $supplier->purchases_dues
|
||||
->where('branch_id', $activeBranch->id)
|
||||
->sum('dueAmount');
|
||||
return $supplier;
|
||||
})
|
||||
->filter(fn($supplier) => $supplier->due > 0)
|
||||
->values()
|
||||
);
|
||||
}
|
||||
|
||||
$supplier_total_due = $parties->getCollection()->sum('due');
|
||||
|
||||
if ($request->ajax()) {
|
||||
|
||||
return response()->json([
|
||||
'data' => view('business::reports.supplier-due.datas', compact('parties'))->render(),
|
||||
'supplier_total_due' => currency_format($supplier_total_due, currency: business_currency())
|
||||
]);
|
||||
}
|
||||
|
||||
return view('business::reports.supplier-due.due-reports', compact('parties', 'supplier_total_due'));
|
||||
return view('business::reports.supplier-due.due-reports', compact('parties', 'total_due'));
|
||||
}
|
||||
|
||||
public function exportExcel()
|
||||
@@ -93,7 +123,7 @@ public function exportCsv()
|
||||
return Excel::download(new ExportSupplierDue, 'supplier-due.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$user = auth()->user();
|
||||
$businessId = $user->business_id;
|
||||
@@ -101,48 +131,29 @@ public function exportPdf(Request $request)
|
||||
|
||||
$query = Party::where('business_id', $businessId)
|
||||
->where('type', 'Supplier')
|
||||
->when($request->search, function ($q) use ($request) {
|
||||
$q->where(function ($q2) use ($request) {
|
||||
$q2->where('type', 'like', '%' . $request->search . '%')
|
||||
->orWhere('name', 'like', '%' . $request->search . '%')
|
||||
->orWhere('phone', 'like', '%' . $request->search . '%')
|
||||
->orWhere('credit_limit', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
})
|
||||
->with('purchases_dues')
|
||||
->latest();
|
||||
|
||||
if ($activeBranch) {
|
||||
$query->whereHas('purchases_dues', function ($q) use ($activeBranch) {
|
||||
$q->where('branch_id', $activeBranch->id)
|
||||
->where('dueAmount', '>', 0);
|
||||
});
|
||||
} else {
|
||||
$query->where('due', '>', 0);
|
||||
}
|
||||
|
||||
$parties = $query->get();
|
||||
|
||||
if ($activeBranch) {
|
||||
$parties = $parties
|
||||
->transform(function ($supplier) use ($activeBranch) {
|
||||
$party_due = $supplier->purchases_dues
|
||||
->where('branch_id', $activeBranch->id)
|
||||
->sum('dueAmount');
|
||||
|
||||
if ($supplier->branch_id === $activeBranch->id) {
|
||||
$openingBalanceDue = $supplier->opening_balance_type === 'due'
|
||||
? ($supplier->opening_balance ?? 0)
|
||||
: 0;
|
||||
|
||||
$supplier->due = $openingBalanceDue + $party_due;
|
||||
} else {
|
||||
$supplier->due = $party_due;
|
||||
}
|
||||
|
||||
return $supplier;
|
||||
})
|
||||
->filter(fn($supplier) => $supplier->due > 0)
|
||||
->take($request->per_page ?? 20)
|
||||
->values();
|
||||
} else {
|
||||
$parties = $parties
|
||||
->filter(fn($supplier) => ($supplier->due ?? 0) > 0)
|
||||
->take($request->per_page ?? 20)
|
||||
->values();
|
||||
$parties->transform(function ($supplier) use ($activeBranch) {
|
||||
$supplier->due = $supplier->purchases_dues
|
||||
->where('branch_id', $activeBranch->id)
|
||||
->sum('dueAmount');
|
||||
return $supplier;
|
||||
})->filter(fn($supplier) => $supplier->due > 0);
|
||||
}
|
||||
|
||||
return PdfService::render('business::reports.supplier-due.pdf', compact('parties'), 'supplier-due-report.pdf');
|
||||
return PdfService::render('business::reports.supplier-due.pdf', compact('parties'),'supplier-due-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public function index(Request $request)
|
||||
}
|
||||
|
||||
$top_products = SaleDetails::query()
|
||||
->with('product:id,productName,productCode,hsn_code')
|
||||
->with('product:id,productName,productCode')
|
||||
->whereHas('product', function ($q) use ($businessId) {
|
||||
$q->where('business_id', $businessId);
|
||||
})
|
||||
@@ -67,41 +67,28 @@ public function exportCsv()
|
||||
return Excel::download(new ExportTopProduct, 'top-products.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$user = auth()->user();
|
||||
$businessId = $user->business_id;
|
||||
$branchId = moduleCheck('MultiBranchAddon') ? auth()->user()->branch_id ?? auth()->user()->active_branch_id : null;
|
||||
|
||||
$branchId = null;
|
||||
if (moduleCheck('MultiBranchAddon')) {
|
||||
$branchId = $user->branch_id ?? $user->active_branch_id;
|
||||
}
|
||||
|
||||
$top_products = SaleDetails::query()
|
||||
->with('product:id,productName,productCode,hsn_code')
|
||||
->whereHas('product', function ($q) use ($businessId) {
|
||||
$q->where('business_id', $businessId);
|
||||
})
|
||||
->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}%");
|
||||
});
|
||||
})
|
||||
->when($branchId, function ($q) use ($branchId) {
|
||||
$q->whereHas('sale', function ($q) use ($branchId) {
|
||||
$q->where('branch_id', $branchId);
|
||||
});
|
||||
})
|
||||
->select(
|
||||
'product_id',
|
||||
DB::raw('SUM(quantities) as total_sold_qty'),
|
||||
DB::raw('SUM((price - discount) * quantities) as total_sale_amount')
|
||||
)
|
||||
->groupBy('product_id')
|
||||
->orderByDesc('total_sold_qty')
|
||||
->limit(5)
|
||||
->get();
|
||||
$top_products = 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(quantities) as total_sold_qty'),
|
||||
DB::raw('SUM(price * quantities) as total_sale_amount')
|
||||
)
|
||||
->groupBy('product_id')
|
||||
->orderByDesc('total_sold_qty')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
return PdfService::render('business::reports.top-products.pdf', compact('top_products'),'top-product-report.pdf');
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
use App\Services\PdfService;
|
||||
use App\Traits\DateFilterTrait;
|
||||
use App\Traits\DateRangeTrait;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Business\App\Exports\ExportTransaction;
|
||||
|
||||
@@ -23,6 +24,15 @@ public function __construct()
|
||||
public function index(Request $request)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
$today = Carbon::today()->format('Y-m-d');
|
||||
|
||||
$total_due = DueCollect::where('business_id', $businessId)
|
||||
->whereDate('paymentDate', $today)
|
||||
->sum('totalDue');
|
||||
|
||||
$total_paid = DueCollect::where('business_id', $businessId)
|
||||
->whereDate('paymentDate', $today)
|
||||
->sum('payDueAmount');
|
||||
|
||||
$transactionsQuery = DueCollect::with('party:id,name,type', 'payment_type:id,name', 'transactions')->where('business_id', $businessId);
|
||||
|
||||
@@ -83,44 +93,12 @@ public function exportCsv()
|
||||
return Excel::download(new ExportTransaction, 'transaction-history.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
public function exportPdf()
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
$transactions = DueCollect::with('party:id,name,type', 'payment_type:id,name', 'transactions')->where('business_id', auth()->user()->business_id)
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
$transactionsQuery = DueCollect::with('party:id,name,type', 'payment_type:id,name', 'transactions')->where('business_id', $businessId);
|
||||
|
||||
// Date Filter
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$this->applyDateFilter($transactionsQuery, $duration, 'paymentDate', $request->from_date, $request->to_date);
|
||||
|
||||
// Search Filter
|
||||
if ($request->filled('search')) {
|
||||
$transactionsQuery->where(function ($query) use ($request) {
|
||||
$query->where('paymentType', 'like', '%' . $request->search . '%')
|
||||
->orWhere('totalDue', 'like', '%' . $request->search . '%')
|
||||
->orWhere('invoiceNumber', 'like', '%' . $request->search . '%')
|
||||
->orWhere('payDueAmount', 'like', '%' . $request->search . '%')
|
||||
->orWhereHas('party', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
})
|
||||
->orWhereHas('payment_type', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if ($request->filled('type')) {
|
||||
$transactionsQuery->whereHas('party', function ($q) use ($request) {
|
||||
$q->where(function ($q) use ($request) {
|
||||
$q->where('type', $request->type);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$transactions = $transactionsQuery->latest()->limit($request->per_page)->get();
|
||||
|
||||
return PdfService::render('business::reports.transaction-history.pdf', compact('transactions', 'duration', 'filter_from_date', 'filter_to_date'),'due-transactions-report.pdf');
|
||||
return PdfService::render('business::reports.transaction-history.pdf', compact('transactions'),'due-transactions-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,16 @@
|
||||
|
||||
namespace Modules\Business\App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Purchase;
|
||||
use App\Models\PurchaseReturnDetail;
|
||||
use App\Models\Sale;
|
||||
use App\Models\SaleDetails;
|
||||
use App\Models\SaleReturnDetails;
|
||||
use App\Models\Vat;
|
||||
use App\Models\VatTransaction;
|
||||
use App\Models\Sale;
|
||||
use App\Models\Purchase;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\PdfService;
|
||||
use App\Traits\DateFilterTrait;
|
||||
use App\Traits\DateRangeTrait;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Business\App\Exports\ExportTaxReport;
|
||||
use Modules\Business\App\Exports\ExportVatReport;
|
||||
|
||||
class AcnooVatReportController extends Controller
|
||||
{
|
||||
@@ -29,441 +25,134 @@ public function __construct()
|
||||
public function index(Request $request)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
|
||||
$vats = Vat::where('business_id', $businessId)
|
||||
->whereStatus(1)
|
||||
->get();
|
||||
$vats = Vat::where('business_id', $businessId)->whereStatus(1)->get();
|
||||
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
$salesQuery = Sale::where('business_id', $businessId)
|
||||
->with([
|
||||
'user:id,name',
|
||||
'party:id,name,email,phone,type',
|
||||
'business:id,companyName',
|
||||
'payment_type:id,name',
|
||||
'transactions'
|
||||
]);
|
||||
$salesQuery = Sale::with('user:id,name', 'party:id,name,email,phone,type', 'business:id,companyName', 'payment_type:id,name', 'transactions')
|
||||
->where('business_id', $businessId)
|
||||
->where('vat_amount', '>', 0);
|
||||
|
||||
$this->applyDateFilter(
|
||||
$salesQuery,
|
||||
$duration,
|
||||
'saleDate',
|
||||
$request->from_date,
|
||||
$request->to_date
|
||||
);
|
||||
// Date Filter
|
||||
$this->applyDateFilter($salesQuery, $duration, 'saleDate', $request->from_date, $request->to_date);
|
||||
|
||||
if ($request->filled('search')) {
|
||||
$search = $request->search;
|
||||
$salesQuery->where(function ($query) use ($search) {
|
||||
$query->where('invoiceNumber', 'like', '%' . $search . '%')
|
||||
->orWhere('totalAmount', 'like', '%' . $search . '%')
|
||||
->orWhere('discountAmount', 'like', '%' . $search . '%')
|
||||
->orWhereHas('party', fn($q) => $q->where('name', 'like', '%' . $search . '%')->orWhere('tax_no', 'like', '%' . $search . '%'));
|
||||
});
|
||||
$sales = $salesQuery->latest()->paginate(20, ['*'], 'sales');
|
||||
|
||||
$salesVatTotals = [];
|
||||
foreach ($vats as $vat) {
|
||||
$salesVatTotals[$vat->id] = (clone $salesQuery)->where('vat_id', $vat->id)->sum('vat_amount');
|
||||
}
|
||||
|
||||
$sales = $salesQuery->latest()->paginate($request->per_page ?? 20, ['*'], 'sales')->appends($request->query());
|
||||
$purchasesQuery = Purchase::with('details', 'party', 'details.product', 'details.product.category', 'payment_type:id,name', 'transactions')
|
||||
->where('business_id', $businessId)
|
||||
->where('vat_amount', '>', 0);
|
||||
|
||||
$salesVatTotals = VatTransaction::where('vat_transactions.business_id', $businessId)
|
||||
->where('vat_transactions.vatable_type', SaleDetails::class)
|
||||
->join('sale_details', 'sale_details.id', '=', 'vat_transactions.vatable_id')
|
||||
->join('sales', 'sales.id', '=', 'sale_details.sale_id')
|
||||
->where('sales.business_id', $businessId)
|
||||
->selectRaw('vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as total')
|
||||
->groupBy('vat_transactions.vat_id')
|
||||
->pluck('total','vat_transactions.vat_id')
|
||||
->toArray();
|
||||
// Date Filter
|
||||
$this->applyDateFilter($purchasesQuery, $duration, 'purchaseDate', $request->from_date, $request->to_date);
|
||||
|
||||
$salesReturnVatTotals = VatTransaction::where('vat_transactions.business_id', $businessId)
|
||||
->where('vat_transactions.vatable_type', SaleReturnDetails::class)
|
||||
->join('sale_return_details', 'sale_return_details.id', '=', 'vat_transactions.vatable_id')
|
||||
->join('sale_details', 'sale_details.id', '=', 'sale_return_details.sale_detail_id')
|
||||
->join('sales', 'sales.id', '=', 'sale_details.sale_id')
|
||||
->where('sales.business_id', $businessId)
|
||||
->selectRaw('vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as total')
|
||||
->groupBy('vat_transactions.vat_id')
|
||||
->pluck('total', 'vat_transactions.vat_id')
|
||||
->toArray();
|
||||
$purchases = $purchasesQuery->latest()->paginate(20, ['*'], 'purchases');
|
||||
|
||||
$saleVatRowMap = VatTransaction::where('business_id', $businessId)
|
||||
->where('vatable_type', \App\Models\SaleDetails::class)
|
||||
->whereIn('vatable_id', function ($query) use ($businessId, $duration, $request) {
|
||||
$query->select('sale_details.id')
|
||||
->from('sale_details')
|
||||
->join('sales', 'sales.id', '=', 'sale_details.sale_id')
|
||||
->where('sales.business_id', $businessId);
|
||||
|
||||
if ($duration === 'custom_days' && $request->from_date && $request->to_date) {
|
||||
$query->whereBetween('sales.saleDate', [$request->from_date, $request->to_date]);
|
||||
}
|
||||
})
|
||||
->join('sale_details', 'sale_details.id', '=', 'vat_transactions.vatable_id')
|
||||
->selectRaw('sale_details.sale_id, vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as total')
|
||||
->groupBy('sale_details.sale_id', 'vat_transactions.vat_id')
|
||||
->get()
|
||||
->groupBy('sale_id')
|
||||
->map(function ($items) {
|
||||
return $items->pluck('total', 'vat_id')->toArray();
|
||||
})
|
||||
->toArray();
|
||||
|
||||
$saleReturnVatRows = VatTransaction::where('vat_transactions.business_id', $businessId)
|
||||
->where('vat_transactions.vatable_type', SaleReturnDetails::class)
|
||||
|
||||
->join('sale_return_details','sale_return_details.id','=','vat_transactions.vatable_id')
|
||||
->join('sale_details','sale_details.id','=','sale_return_details.sale_detail_id')
|
||||
->join('sales','sales.id','=','sale_details.sale_id')
|
||||
|
||||
->selectRaw('sales.id as sale_id, vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as vat_amount')
|
||||
->groupBy('sales.id','vat_transactions.vat_id')
|
||||
->get();
|
||||
|
||||
$saleReturnVatRowMap = $saleReturnVatRows
|
||||
->groupBy('sale_id')
|
||||
->map(fn($rows)=>$rows->pluck('vat_amount','vat_id'))
|
||||
->toArray();
|
||||
|
||||
$purchasesQuery = Purchase::with([
|
||||
'details',
|
||||
'party',
|
||||
'details.product',
|
||||
'details.product.category',
|
||||
'payment_type:id,name',
|
||||
'transactions'
|
||||
])
|
||||
->where('business_id', $businessId);
|
||||
|
||||
$this->applyDateFilter(
|
||||
$purchasesQuery,
|
||||
$duration,
|
||||
'purchaseDate',
|
||||
$request->from_date,
|
||||
$request->to_date
|
||||
);
|
||||
|
||||
if ($request->filled('search')) {
|
||||
$search = $request->search;
|
||||
$purchasesQuery->where(function ($query) use ($search) {
|
||||
$query->where('invoiceNumber', 'like', '%' . $search . '%')
|
||||
->orWhere('totalAmount', 'like', '%' . $search . '%')
|
||||
->orWhere('discountAmount', 'like', '%' . $search . '%')
|
||||
->orWhereHas('party', fn($q) => $q->where('name', 'like', '%' . $search . '%')->orWhere('tax_no', 'like', '%' . $search . '%'));
|
||||
});
|
||||
$purchasesVatTotals = [];
|
||||
foreach ($vats as $vat) {
|
||||
$purchasesVatTotals[$vat->id] = (clone $purchasesQuery)->where('vat_id', $vat->id)->sum('vat_amount');
|
||||
}
|
||||
|
||||
$purchases = $purchasesQuery->latest()->paginate($request->per_page ?? 20, ['*'], 'purchases')->appends($request->query());
|
||||
|
||||
$purchasesVatTotals = VatTransaction::where('vat_transactions.business_id', $businessId)
|
||||
->where('vat_transactions.vatable_type', \App\Models\PurchaseDetails::class)
|
||||
->join('purchase_details', 'purchase_details.id', '=', 'vat_transactions.vatable_id')
|
||||
->join('purchases', 'purchases.id', '=', 'purchase_details.purchase_id')
|
||||
->where('purchases.business_id', $businessId)
|
||||
->selectRaw('vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as total')
|
||||
->groupBy('vat_transactions.vat_id')
|
||||
->pluck('total','vat_transactions.vat_id')
|
||||
->toArray();
|
||||
|
||||
|
||||
$purchaseReturnVatTotals = VatTransaction::where('vat_transactions.business_id', $businessId)
|
||||
->where('vat_transactions.vatable_type', PurchaseReturnDetail::class)
|
||||
->join('purchase_return_details', 'purchase_return_details.id', '=', 'vat_transactions.vatable_id')
|
||||
->join('purchase_details', 'purchase_details.id', '=', 'purchase_return_details.purchase_detail_id')
|
||||
->join('purchases', 'purchases.id', '=', 'purchase_details.purchase_id')
|
||||
->where('purchases.business_id', $businessId)
|
||||
->selectRaw('vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as total')
|
||||
->groupBy('vat_transactions.vat_id')
|
||||
->pluck('total', 'vat_transactions.vat_id')
|
||||
->toArray();
|
||||
|
||||
$purchaseVatRowMap = VatTransaction::where('business_id', $businessId)
|
||||
->where('vatable_type', \App\Models\PurchaseDetails::class)
|
||||
->whereIn('vatable_id', function ($query) use ($businessId, $duration, $request) {
|
||||
$query->select('purchase_details.id')
|
||||
->from('purchase_details')
|
||||
->join('purchases', 'purchases.id', '=', 'purchase_details.purchase_id')
|
||||
->where('purchases.business_id', $businessId);
|
||||
|
||||
if ($duration === 'custom_date' && $request->from_date && $request->to_date) {
|
||||
$query->whereBetween('purchases.purchaseDate', [$request->from_date, $request->to_date]);
|
||||
}
|
||||
})
|
||||
->join('purchase_details', 'purchase_details.id', '=', 'vat_transactions.vatable_id')
|
||||
->selectRaw('purchase_details.purchase_id, vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as total')
|
||||
->groupBy('purchase_details.purchase_id', 'vat_transactions.vat_id')
|
||||
->get()
|
||||
->groupBy('purchase_id')
|
||||
->map(function ($items) {
|
||||
return $items->pluck('total', 'vat_id')->toArray();
|
||||
})
|
||||
->toArray();
|
||||
|
||||
$purchaseReturnVatRows = VatTransaction::where('vat_transactions.business_id', $businessId)
|
||||
->where('vat_transactions.vatable_type', PurchaseReturnDetail::class)
|
||||
|
||||
->join('purchase_return_details','purchase_return_details.id','=','vat_transactions.vatable_id')
|
||||
->join('purchase_details','purchase_details.id','=','purchase_return_details.purchase_detail_id')
|
||||
->join('purchases','purchases.id','=','purchase_details.purchase_id')
|
||||
|
||||
->selectRaw('purchases.id as purchase_id, vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as vat_amount')
|
||||
->groupBy('purchases.id','vat_transactions.vat_id')
|
||||
->get();
|
||||
|
||||
$purchaseReturnVatRowMap = $purchaseReturnVatRows
|
||||
->groupBy('purchase_id')
|
||||
->map(fn($rows) => $rows->pluck('vat_amount','vat_id'))
|
||||
->toArray();
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
'sale_data' => view('business::reports.vats.sale-datas', compact(
|
||||
'sales',
|
||||
'salesVatTotals',
|
||||
'salesReturnVatTotals',
|
||||
'saleVatRowMap',
|
||||
'saleReturnVatRowMap',
|
||||
'vats',
|
||||
'filter_from_date',
|
||||
'filter_to_date',
|
||||
'duration'
|
||||
))->render(),
|
||||
|
||||
'purchase_data' => view('business::reports.vats.purchase-datas', compact(
|
||||
'purchases',
|
||||
'purchasesVatTotals',
|
||||
'purchaseReturnVatTotals',
|
||||
'purchaseVatRowMap',
|
||||
'purchaseReturnVatRowMap',
|
||||
'vats',
|
||||
'filter_from_date',
|
||||
'filter_to_date',
|
||||
'duration'
|
||||
))->render(),
|
||||
'sale_data' => view('business::reports.vats.sale-datas', compact('sales', 'salesVatTotals', 'vats', 'filter_from_date', 'filter_to_date', 'duration'))->render(),
|
||||
'purchase_data' => view('business::reports.vats.purchase-datas', compact('purchases', 'purchasesVatTotals', 'vats', 'filter_from_date', 'filter_to_date', 'duration'))->render(),
|
||||
]);
|
||||
}
|
||||
|
||||
return view('business::reports.vats.index', compact(
|
||||
'sales',
|
||||
'salesVatTotals',
|
||||
'salesReturnVatTotals',
|
||||
'saleVatRowMap',
|
||||
'saleReturnVatRowMap',
|
||||
'purchases',
|
||||
'purchasesVatTotals',
|
||||
'purchaseReturnVatTotals',
|
||||
'purchaseVatRowMap',
|
||||
'purchaseReturnVatRowMap',
|
||||
'vats',
|
||||
'filter_from_date',
|
||||
'filter_to_date',
|
||||
'duration'
|
||||
));
|
||||
return view('business::reports.vats.index', compact('sales', 'salesVatTotals', 'purchases', 'purchasesVatTotals', 'vats', 'filter_from_date', 'filter_to_date', 'duration'));
|
||||
}
|
||||
|
||||
public function exportExcel()
|
||||
public function exportExcel($type = 'all')
|
||||
{
|
||||
return Excel::download(new ExportTaxReport, 'tax-report.xlsx');
|
||||
return $this->exportFile($type, 'vat-report.xlsx');
|
||||
}
|
||||
|
||||
public function exportCsv()
|
||||
public function exportCsv($type = 'all')
|
||||
{
|
||||
return Excel::download(new ExportTaxReport, 'tax-report.csv');
|
||||
return $this->exportFile($type, 'vat-report.csv');
|
||||
}
|
||||
|
||||
public function exportPdf(Request $request)
|
||||
private function exportFile($type, $filename, $format = null)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
$type = $request->type ?? 'sales';
|
||||
|
||||
$duration = $request->custom_days ?: 'today';
|
||||
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
// SALES QUERY
|
||||
$salesQuery = Sale::with('party', 'payment_type', 'transactions')
|
||||
->where('business_id', $businessId);
|
||||
|
||||
$this->applyDateFilter($salesQuery, $duration, 'saleDate', $request->from_date, $request->to_date);
|
||||
|
||||
if ($request->filled('search')) {
|
||||
$search = $request->search;
|
||||
$salesQuery->where(function ($query) use ($search) {
|
||||
$query->where('invoiceNumber', 'like', '%' . $search . '%')
|
||||
->orWhere('totalAmount', 'like', '%' . $search . '%')
|
||||
->orWhere('discountAmount', 'like', '%' . $search . '%')
|
||||
->orWhereHas('party', fn($q) => $q->where('name', 'like', '%' . $search . '%')->orWhere('tax_no', 'like', '%' . $search . '%'));
|
||||
});
|
||||
}
|
||||
|
||||
$salesVatTotals = VatTransaction::where('vat_transactions.business_id', $businessId)
|
||||
->where('vat_transactions.vatable_type', SaleDetails::class)
|
||||
->join('sale_details', 'sale_details.id', '=', 'vat_transactions.vatable_id')
|
||||
->join('sales', 'sales.id', '=', 'sale_details.sale_id')
|
||||
->where('sales.business_id', $businessId)
|
||||
->selectRaw('vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as total')
|
||||
->groupBy('vat_transactions.vat_id')
|
||||
->pluck('total','vat_transactions.vat_id')
|
||||
->toArray();
|
||||
|
||||
$salesReturnVatTotals = VatTransaction::where('vat_transactions.business_id', $businessId)
|
||||
->where('vat_transactions.vatable_type', SaleReturnDetails::class)
|
||||
->join('sale_return_details', 'sale_return_details.id', '=', 'vat_transactions.vatable_id')
|
||||
->join('sale_details', 'sale_details.id', '=', 'sale_return_details.sale_detail_id')
|
||||
->join('sales', 'sales.id', '=', 'sale_details.sale_id')
|
||||
->where('sales.business_id', $businessId)
|
||||
->selectRaw('vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as total')
|
||||
->groupBy('vat_transactions.vat_id')
|
||||
->pluck('total', 'vat_transactions.vat_id')
|
||||
->toArray();
|
||||
|
||||
$saleVatRowMap = VatTransaction::where('business_id', $businessId)
|
||||
->where('vatable_type', \App\Models\SaleDetails::class)
|
||||
->whereIn('vatable_id', function ($query) use ($businessId, $duration, $request) {
|
||||
$query->select('sale_details.id')
|
||||
->from('sale_details')
|
||||
->join('sales', 'sales.id', '=', 'sale_details.sale_id')
|
||||
->where('sales.business_id', $businessId);
|
||||
|
||||
if ($duration === 'custom_days' && $request->from_date && $request->to_date) {
|
||||
$query->whereBetween('sales.saleDate', [$request->from_date, $request->to_date]);
|
||||
}
|
||||
})
|
||||
->join('sale_details', 'sale_details.id', '=', 'vat_transactions.vatable_id')
|
||||
->selectRaw('sale_details.sale_id, vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as total')
|
||||
->groupBy('sale_details.sale_id', 'vat_transactions.vat_id')
|
||||
->get()
|
||||
->groupBy('sale_id')
|
||||
->map(function ($items) {
|
||||
return $items->pluck('total', 'vat_id')->toArray();
|
||||
})
|
||||
->toArray();
|
||||
|
||||
$saleReturnVatRows = VatTransaction::where('vat_transactions.business_id', $businessId)
|
||||
->where('vat_transactions.vatable_type', SaleReturnDetails::class)
|
||||
|
||||
->join('sale_return_details','sale_return_details.id','=','vat_transactions.vatable_id')
|
||||
->join('sale_details','sale_details.id','=','sale_return_details.sale_detail_id')
|
||||
->join('sales','sales.id','=','sale_details.sale_id')
|
||||
|
||||
->selectRaw('sales.id as sale_id, vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as vat_amount')
|
||||
->groupBy('sales.id','vat_transactions.vat_id')
|
||||
->get();
|
||||
|
||||
$saleReturnVatRowMap = $saleReturnVatRows
|
||||
->groupBy('sale_id')
|
||||
->map(fn($rows)=>$rows->pluck('vat_amount','vat_id'))
|
||||
->toArray();
|
||||
|
||||
// PURCHASE QUERY
|
||||
$purchasesQuery = Purchase::with('party', 'payment_type', 'transactions')
|
||||
->where('business_id', $businessId);
|
||||
|
||||
$this->applyDateFilter($purchasesQuery, $duration, 'purchaseDate', $request->from_date, $request->to_date);
|
||||
|
||||
if ($request->filled('search')) {
|
||||
$search = $request->search;
|
||||
$purchasesQuery->where(function ($query) use ($search) {
|
||||
$query->where('invoiceNumber', 'like', '%' . $search . '%')
|
||||
->orWhere('totalAmount', 'like', '%' . $search . '%')
|
||||
->orWhere('discountAmount', 'like', '%' . $search . '%')
|
||||
->orWhereHas('party', fn($q) => $q->where('name', 'like', '%' . $search . '%')->orWhere('tax_no', 'like', '%' . $search . '%'));
|
||||
});
|
||||
}
|
||||
|
||||
$purchasesVatTotals = VatTransaction::where('vat_transactions.business_id', $businessId)
|
||||
->where('vat_transactions.vatable_type', \App\Models\PurchaseDetails::class)
|
||||
->join('purchase_details', 'purchase_details.id', '=', 'vat_transactions.vatable_id')
|
||||
->join('purchases', 'purchases.id', '=', 'purchase_details.purchase_id')
|
||||
->where('purchases.business_id', $businessId)
|
||||
->selectRaw('vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as total')
|
||||
->groupBy('vat_transactions.vat_id')
|
||||
->pluck('total','vat_transactions.vat_id')
|
||||
->toArray();
|
||||
|
||||
|
||||
$purchaseReturnVatTotals = VatTransaction::where('vat_transactions.business_id', $businessId)
|
||||
->where('vat_transactions.vatable_type', PurchaseReturnDetail::class)
|
||||
->join('purchase_return_details', 'purchase_return_details.id', '=', 'vat_transactions.vatable_id')
|
||||
->join('purchase_details', 'purchase_details.id', '=', 'purchase_return_details.purchase_detail_id')
|
||||
->join('purchases', 'purchases.id', '=', 'purchase_details.purchase_id')
|
||||
->where('purchases.business_id', $businessId)
|
||||
->selectRaw('vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as total')
|
||||
->groupBy('vat_transactions.vat_id')
|
||||
->pluck('total', 'vat_transactions.vat_id')
|
||||
->toArray();
|
||||
|
||||
$purchaseVatRowMap = VatTransaction::where('business_id', $businessId)
|
||||
->where('vatable_type', \App\Models\PurchaseDetails::class)
|
||||
->whereIn('vatable_id', function ($query) use ($businessId, $duration, $request) {
|
||||
$query->select('purchase_details.id')
|
||||
->from('purchase_details')
|
||||
->join('purchases', 'purchases.id', '=', 'purchase_details.purchase_id')
|
||||
->where('purchases.business_id', $businessId);
|
||||
|
||||
if ($duration === 'custom_date' && $request->from_date && $request->to_date) {
|
||||
$query->whereBetween('purchases.purchaseDate', [$request->from_date, $request->to_date]);
|
||||
}
|
||||
})
|
||||
->join('purchase_details', 'purchase_details.id', '=', 'vat_transactions.vatable_id')
|
||||
->selectRaw('purchase_details.purchase_id, vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as total')
|
||||
->groupBy('purchase_details.purchase_id', 'vat_transactions.vat_id')
|
||||
->get()
|
||||
->groupBy('purchase_id')
|
||||
->map(function ($items) {
|
||||
return $items->pluck('total', 'vat_id')->toArray();
|
||||
})
|
||||
->toArray();
|
||||
|
||||
$purchaseReturnVatRows = VatTransaction::where('vat_transactions.business_id', $businessId)
|
||||
->where('vat_transactions.vatable_type', PurchaseReturnDetail::class)
|
||||
|
||||
->join('purchase_return_details','purchase_return_details.id','=','vat_transactions.vatable_id')
|
||||
->join('purchase_details','purchase_details.id','=','purchase_return_details.purchase_detail_id')
|
||||
->join('purchases','purchases.id','=','purchase_details.purchase_id')
|
||||
|
||||
->selectRaw('purchases.id as purchase_id, vat_transactions.vat_id, SUM(vat_transactions.vat_amount) as vat_amount')
|
||||
->groupBy('purchases.id','vat_transactions.vat_id')
|
||||
->get();
|
||||
|
||||
$purchaseReturnVatRowMap = $purchaseReturnVatRows
|
||||
->groupBy('purchase_id')
|
||||
->map(fn($rows) => $rows->pluck('vat_amount','vat_id'))
|
||||
->toArray();
|
||||
|
||||
// TAB CONTROL
|
||||
$sales = collect();
|
||||
$purchases = collect();
|
||||
|
||||
$limit = $request->per_page ?? 20;
|
||||
|
||||
if ($type === 'sales') {
|
||||
$sales = $salesQuery->latest()->limit($limit)->get();
|
||||
if ($type === 'sales' || $type === 'all') {
|
||||
$sales = Sale::with('user:id,name', 'party:id,name,email,phone,type', 'payment_type:id,name', 'transactions')
|
||||
->where('business_id', $businessId)
|
||||
->where('vat_amount', '>', 0)
|
||||
->latest()
|
||||
->get();
|
||||
}
|
||||
|
||||
if ($type === 'purchases') {
|
||||
$purchases = $purchasesQuery->latest()->limit($limit)->get();
|
||||
if ($type === 'purchases' || $type === 'all') {
|
||||
$purchases = Purchase::with('details', 'party', 'details.product', 'details.product.category', 'payment_type:id,name', 'transactions')
|
||||
->where('business_id', $businessId)
|
||||
->where('vat_amount', '>', 0)
|
||||
->latest()
|
||||
->get();
|
||||
}
|
||||
|
||||
$vats = Vat::where('business_id', $businessId)->get();
|
||||
|
||||
return PdfService::render('business::reports.vats.pdf',
|
||||
compact(
|
||||
'sales',
|
||||
'salesVatTotals',
|
||||
'salesReturnVatTotals',
|
||||
'saleVatRowMap',
|
||||
'saleReturnVatRowMap',
|
||||
'purchases',
|
||||
'purchasesVatTotals',
|
||||
'purchaseReturnVatTotals',
|
||||
'purchaseVatRowMap',
|
||||
'purchaseReturnVatRowMap',
|
||||
'vats',
|
||||
'type',
|
||||
'filter_from_date',
|
||||
'filter_to_date',
|
||||
'duration'
|
||||
), 'tax-report.pdf', 'A4', 'L'
|
||||
);
|
||||
$salesVatTotals = [];
|
||||
foreach ($vats as $vat) {
|
||||
$salesVatTotals[$vat->id] = $sales->where('vat_id', $vat->id)->sum('vat_amount');
|
||||
}
|
||||
|
||||
$purchasesVatTotals = [];
|
||||
foreach ($vats as $vat) {
|
||||
$purchasesVatTotals[$vat->id] = $purchases->where('vat_id', $vat->id)->sum('vat_amount');
|
||||
}
|
||||
|
||||
$export = new ExportVatReport($sales, $purchases, $vats, $salesVatTotals, $purchasesVatTotals);
|
||||
|
||||
return Excel::download($export, $filename, $format);
|
||||
}
|
||||
|
||||
public function exportPdf($type = 'all')
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
|
||||
$sales = collect();
|
||||
$purchases = collect();
|
||||
|
||||
if ($type === 'sales' || $type === 'all') {
|
||||
$sales = Sale::with('party', 'payment_type')
|
||||
->where('business_id', $businessId)
|
||||
->where('vat_amount', '>', 0)
|
||||
->latest()
|
||||
->get();
|
||||
}
|
||||
|
||||
if ($type === 'purchases' || $type === 'all') {
|
||||
$purchases = Purchase::with('party', 'payment_type')
|
||||
->where('business_id', $businessId)
|
||||
->where('vat_amount', '>', 0)
|
||||
->latest()
|
||||
->get();
|
||||
}
|
||||
|
||||
$vats = Vat::where('business_id', $businessId)->get();
|
||||
|
||||
$salesVatTotals = [];
|
||||
foreach ($vats as $vat) {
|
||||
$salesVatTotals[$vat->id] = $sales->where('vat_id', $vat->id)->sum('vat_amount');
|
||||
}
|
||||
|
||||
$purchasesVatTotals = [];
|
||||
foreach ($vats as $vat) {
|
||||
$purchasesVatTotals[$vat->id] = $purchases->where('vat_id', $vat->id)->sum('vat_amount');
|
||||
}
|
||||
|
||||
return PdfService::render('business::reports.vats.pdf', compact('sales', 'salesVatTotals', 'purchases', 'purchasesVatTotals', 'vats', 'type'),'vats-report.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
use App\Models\PurchaseReturnDetail;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
|
||||
@@ -76,17 +76,17 @@
|
||||
<div class="table-top-btn-group d-print-none p-2">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.balance-sheet.excel') }}">
|
||||
<a href="{{ route('business.balance-sheet.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.balance-sheet.csv') }}">
|
||||
<a href="{{ route('business.balance-sheet.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.balance-sheet.pdf') }}">
|
||||
<a target="blank" href="{{ route('business.balance-sheet.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -6,19 +6,6 @@
|
||||
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;">
|
||||
{{ __('Balance Sheet Report') }}
|
||||
</h4>
|
||||
@if ($filter_from_date && $filter_to_date)
|
||||
<p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration:') }}
|
||||
@if ($duration === 'today')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@elseif ($duration === 'yesterday')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@else
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
{{ __('to') }}
|
||||
{{ Carbon\Carbon::parse($filter_to_date)->format('d-m-Y') }}
|
||||
@endif
|
||||
</p>
|
||||
@endif
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Button -->
|
||||
<div><span class="more-field-btn">+ {{__('Add More Fields')}}</span></div>
|
||||
<div><span class="more-field-btn">{{__('+ Add more fields')}}</span></div>
|
||||
<div class="form-check mt-2">
|
||||
<input type="hidden" name="show_in_invoice" value="0">
|
||||
<input type="checkbox" name="show_in_invoice" class="form-check-input multi-delete" id="bankDetails" value="1">
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Button -->
|
||||
<div><span class="more-field-btn">+ {{__('Add More Fields')}}</span></div>
|
||||
<div><span class="more-field-btn">{{__('+ Add more fields')}}</span></div>
|
||||
<div class="form-check mt-2">
|
||||
<input type="hidden" name="show_in_invoice" value="0">
|
||||
<input type="checkbox" name="show_in_invoice" id="show_in_invoice" class="form-check-input multi-delete" value="1">
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
@csrf
|
||||
<label>{{ __('Select Product') }}</label>
|
||||
<div class="search-container">
|
||||
<input type="text" id="product-search" placeholder="{{__('Search...')}}" class="form-control" />
|
||||
<input type="text" id="product-search" placeholder="Search..." class="form-control" />
|
||||
<ul id="search-results" class="barcode-dropdown search-hidden"></ul>
|
||||
</div>
|
||||
<div class="table-responsive mt-3 barcode-table">
|
||||
|
||||
@@ -110,17 +110,17 @@
|
||||
<div class="table-top-btn-group d-print-none p-2">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.bill-wise-profits.csv') }}">
|
||||
<a href="{{ route('business.bill-wise-profits.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.bill-wise-profits.excel') }}">
|
||||
<a href="{{ route('business.bill-wise-profits.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.bill-wise-profits.pdf') }}">
|
||||
<a target="blank" href="{{ route('business.bill-wise-profits.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -4,19 +4,7 @@
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Bill Wise Profit & Loss') }}</h4>
|
||||
@if ($filter_from_date && $filter_to_date)
|
||||
<p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration:') }}
|
||||
@if ($duration === 'today')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@elseif ($duration === 'yesterday')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@else
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
{{ __('to') }}
|
||||
{{ Carbon\Carbon::parse($filter_to_date)->format('d-m-Y') }}
|
||||
@endif
|
||||
</p>
|
||||
@endif
|
||||
{{-- <p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration: 14-12-2025 to 24-12-2025') }}</p> --}}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -20,21 +20,13 @@ class="ajaxform_instant_reload">
|
||||
|
||||
<div class="col-lg-12">
|
||||
<label>{{ __('Icon') }}</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 Icon') }}</span>
|
||||
<div class="border rounded upload-img-container">
|
||||
<label class="upload-v4">
|
||||
<div class="img-wrp">
|
||||
<img src="{{ asset('assets/images/icons/upload-icon.svg') }}" alt="Brand" id="brand-img">
|
||||
</div>
|
||||
|
||||
<!-- Preview image -->
|
||||
<img class="preview-image d-none" id="image" src="" alt="Preview">
|
||||
<input type="file" name="icon" class="preview-image-input" data-id="#image" accept="image/*">
|
||||
</div>
|
||||
<input type="file" name="icon" class="d-none" onchange="document.getElementById('brand-img').src = window.URL.createObjectURL(this.files[0])" accept="image/*">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class="table-product-img">
|
||||
<a href="#brand-edit-modal" data-bs-toggle="modal" class="brand-edit-btn"
|
||||
data-url="{{ route('business.brands.update', $brand->id) }}"
|
||||
data-brands-name="{{ $brand->brandName }}"
|
||||
data-brands-icon="{{ asset($brand->icon) }}"
|
||||
data-brands-icon="{{ asset($brand->icon ?? 'assets/images/icons/upload-icon.svg') }}"
|
||||
data-brands-description="{{ $brand->description }}"><i
|
||||
class="fal fa-pencil-alt"></i>{{ __('Edit') }}</a>
|
||||
@endusercan
|
||||
|
||||
@@ -20,21 +20,13 @@ class="ajaxform_instant_reload brandUpdateForm">
|
||||
|
||||
<div class="col-lg-12 mb-2">
|
||||
<label>{{ __("Icon") }}</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 Icon') }}</span>
|
||||
<div class="border rounded upload-img-container">
|
||||
<label class="upload-v4">
|
||||
<div class="img-wrp">
|
||||
<img src="" alt="user" id="edit_icon">
|
||||
</div>
|
||||
|
||||
<!-- Preview image -->
|
||||
<img class="preview-image d-none" id="edit_icon" src="" alt="Preview">
|
||||
<input type="file" name="icon" class="preview-image-input" data-id="#edit_icon" accept="image/*">
|
||||
</div>
|
||||
<input type="file" name="icon" class="d-none" onchange="document.getElementById('edit_icon').src = window.URL.createObjectURL(this.files[0])" accept="image/*">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -9,33 +9,22 @@
|
||||
<div class="container-fluid">
|
||||
<div class="border-0">
|
||||
<div class="card-bodys">
|
||||
<form action="{{ route('business.bulk-uploads.store') }}" method="post" enctype="multipart/form-data" class="ajaxform_instant_reload">
|
||||
<form action="{{ route('business.bulk-uploads.store') }}" method="post" enctype="multipart/form-data"
|
||||
class="ajaxform_instant_reload">
|
||||
<div class="bulk-upload-container">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-lg-6">
|
||||
<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 class="d-flex justify-content-between align-items-center ">
|
||||
<div class="bulk-input">
|
||||
<input class="form-control" type="file" name="file" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex align-items-center justify-content-between mt-3">
|
||||
<div class="d-flex align-items-center justify-content-between">
|
||||
@usercan('bulk-uploads.create')
|
||||
<button type="submit" class="add-order-btn rounded-2 border-0 submit-btn">{{ __('Submit') }}</button>
|
||||
<button type="submit" class="add-order-btn rounded-2 border-0 submit-btn mt-3">{{__('Submit')}}</button>
|
||||
@endusercan
|
||||
|
||||
<a href="{{ asset('assets/bulk-products-upload.xlsx') }}" download class="download-file-btn">
|
||||
<i class="fas fa-download"></i> {{ __('Download File') }}
|
||||
<a href="{{ asset('assets/bulk-products-upload.xlsx') }}"
|
||||
download="bulk-products-upload.xlsx"
|
||||
class="download-file-btn mt-3">
|
||||
<i class="fas fa-download"></i> {{__('Download File')}}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -60,11 +60,11 @@
|
||||
<td class="text-start d-print-none">{{ ucwords(str_replace('_', ' ', $cash_flow->platform)) }}</td>
|
||||
|
||||
<td class="text-center {{ $cash_flow->type === 'credit' ? 'text-success' : '' }}">
|
||||
{{ $cash_flow->type === 'credit' ? currency_format($cash_flow->amount, currency: business_currency()) : currency_format(0) }}
|
||||
{{ $cash_flow->type === 'credit' ? currency_format($cash_flow->amount, currency: business_currency()) : currency_format(0, currency: business_currency()) }}
|
||||
</td>
|
||||
|
||||
<td class="text-center {{ $cash_flow->type === 'debit' ? 'text-danger' : '' }}">
|
||||
{{ $cash_flow->type === 'debit' ? currency_format($cash_flow->amount, currency: business_currency()) : currency_format(0) }}
|
||||
{{ $cash_flow->type === 'debit' ? currency_format($cash_flow->amount, currency: business_currency()) : currency_format(0, currency: business_currency()) }}
|
||||
</td>
|
||||
|
||||
<td class="text-center {{ $runningCash < 0 ? 'text-danger' : 'text-success' }}">
|
||||
@@ -92,8 +92,10 @@
|
||||
<td class="d-print-none"></td>
|
||||
<td></td>
|
||||
<td class="d-print-none text-start"></td>
|
||||
<td class="text-center text-success">{{ currency_format($page_cash_in, currency: business_currency()) }}</td>
|
||||
<td class="text-center text-danger">{{ currency_format($page_cash_out, currency: business_currency()) }}</td>
|
||||
<td class="text-center text-success">{{ currency_format($page_cash_in, currency: business_currency()) }}
|
||||
</td>
|
||||
<td class="text-center text-danger">{{ currency_format($page_cash_out, currency: business_currency()) }}
|
||||
</td>
|
||||
<td class="text-center {{ $page_running_cash < 0 ? 'text-danger' : 'text-success' }}">
|
||||
{{ currency_format($page_running_cash, currency: business_currency()) }}
|
||||
</td>
|
||||
|
||||
@@ -44,15 +44,17 @@
|
||||
<td class="text-start">{{ ucwords(str_replace('_', ' ', $cash_flow->platform)) }}</td>
|
||||
|
||||
@if ($cash_flow->type === 'credit')
|
||||
<td class="text-start text-success">{{ currency_format($cash_flow->amount, currency: business_currency()) }}</td>
|
||||
<td class="text-start text-success">{{ currency_format($cash_flow->amount, currency: business_currency()) }}
|
||||
</td>
|
||||
@else
|
||||
<td class="text-start">{{ currency_format(0) }}</td>
|
||||
<td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
|
||||
@endif
|
||||
|
||||
@if ($cash_flow->type === 'debit')
|
||||
<td class="text-start text-danger">{{ currency_format($cash_flow->amount, currency: business_currency()) }}</td>
|
||||
<td class="text-start text-danger">{{ currency_format($cash_flow->amount, currency: business_currency()) }}
|
||||
</td>
|
||||
@else
|
||||
<td class="text-start">{{ currency_format(0) }}</td>
|
||||
<td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
|
||||
@endif
|
||||
|
||||
<td class="text-start {{ $runningCash < 0 ? 'text-danger' : 'text-success' }}">
|
||||
@@ -81,8 +83,10 @@
|
||||
<td class="d-print-none"></td>
|
||||
<td></td>
|
||||
<td class="d-print-none text-start"></td>
|
||||
<td class="text-center text-success">{{ currency_format($page_cash_in, currency: business_currency()) }}</td>
|
||||
<td class="text-center text-danger">{{ currency_format($page_cash_out, currency: business_currency()) }}</td>
|
||||
<td class="text-center text-success">{{ currency_format($page_cash_in, currency: business_currency()) }}
|
||||
</td>
|
||||
<td class="text-center text-danger">{{ currency_format($page_cash_out, currency: business_currency()) }}
|
||||
</td>
|
||||
<td class="text-center {{ $page_running_cash < 0 ? 'text-danger' : 'text-success' }}">
|
||||
{{ currency_format($page_running_cash, currency: business_currency()) }}
|
||||
</td>
|
||||
|
||||
@@ -23,19 +23,19 @@
|
||||
<div class="col-lg-2 col-md-6">
|
||||
<div class="profit-card p-3 m-2 text-white">
|
||||
<p class="stat-title">{{ __('Cash In') }}</p>
|
||||
<p class="stat-value" id="cashflow_cash_in">{{ currency_format($cashflow_cash_in, 'icon', 2, business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format($total_cash_in, 'icon', 2, business_currency()) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-6 ">
|
||||
<div class="sales-card p-3 m-2 text-white">
|
||||
<p class="stat-title">{{ __('Cash Out') }}</p>
|
||||
<p class="stat-value" id="cashflow_cash_out">{{ currency_format($cashflow_cash_out, 'icon', 2, business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format($total_cash_out, 'icon', 2, business_currency()) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-12 ">
|
||||
<div class="loss-card p-3 m-2 text-white">
|
||||
<p class="stat-title">{{ __('Running Cash') }}</p>
|
||||
<p class="stat-value" id="total_running_cash">{{ currency_format($total_running_cash, 'icon', 2, business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format($total_running_cash, 'icon', 2, business_currency()) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -114,17 +114,17 @@
|
||||
<div class="table-top-btn-group d-print-none p-2">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.cash-flow-reports.csv') }}">
|
||||
<a href="{{ route('business.cash-flow-reports.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.cash-flow-reports.excel') }}">
|
||||
<a href="{{ route('business.cash-flow-reports.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.cash-flow-reports.pdf') }}">
|
||||
<a target="blank" href="{{ route('business.cash-flow-reports.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -1,27 +1,15 @@
|
||||
@extends('layouts.business.pdf.pdf_layout')
|
||||
|
||||
@section('pdf_title')
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;">{{ __('Cash Flow Report List') }}</h4>
|
||||
@if ($filter_from_date && $filter_to_date)
|
||||
<p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration:') }}
|
||||
@if ($duration === 'today')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@elseif ($duration === 'yesterday')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@else
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
{{ __('to') }}
|
||||
{{ Carbon\Carbon::parse($filter_to_date)->format('d-m-Y') }}
|
||||
@endif
|
||||
</p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;">{{ __('Cash Flow Report List') }}</h4>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('pdf_content')
|
||||
<table width="100%" cellpadding="6" cellspacing="0" style="border-collapse: collapse; border: 1px solid gainsboro; font-size:12px;">
|
||||
<table width="100%" cellpadding="6" cellspacing="0"
|
||||
style="border-collapse: collapse; border: 1px solid gainsboro; font-size:12px;">
|
||||
<thead>
|
||||
<tr style="background-color: #C52127; color: white;">
|
||||
<th style="border:1px solid gainsboro; color:white;" class="text-start">{{ __('Date') }}</th>
|
||||
@@ -48,30 +36,39 @@
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ $cash_flow->invoice_no }}</td>
|
||||
|
||||
@if ($cash_flow->platform == 'sale')
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ $cash_flow->sale?->party?->name ?? 'Guest' }}</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ $cash_flow->sale?->party?->name ?? 'Guest' }}
|
||||
</td>
|
||||
@elseif ($cash_flow->platform == 'sale_return')
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ $cash_flow->saleReturn?->sale?->party?->name ?? 'Guest' }}</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">
|
||||
{{ $cash_flow->saleReturn?->sale?->party?->name ?? 'Guest' }}</td>
|
||||
@elseif ($cash_flow->platform == 'purchase')
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ $cash_flow->purchase?->party?->name ?? 'Guest' }}</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">
|
||||
{{ $cash_flow->purchase?->party?->name ?? 'Guest' }}</td>
|
||||
@elseif ($cash_flow->platform == 'purchase_return')
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ $cash_flow->purchaseReturn?->purchase?->party?->name ?? 'Guest' }}</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">
|
||||
{{ $cash_flow->purchaseReturn?->purchase?->party?->name ?? 'Guest' }}</td>
|
||||
@elseif ($cash_flow->platform == 'due_collect' || $cash_flow->platform == 'due_pay')
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ $cash_flow->dueCollect?->party?->name ?? 'Guest' }}</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">
|
||||
{{ $cash_flow->dueCollect?->party?->name ?? 'Guest' }}</td>
|
||||
@else
|
||||
<td style="border:1px solid gainsboro; text-align:center;">N/A</td>
|
||||
@endif
|
||||
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ ucwords(str_replace('_', ' ', $cash_flow->platform)) }}</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">
|
||||
{{ ucwords(str_replace('_', ' ', $cash_flow->platform)) }}</td>
|
||||
|
||||
<td style="border:1px solid gainsboro; text-align:center; {{ $cash_flow->type === 'credit' ? 'color:green;' : '' }}">
|
||||
{{ $cash_flow->type === 'credit' ? currency_format($cash_flow->amount, currency: business_currency()) : currency_format(0) }}
|
||||
<td
|
||||
style="border:1px solid gainsboro; text-align:center; {{ $cash_flow->type === 'credit' ? 'color:green;' : '' }}">
|
||||
{{ $cash_flow->type === 'credit' ? currency_format($cash_flow->amount, currency: business_currency()) : currency_format(0, currency: business_currency()) }}
|
||||
</td>
|
||||
|
||||
<td style="border:1px solid gainsboro; text-align:center; {{ $cash_flow->type === 'debit' ? 'color:red;' : '' }}">
|
||||
{{ $cash_flow->type === 'debit' ? currency_format($cash_flow->amount, currency: business_currency()) : currency_format(0) }}
|
||||
<td
|
||||
style="border:1px solid gainsboro; text-align:center; {{ $cash_flow->type === 'debit' ? 'color:red;' : '' }}">
|
||||
{{ $cash_flow->type === 'debit' ? currency_format($cash_flow->amount, currency: business_currency()) : currency_format(0, currency: business_currency()) }}
|
||||
</td>
|
||||
|
||||
<td style="border:1px solid gainsboro; text-align:center; {{ $runningCash < 0 ? 'color:red;' : 'color:green;' }}">
|
||||
<td
|
||||
style="border:1px solid gainsboro; text-align:center; {{ $runningCash < 0 ? 'color:red;' : 'color:green;' }}">
|
||||
{{ currency_format($runningCash, currency: business_currency()) }}
|
||||
</td>
|
||||
</tr>
|
||||
@@ -87,7 +84,8 @@
|
||||
@if ($cash_flows->count() > 0)
|
||||
<tfoot>
|
||||
<tr style="background-color:#C52127; color:white; font-weight:bold;">
|
||||
<td style="border:1px solid gainsboro; text-align:center; color: white; font-weight: 600;">{{__('Total')}}</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center; color: white; font-weight: 600;">{{__('Total')}}
|
||||
</td>
|
||||
<td style="border:1px solid gainsboro;"></td>
|
||||
<td style="border:1px solid gainsboro;"></td>
|
||||
<td style="border:1px solid gainsboro;"></td>
|
||||
|
||||
@@ -1,23 +1,8 @@
|
||||
@if ($filter_from_date && $filter_to_date)
|
||||
<div class="mb-2 text-center fw-bold duration-display">
|
||||
<strong>{{ __('Duration:') }}</strong>
|
||||
@if ($duration === 'today')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@elseif ($duration === 'yesterday')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@else
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
{{ __('to') }}
|
||||
{{ Carbon\Carbon::parse($filter_to_date)->format('d-m-Y') }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="responsive-table m-0">
|
||||
<table class="table" id="datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-60 d-print-none">
|
||||
<th class="w-60">
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<input type="checkbox" class="select-all-delete multi-delete">
|
||||
</div>
|
||||
@@ -28,16 +13,15 @@
|
||||
<th>{{ __('Payment') }}</th>
|
||||
<th>{{ __('Name') }}</th>
|
||||
<th>{{ __('Amount') }}</th>
|
||||
<th class="text-center d-print-none">{{ __('Action') }}</th>
|
||||
<th class="text-center">{{ __('Action') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($cashes as $cash)
|
||||
<tr>
|
||||
<td class="w-60 checkbox d-print-none">
|
||||
@if($cash->platform === 'cash' && in_array($cash->transaction_type, ['cash_to_bank','adjust_cash']))
|
||||
<input type="checkbox" name="ids[]" class="delete-checkbox-item multi-delete" value="{{ $cash->id }}">
|
||||
@endif
|
||||
<td class="w-60 checkbox">
|
||||
<input type="checkbox" name="ids[]" class="delete-checkbox-item multi-delete"
|
||||
value="{{ $cash->id }}">
|
||||
</td>
|
||||
|
||||
<td>{{ ($cashes->currentPage() - 1) * $cashes->perPage() + $loop->iteration }}</td>
|
||||
@@ -55,7 +39,7 @@
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div class="dropdown table-action d-print-none">
|
||||
<div class="dropdown table-action">
|
||||
<button type="button" data-bs-toggle="dropdown">
|
||||
<i class="far fa-ellipsis-v"></i>
|
||||
</button>
|
||||
@@ -116,10 +100,10 @@
|
||||
$editConfig = ['url' => route('business.sales.index')];
|
||||
} elseif ($cash->platform === 'purchase') {
|
||||
$editConfig = ['url' => route('business.purchases.index')];
|
||||
} elseif ($cash->platform === 'income') {
|
||||
$editConfig = ['url' => route('business.incomes.index')];
|
||||
}elseif ($cash->platform === 'expense') {
|
||||
$editConfig = ['url' => route('business.expenses.index')];
|
||||
} elseif ($cash->platform === 'income' && $cash->reference_id) {
|
||||
$editConfig = ['url' => route('business.incomes.edit', $cash->reference_id)];
|
||||
}elseif ($cash->platform === 'expense' && $cash->reference_id) {
|
||||
$editConfig = ['url' => route('business.expenses.edit', $cash->reference_id)];
|
||||
}elseif ($cash->platform === 'sale_return') {
|
||||
$editConfig = ['url' => route('business.sale-returns.index')];
|
||||
}elseif ($cash->platform === 'purchase_return') {
|
||||
@@ -154,14 +138,12 @@
|
||||
|
||||
{{-- Delete --}}
|
||||
@usercan('cashes.delete')
|
||||
@if($cash->platform === 'cash' && in_array($cash->transaction_type, ['cash_to_bank','adjust_cash']))
|
||||
<li>
|
||||
<a href="{{ route('business.cashes.destroy', $cash->id) }}"
|
||||
class="confirm-action" data-method="DELETE">
|
||||
<i class="fal fa-trash-alt"></i> {{ __('Delete') }}
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
@endusercan
|
||||
|
||||
</ul>
|
||||
@@ -173,6 +155,6 @@ class="confirm-action" data-method="DELETE">
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="d-print-none">
|
||||
<div>
|
||||
{{ $cashes->links('vendor.pagination.bootstrap-5') }}
|
||||
</div>
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
<div class="col-lg-2 col-md-6 ">
|
||||
<div class="profit-card p-3 m-2 text-white">
|
||||
<p class="stat-title">{{ __('Balance') }}</p>
|
||||
<p class="stat-value" id="cash_balance">{{ currency_format($cash_balance, 'icon', 2, business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format(cash_balance(), 'icon', 2, business_currency()) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-header p-16 d-print-none">
|
||||
<div class="table-header p-16">
|
||||
<h4>{{ __('Cash In Hand') }}</h4>
|
||||
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
@@ -35,14 +35,8 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 class="mt-2">{{ __('Cash In Hand') }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="table-top-form p-16-0">
|
||||
<form action="{{ route('business.cashes.index') }}" method="GET" class="report-filter-form d-print-none" table="#cashes-data">
|
||||
<form action="{{ route('business.cashes.index') }}" method="GET" class="filter-form" table="#cashes-data">
|
||||
|
||||
<div class="table-top-left d-flex gap-3 margin-l-16">
|
||||
<div class="gpt-up-down-arrow position-relative">
|
||||
@@ -98,30 +92,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="table-top-btn-group d-print-none me-2">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" class="export-btn" href="{{ route('business.cashes.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" class="export-btn" href="{{ route('business.cashes.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" class="export-btn" target="_blank" href="{{ route('business.cashes.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a onclick="window.print()" class="print-window">
|
||||
<img src="{{ asset('assets/images/logo/printer.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -18,21 +18,13 @@
|
||||
|
||||
<div class="mt-3 col-lg-12">
|
||||
<label>{{ __('Icon') }}</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 Icon') }}</span>
|
||||
<div class="border rounded upload-img-container">
|
||||
<label class="upload-v4">
|
||||
<div class="img-wrp">
|
||||
<img src="{{ asset('assets/images/icons/upload-icon.svg') }}" alt="Brand" id="brand-img">
|
||||
</div>
|
||||
|
||||
<!-- Preview image -->
|
||||
<img class="preview-image d-none" id="image" src="" alt="Preview">
|
||||
<input type="file" name="icon" class="preview-image-input" data-id="#image" accept="image/*">
|
||||
</div>
|
||||
<input type="file" name="icon" class="d-none" onchange="document.getElementById('brand-img').src = window.URL.createObjectURL(this.files[0])" accept="image/*">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class="table-product-img">
|
||||
<a href="#category-edit-modal" class="category-edit-btn" data-bs-toggle="modal"
|
||||
data-url="{{ route('business.categories.update', $category->id) }}"
|
||||
data-category-name="{{ $category->categoryName }}"
|
||||
data-category-icon="{{ $category->icon ? asset($category->icon) : '' }}">
|
||||
data-category-icon="{{ asset($category->icon ?? 'assets/images/icons/upload-icon.svg') }}">
|
||||
<i class="fal fa-pencil-alt"></i>{{ __('Edit') }}
|
||||
</a>
|
||||
@endusercan
|
||||
|
||||
@@ -18,21 +18,13 @@ class="ajaxform_instant_reload categoryEditForm">
|
||||
</div>
|
||||
<div class="col-lg-12 mb-2">
|
||||
<label>{{ __("Icon") }}</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 Icon') }}</span>
|
||||
<div class="border rounded upload-img-container">
|
||||
<label class="upload-v4">
|
||||
<div class="img-wrp">
|
||||
<img src="" alt="user" id="category_icon">
|
||||
</div>
|
||||
|
||||
<!-- Preview image -->
|
||||
<img class="preview-image d-none" id="category_icon" src="" alt="Preview">
|
||||
<input type="file" name="icon" class="preview-image-input" data-id="#category_icon" accept="image/*">
|
||||
</div>
|
||||
<input type="file" name="icon" class="d-none" onchange="document.getElementById('category_icon').src = window.URL.createObjectURL(this.files[0])" accept="image/*">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class="filter-form" table="#set-commission-data">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a target="_blank" href="{{ route('business.balance-sheet.pdf') }}">
|
||||
<a target="blank" href="{{ route('business.balance-sheet.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -4,29 +4,28 @@
|
||||
|
||||
{{-- Check only for Sale, Income & Due collect --}}
|
||||
@if(!in_array($context ?? '', ['purchase', 'expense', 'due_pay']))
|
||||
<option value="cheque">{{ __('Cheque') }}</option>
|
||||
<option value="cheque">{{ __('Cheque') }}</option>
|
||||
@endif
|
||||
|
||||
{{-- Wallet only for Sale, Purchase, Due (party exist) --}}
|
||||
@if(!in_array($context ?? '', ['income', 'expense', 'guest_due']))
|
||||
<option value="wallet">{{ __('Wallet') }}</option>
|
||||
<option value="wallet">{{ __('Wallet') }}</option>
|
||||
@endif
|
||||
|
||||
@foreach ($payment_types as $type)
|
||||
<option value="{{ $type->id }}">{{ $type->name }}</option>
|
||||
<option value="{{ $type->id }}">{{ $type->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
{{-- hidden cheque input field --}}
|
||||
<div class="cheque-input mt-2 d-none" disabled>
|
||||
<input type="text" name="payments[main][cheque_number]" class="form-control" placeholder="Enter Cheque Number" disabled>
|
||||
<input type="text" name="payments[main][cheque_number]" class="form-control" placeholder="Enter Cheque Number"
|
||||
disabled>
|
||||
</div>
|
||||
|
||||
{{-- Dynamic payments (optional data for edit) --}}
|
||||
<div class="payment-main-container"
|
||||
@if(!empty($transactions))
|
||||
data-existing-transactions='@json($transactions)'
|
||||
@endif>
|
||||
<div class="payment-main-container" @if(!empty($transactions)) data-existing-transactions='@json($transactions)'
|
||||
data-change-amount="{{ $sale->change_amount ?? 0 }}" @endif>
|
||||
{{-- Dynamic payments will appear here --}}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -267,8 +267,8 @@
|
||||
|
||||
<div class=" tab-table-container">
|
||||
<div class="custom-tabs">
|
||||
<button class="tab-item active" data-tab="sales">{{ __('Recent Sales') }}</button>
|
||||
<button class="tab-item" data-tab="purchase">{{ __('Recent Purchase') }}</button>
|
||||
<button class="tab-item active" onclick="showTab('sales')">{{ __('Recent Sales') }}</button>
|
||||
<button class="tab-item" onclick="showTab('purchase')">{{ __('Recent Purchase') }}</button>
|
||||
</div>
|
||||
<div id="sales" class="tab-content dashboard-tab active">
|
||||
<div class="table-container">
|
||||
@@ -305,7 +305,7 @@
|
||||
<tr>
|
||||
<th class="text-start" scope="col">{{ __("Date") }}</th>
|
||||
<th class="text-center" scope="col">{{ __("Invoice") }}</th>
|
||||
<th class="text-center" scope="col">{{ __("Supplier") }}</th>
|
||||
<th class="text-center" scope="col">{{ __("Customer") }}</th>
|
||||
<th class="text-center" scope="col">{{ __("Total") }}</th>
|
||||
<th class="text-center" scope="col">{{ __("Paid") }}</th>
|
||||
<th class="text-center pr-3" scope="col">{{ __("Due") }}</th>
|
||||
|
||||
@@ -69,10 +69,11 @@
|
||||
@endphp
|
||||
<td class="text-start">{{ currency_format($total_amount, currency: business_currency()) }}</td>
|
||||
<td class="text-start {{ $day_book->type === 'credit' ? 'text-success' : '' }}">
|
||||
{{ $day_book->type === 'credit' ? currency_format($day_book->amount, currency: business_currency()) : currency_format(0) }}
|
||||
{{ $day_book->type === 'credit' ? currency_format($total_amount, currency: business_currency()) : currency_format(0, currency: business_currency()) }}
|
||||
</td>
|
||||
|
||||
<td class="text-start {{ $day_book->type === 'debit' ? 'text-danger' : '' }}">
|
||||
{{ $day_book->type === 'debit' ? currency_format($day_book->amount, currency: business_currency()) : currency_format(0) }}
|
||||
{{ $day_book->type === 'debit' ? currency_format($day_book->amount, currency: business_currency()) : currency_format(0, currency: business_currency()) }}
|
||||
</td>
|
||||
<td class="text-start">
|
||||
{{ $day_book->payment_type_id ? $day_book->paymentType?->name : ucfirst(explode('_', $day_book->transaction_type)[0]) }}
|
||||
@@ -115,6 +116,17 @@
|
||||
};
|
||||
});
|
||||
|
||||
$page_money_in_new = $day_books->getCollection()->where('type', 'credit')->sum(function ($day_book) {
|
||||
return match($day_book->platform) {
|
||||
'sale' => $day_book->sale?->totalAmount ?? 0,
|
||||
'sale_return' => $day_book->saleReturn?->sale?->totalAmount ?? 0,
|
||||
'purchase' => $day_book->purchase?->totalAmount ?? 0,
|
||||
'purchase_return' => $day_book->purchaseReturn?->purchase?->totalAmount ?? 0,
|
||||
'due_collect', 'due_pay' => $day_book->dueCollect?->totalDue ?? 0,
|
||||
default => 0
|
||||
};
|
||||
});
|
||||
|
||||
$page_money_in = $day_books->getCollection()->where('type', 'credit')->sum('amount');
|
||||
$page_money_out = $day_books->getCollection()->where('type', 'debit')->sum('amount');
|
||||
@endphp
|
||||
@@ -127,6 +139,7 @@
|
||||
<td class="d-print-none"></td>
|
||||
<td class="d-print-none text-end"></td>
|
||||
<td class="text-start">{{ currency_format($page_total_amount, currency: business_currency()) }}</td>
|
||||
<td class="text-start">{{ currency_format($page_money_in_new, currency: business_currency()) }}</td>
|
||||
<td class="text-start">{{ currency_format($page_money_in, currency: business_currency()) }}</td>
|
||||
<td class="text-start">{{ currency_format($page_money_out, currency: business_currency()) }}</td>
|
||||
<td></td>
|
||||
|
||||
@@ -37,29 +37,52 @@
|
||||
<td class="text-start">{{ ucwords(str_replace('_', ' ', $day_book->platform)) }}</td>
|
||||
|
||||
@if ($day_book->platform == 'sale')
|
||||
<td class="text-start">{{ currency_format($day_book->sale?->totalAmount ?? 0, currency: business_currency()) }}</td>
|
||||
<td class="text-start">
|
||||
{{ currency_format($day_book->sale?->totalAmount ?? 0, currency: business_currency()) }}
|
||||
</td>
|
||||
@elseif ($day_book->platform == 'sale_return')
|
||||
<td class="text-start">{{ currency_format($day_book->saleReturn?->sale?->totalAmount ?? 0, currency: business_currency()) }}</td>
|
||||
<td class="text-start">
|
||||
{{ currency_format($day_book->saleReturn?->sale?->totalAmount ?? 0, currency: business_currency()) }}
|
||||
</td>
|
||||
@elseif ($day_book->platform == 'purchase')
|
||||
<td class="text-start">{{ currency_format($day_book->purchase?->totalAmount ?? 0, currency: business_currency()) }}</td>
|
||||
<td class="text-start">
|
||||
{{ currency_format($day_book->purchase?->totalAmount ?? 0, currency: business_currency()) }}
|
||||
</td>
|
||||
@elseif ($day_book->platform == 'purchase_return')
|
||||
<td class="text-start">{{ currency_format($day_book->purchaseReturn?->purchase?->totalAmount ?? 0, currency: business_currency()) }}</td>
|
||||
<td class="text-start">
|
||||
{{ currency_format($day_book->purchaseReturn?->purchase?->totalAmount ?? 0, currency: business_currency()) }}
|
||||
</td>
|
||||
@elseif ($day_book->platform == 'due_collect' || $day_book->platform == 'due_pay')
|
||||
<td class="text-start">{{ currency_format($day_book->dueCollect?->totalDue ?? 0, currency: business_currency()) }}</td>
|
||||
<td class="text-start">
|
||||
{{ currency_format($day_book->dueCollect?->totalDue ?? 0, currency: business_currency()) }}
|
||||
</td>
|
||||
@else
|
||||
<td class="text-start">{{ currency_format(0) }}</td>
|
||||
<td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$total_amount = match ($day_book->platform) {
|
||||
'sale' => $day_book->sale?->totalAmount ?? 0,
|
||||
'sale_return' => $day_book->saleReturn?->sale?->totalAmount ?? 0,
|
||||
'purchase' => $day_book->purchase?->totalAmount ?? 0,
|
||||
'purchase_return' => $day_book->purchaseReturn?->purchase?->totalAmount ?? 0,
|
||||
'due_collect', 'due_pay' => $day_book->dueCollect?->totalDue ?? 0,
|
||||
default => 0
|
||||
};
|
||||
@endphp
|
||||
|
||||
@if ($day_book->type === 'credit')
|
||||
<td class="text-start text-success">{{ currency_format($day_book->amount, currency: business_currency()) }}</td>
|
||||
<td class="text-start text-success">{{ currency_format($total_amount, currency: business_currency()) }}
|
||||
</td>
|
||||
@else
|
||||
<td class="text-start">{{ currency_format(0) }}</td>
|
||||
<td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
|
||||
@endif
|
||||
|
||||
@if ($day_book->type === 'debit')
|
||||
<td class="text-start text-danger">{{ currency_format($day_book->amount, currency: business_currency()) }}</td>
|
||||
<td class="text-start text-danger">{{ currency_format($day_book->amount, currency: business_currency()) }}
|
||||
</td>
|
||||
@else
|
||||
<td class="text-start">{{ currency_format(0) }}</td>
|
||||
<td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
|
||||
@endif
|
||||
|
||||
@if ($day_book->payment_type_id)
|
||||
@@ -87,7 +110,18 @@
|
||||
|
||||
@php
|
||||
$page_total_amount = $day_books->sum(function ($day_book) {
|
||||
return match($day_book->platform) {
|
||||
return match ($day_book->platform) {
|
||||
'sale' => $day_book->sale?->totalAmount ?? 0,
|
||||
'sale_return' => $day_book->saleReturn?->sale?->totalAmount ?? 0,
|
||||
'purchase' => $day_book->purchase?->totalAmount ?? 0,
|
||||
'purchase_return' => $day_book->purchaseReturn?->purchase?->totalAmount ?? 0,
|
||||
'due_collect', 'due_pay' => $day_book->dueCollect?->totalDue ?? 0,
|
||||
default => 0
|
||||
};
|
||||
});
|
||||
|
||||
$page_money_in_new = $day_books->where('type', 'credit')->sum(function ($day_book) {
|
||||
return match ($day_book->platform) {
|
||||
'sale' => $day_book->sale?->totalAmount ?? 0,
|
||||
'sale_return' => $day_book->saleReturn?->sale?->totalAmount ?? 0,
|
||||
'purchase' => $day_book->purchase?->totalAmount ?? 0,
|
||||
|
||||
@@ -23,19 +23,19 @@
|
||||
<div class="col-lg-2 col-md-12 ">
|
||||
<div class="loss-card p-3 m-2 text-white">
|
||||
<p class="stat-title">{{ __('Total Transaction') }}</p>
|
||||
<p class="stat-value" id="total_money_in_out_amount">{{ currency_format($total_money_in_out_amount, 'icon', 2, business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format($total_amount, 'icon', 2, business_currency()) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-6 ">
|
||||
<div class="profit-card p-3 m-2 text-white">
|
||||
<p class="stat-title">{{ __('Money In') }}</p>
|
||||
<p class="stat-value" id="total_money_in">{{ currency_format($total_money_in, 'icon', 2, business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format($total_money_in, 'icon', 2, business_currency()) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-6 ">
|
||||
<div class="sales-card p-3 m-2 text-white">
|
||||
<p class="stat-title">{{ __('Money Out') }}</p>
|
||||
<p class="stat-value" id="total_money_out">{{ currency_format($total_money_out, 'icon', 2, business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format($total_money_out, 'icon', 2, business_currency()) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -114,17 +114,17 @@
|
||||
<div class="table-top-btn-group d-print-none p-2">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.day-book-reports.csv') }}">
|
||||
<a href="{{ route('business.day-book-reports.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.day-book-reports.excel') }}">
|
||||
<a href="{{ route('business.day-book-reports.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.day-book-reports.pdf') }}">
|
||||
<a target="blank" href="{{ route('business.day-book-reports.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -4,19 +4,7 @@
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Day Book Report List') }}</h4>
|
||||
@if ($filter_from_date && $filter_to_date)
|
||||
<p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration:') }}
|
||||
@if ($duration === 'today')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@elseif ($duration === 'yesterday')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@else
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
{{ __('to') }}
|
||||
{{ Carbon\Carbon::parse($filter_to_date)->format('d-m-Y') }}
|
||||
@endif
|
||||
</p>
|
||||
@endif
|
||||
{{-- <p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration: 14-12-2025 to 24-12-2025') }}</p> --}}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@@ -66,19 +54,31 @@
|
||||
@elseif ($day_book->platform == 'due_collect' || $day_book->platform == 'due_pay')
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ currency_format($day_book->dueCollect?->totalDue ?? 0, currency: business_currency()) }}</td>
|
||||
@else
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ currency_format(0) }}</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ currency_format(0, currency: business_currency()) }}</td>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$total_amount = match($day_book->platform) {
|
||||
'sale' => $day_book->sale?->totalAmount ?? 0,
|
||||
'sale_return' => $day_book->saleReturn?->sale?->totalAmount ?? 0,
|
||||
'purchase' => $day_book->purchase?->totalAmount ?? 0,
|
||||
'purchase_return' => $day_book->purchaseReturn?->purchase?->totalAmount ?? 0,
|
||||
'due_collect', 'due_pay' => $day_book->dueCollect?->totalDue ?? 0,
|
||||
default => 0
|
||||
};
|
||||
@endphp
|
||||
|
||||
@if ($day_book->type === 'credit')
|
||||
<td style="border:1px solid gainsboro; text-align:center; color:green;">{{ currency_format($day_book->amount, currency: business_currency()) }}</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center; color:green;">{{ currency_format($total_amount, currency: business_currency()) }}</td>
|
||||
@else
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ currency_format(0) }}</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ currency_format(0, currency: business_currency()) }}</td>
|
||||
@endif
|
||||
|
||||
|
||||
@if ($day_book->type === 'debit')
|
||||
<td style="border:1px solid gainsboro; text-align:center; color:red;">{{ currency_format($day_book->amount, currency: business_currency()) }}</td>
|
||||
@else
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ currency_format(0) }}</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">{{ currency_format(0, currency: business_currency()) }}</td>
|
||||
@endif
|
||||
|
||||
@if ($day_book->payment_type_id)
|
||||
@@ -102,6 +102,17 @@
|
||||
};
|
||||
});
|
||||
|
||||
$page_money_in_new = $day_books->where('type', 'credit')->sum(function ($day_book) {
|
||||
return match($day_book->platform) {
|
||||
'sale' => $day_book->sale?->totalAmount ?? 0,
|
||||
'sale_return' => $day_book->saleReturn?->sale?->totalAmount ?? 0,
|
||||
'purchase' => $day_book->purchase?->totalAmount ?? 0,
|
||||
'purchase_return' => $day_book->purchaseReturn?->purchase?->totalAmount ?? 0,
|
||||
'due_collect', 'due_pay' => $day_book->dueCollect?->totalDue ?? 0,
|
||||
default => 0
|
||||
};
|
||||
});
|
||||
|
||||
$page_money_in = $day_books->where('type', 'credit')->sum('amount');
|
||||
$page_money_out = $day_books->where('type', 'debit')->sum('amount');
|
||||
@endphp
|
||||
|
||||
@@ -2,27 +2,26 @@
|
||||
<table class="table" id="datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="d-print-none">{{ __('SL') }}.</th>
|
||||
<th>{{ __('SL') }}.</th>
|
||||
<th>{{ __('Name') }}</th>
|
||||
<th>{{ __('Email') }}</th>
|
||||
<th>{{ __('Phone') }}</th>
|
||||
<th>{{ __('Type') }}</th>
|
||||
<th class="text-end">{{ __('Due Amount') }}</th>
|
||||
<th class="d-print-none">{{ __('Action') }}</th>
|
||||
<th>{{ __('Action') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($parties as $party)
|
||||
<tr>
|
||||
<td class="d-print-none">{{ ($parties->currentPage() - 1) * $parties->perPage() + $loop->iteration }}
|
||||
</td>
|
||||
<td>{{ ($parties->currentPage() - 1) * $parties->perPage() + $loop->iteration }}</td>
|
||||
<td>{{ $party->name }}</td>
|
||||
<td>{{ $party->email }}</td>
|
||||
<td>{{ $party->phone }}</td>
|
||||
@if ($party->type == 'Retailer')
|
||||
<td>{{ __('Customer') }}</td>
|
||||
@else
|
||||
<td>{{ $party->type }}</td>
|
||||
<td>{{ $party->type }}</td>
|
||||
@endif
|
||||
<td class="text-danger text-end">
|
||||
{{ currency_format($party->due, currency: business_currency()) }}
|
||||
@@ -40,61 +39,32 @@
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@if ($party->type != 'Supplier')
|
||||
<li>
|
||||
<a href="#"
|
||||
data-url="{{ route('business.dues.view-payment', $party->id) }}"
|
||||
class="view-due-payment-btn" data-bs-toggle="modal"
|
||||
data-bs-target="#view-due-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 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>
|
||||
|
||||
@if ($party->dueCollect)
|
||||
<li>
|
||||
<a href="#" data-url="{{ route('business.dues.view-payment', $party->id) }}"
|
||||
class="view-due-payment-btn" data-bs-toggle="modal"
|
||||
data-bs-target="#view-due-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 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>
|
||||
@endif
|
||||
|
||||
@if (moduleCheck('MarketingAddon'))
|
||||
<li>
|
||||
<a href="{{ route('business.payment-reminder', $party->id) }}">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_40008926_148433)">
|
||||
<path
|
||||
d="M18.3327 9.9974C18.3327 14.5997 14.6017 18.3307 9.99935 18.3307C5.39697 18.3307 1.66602 14.5997 1.66602 9.9974C1.66602 5.39502 5.39697 1.66406 9.99935 1.66406C14.6017 1.66406 18.3327 5.39502 18.3327 9.9974Z"
|
||||
stroke="#4B5563" stroke-width="1.5" />
|
||||
<path
|
||||
d="M12.2578 8.38067C12.1753 7.74512 11.4455 6.71827 10.1333 6.71824C8.60868 6.71822 7.96715 7.56263 7.83697 7.98484C7.63389 8.54958 7.6745 9.71067 9.4616 9.83725C11.6955 9.99558 12.5904 10.2593 12.4766 11.6264C12.3627 12.9935 11.1174 13.2889 10.1333 13.2572C9.14918 13.2256 7.53905 12.7735 7.47656 11.5575M9.97718 5.82812V6.72127M9.97718 13.249V14.1614"
|
||||
stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" />
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_40008926_148433">
|
||||
<rect width="20" height="20" fill="white" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
||||
{{ __('Payment Reminder') }}
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$due = $party->dueCollect()->latest()->first();
|
||||
@endphp
|
||||
|
||||
@if ($due)
|
||||
<li>
|
||||
<a href="{{ route('business.collect.dues.invoice', $due->id) }}" target="_blank">
|
||||
<a href="{{ route('business.collect.dues.invoice', $party->id) }}"
|
||||
target="_blank">
|
||||
<img src="{{ asset('assets/images/icons/Invoic.svg') }}" alt="">
|
||||
{{ __('Invoice') }}
|
||||
</a>
|
||||
@@ -105,20 +75,8 @@ class="view-due-payment-btn" data-bs-toggle="modal"
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
@if ($parties->count() > 0)
|
||||
<tr class="table-footer">
|
||||
<td class="text-start">{{ __('Total') }}</td>
|
||||
<td class="d-print-none"></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="text-end">
|
||||
{{ currency_format($parties->sum('due'), currency: business_currency()) }}
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
|
||||
@@ -12,29 +12,23 @@
|
||||
<div class="d-flex align-items-center justify-content-center gap-3">
|
||||
<div class="profit-card p-3 text-white">
|
||||
<p class="stat-title">{{ __('Supplier Due') }}</p>
|
||||
<p class="stat-value" id="total_supplier_due">{{ currency_format($total_supplier_due, currency: business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format($total_supplier_due, currency: business_currency()) }}</p>
|
||||
</div>
|
||||
|
||||
<div class="loss-card p-3 text-white">
|
||||
<p class="stat-title">{{ __('Customer Due') }}</p>
|
||||
<p class="stat-value" id="total_customer_due">{{ currency_format($total_customer_due, currency: business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format($total_customer_due, currency: business_currency()) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-bodys">
|
||||
<div class="table-header p-16 d-print-none">
|
||||
<div class="table-header p-16">
|
||||
<h4>{{ __('Due List') }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 class="mt-2">{{ __('Due List') }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="table-top-form p-16 d-print-none">
|
||||
<form action="{{ route('business.dues.index') }}" method="GET" class="report-filter-form" table="#due-reports-data">
|
||||
<div class="table-top-form p-16">
|
||||
<form action="{{ route('business.dues.index') }}" method="GET" class="filter-form" table="#due-reports-data">
|
||||
|
||||
<div class="table-top-left d-flex gap-3 ">
|
||||
<div class="gpt-up-down-arrow position-relative">
|
||||
@@ -67,30 +61,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="table-top-btn-group d-print-none">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" class="export-btn" href="{{ route('business.dues.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" class="export-btn" href="{{ route('business.dues.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" class="export-btn" target="_blank" href="{{ route('business.dues.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a onclick="window.print()" class="print-window">
|
||||
<img src="{{ asset('assets/images/logo/printer.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
@endsection
|
||||
|
||||
@section('main_content')
|
||||
@if (invoice_setting($party->business_id) == '3_inch_80mm' && moduleCheck('ThermalPrinterAddon'))
|
||||
@if (invoice_setting() == '3_inch_80mm' && moduleCheck('ThermalPrinterAddon'))
|
||||
@include('thermalprinteraddon::due-collects.3_inch_80mm')
|
||||
@else
|
||||
@include('business::dues.invoices.a4-size')
|
||||
|
||||
@@ -1,37 +1,23 @@
|
||||
@php
|
||||
$isBusinessRoute = request()->routeIs('business.dues.*');
|
||||
$business_id = $party->business_id;
|
||||
@endphp
|
||||
<div class="invoice-container">
|
||||
<div class="invoice-content p-4">
|
||||
{{-- Print Header --}}
|
||||
|
||||
<div
|
||||
class="row py-2 d-print-none d-flex align-items-start justify-content-between border-bottom print-container">
|
||||
<div class="row py-2 d-print-none d-flex align-items-start justify-content-between border-bottom print-container">
|
||||
|
||||
<div class="col-md-4 d-flex align-items-center p-2">
|
||||
<div class="col-md-6 d-flex align-items-center p-2">
|
||||
<span class="Money-Receipt white-text">{{ __('Money Receipt') }}</span>
|
||||
</div>
|
||||
<div class="col-md-8 d-flex justify-content-start justify-content-md-end align-items-end">
|
||||
<div class="d-flex gap-3 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>
|
||||
<div class="col-md-6 d-flex justify-content-end align-items-end">
|
||||
<div class="d-flex gap-3">
|
||||
|
||||
<form action="{{ route('business.collect.dues.mail', $party->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 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.collect.dues.pdf', ['due_id' => $party->id]) }}"
|
||||
<a target="blank" href="{{ route('business.collect.dues.pdf', ['due_id' => $party->id]) }}"
|
||||
class="pdf-btn print-btn">
|
||||
<img class="w-10 h-10" src="{{ asset('assets/img/pdf.svg') }}">
|
||||
{{__('PDF')}}</a>
|
||||
@@ -45,22 +31,18 @@ class="pdf-btn print-btn">
|
||||
<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') ?? '' }}"
|
||||
alt="">
|
||||
@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') ?? '' }}" alt="">
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- Right Side: Invoice -->
|
||||
<div class="address-container">
|
||||
@if (($due_collect->business->meta['show_address'] ?? 0) == 1)
|
||||
<p> {{__('Address')}} : {{ $due_collect->branch?->address ?? $due_collect->business?->address ?? '' }}
|
||||
</p>
|
||||
<p> {{__('Address')}} : {{ $due_collect->branch?->address ?? $due_collect->business?->address ?? '' }}</p>
|
||||
@endif
|
||||
@if (($due_collect->business->meta['show_phone_number'] ?? 0) == 1)
|
||||
<p> {{__('Mobile')}} : {{ $due_collect->branch?->phone ?? $due_collect->business?->phoneNumber ?? '' }}
|
||||
</p>
|
||||
<p> {{__('Mobile')}} : {{ $due_collect->branch?->phone ?? $due_collect->business?->phoneNumber ?? '' }}</p>
|
||||
@endif
|
||||
@if (($due_collect->business->meta['show_email'] ?? 0) == 1)
|
||||
<p> {{__('Email')}} : {{ $due_collect->branch?->email ?? $due_collect->business?->email ?? '' }}</p>
|
||||
@@ -77,8 +59,7 @@ class="pdf-btn print-btn">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 class="right-invoice receipt-invoice-title mb-0 align-self-center white-text ">{{ __('MONEY RECEIPT') }}
|
||||
</h3>
|
||||
<h3 class="right-invoice receipt-invoice-title mb-0 align-self-center white-text ">{{ __('MONEY RECEIPT') }}</h3>
|
||||
<div class="d-flex align-items-start justify-content-between flex-wrap">
|
||||
<div>
|
||||
<table class="table">
|
||||
@@ -133,13 +114,12 @@ class="pdf-btn print-btn">
|
||||
<tr class="in-table-body">
|
||||
<td class="text-center">1</td>
|
||||
<td class="text-start">
|
||||
{{ currency_format($due_collect->totalDue ?? 0, currency: business_currency($business_id)) }}
|
||||
{{ currency_format($due_collect->totalDue ?? 0, currency: business_currency()) }}</td>
|
||||
<td class="text-end">
|
||||
{{ currency_format($due_collect->payDueAmount ?? 0, currency: business_currency()) }}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
{{ currency_format($due_collect->payDueAmount ?? 0, currency: business_currency($business_id)) }}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
{{ currency_format($due_collect->dueAmountAfterPay ?? 0, currency: business_currency($business_id)) }}
|
||||
{{ currency_format($due_collect->dueAmountAfterPay ?? 0, currency: business_currency()) }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -152,54 +132,54 @@ class="pdf-btn print-btn">
|
||||
<tr class="in-table-row">
|
||||
<td class="text-start"></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 pb-2 pt-3">
|
||||
{{ get_business_option('business-settings', $business_id)['note'] ?? '' }}
|
||||
{{ get_business_option('business-settings')['note'] ?? '' }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr class="in-table-row">
|
||||
<tr class="in-table-row">
|
||||
<td class="text-start paid-by">{{ __('Paid by') }} :
|
||||
{{ $transactionTypes ?? ($due_collect->payment_type_id ? ($due_collect->payment_type->name ?? '') : ($due_collect->paymentType ?? '')) }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@if ($bank_detail->show_in_invoice ?? 0 == 1)
|
||||
<div class="bank-details-container">
|
||||
<div class="bank-details-title">
|
||||
{{__('Bank Details')}}
|
||||
</div>
|
||||
<div class="back-details-content">
|
||||
<table class="table mb-2">
|
||||
<tbody>
|
||||
<tr class="in-table-row">
|
||||
<td class="text-start in-table-title">{{ __('Name') }}</td>
|
||||
<td class="clone-width">:</td>
|
||||
<td class="text-start">{{ $bank_detail->name }}</td>
|
||||
</tr>
|
||||
<tr class="in-table-row">
|
||||
<td class="text-start in-table-title">{{ __('Account No') }}</td>
|
||||
<td class="clone-width">:</td>
|
||||
<td class="text-start">{{ $bank_detail->meta['account_number'] ?? '' }}</td>
|
||||
</tr>
|
||||
@if ($bank_detail->show_in_invoice ?? 0 == 1)
|
||||
<div class="bank-details-container">
|
||||
<div class="bank-details-title">
|
||||
{{__('Bank Details')}}
|
||||
</div>
|
||||
<div class="back-details-content">
|
||||
<table class="table mb-2">
|
||||
<tbody>
|
||||
<tr class="in-table-row">
|
||||
<td class="text-start in-table-title">{{ __('Name') }}</td>
|
||||
<td class="clone-width">:</td>
|
||||
<td class="text-start">{{ $bank_detail->name }}</td>
|
||||
</tr>
|
||||
<tr class="in-table-row">
|
||||
<td class="text-start in-table-title">{{ __('Account No') }}</td>
|
||||
<td class="clone-width">:</td>
|
||||
<td class="text-start">{{ $bank_detail->meta['account_number'] ?? '' }}</td>
|
||||
</tr>
|
||||
|
||||
<tr class="in-table-row">
|
||||
<td class="text-start in-table-title">{{ __('UPI ID') }}</td>
|
||||
<td class="clone-width">:</td>
|
||||
<td class="text-start">{{ $bank_detail->meta['upi_id'] ?? '' }}</td>
|
||||
</tr>
|
||||
<tr class="in-table-row">
|
||||
<td class="text-start in-table-title">{{ __('Holder’s Nmae') }}</td>
|
||||
<td class="clone-width">:</td>
|
||||
<td class="text-start">{{ $bank_detail->meta['account_holder'] ?? '' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<tr class="in-table-row">
|
||||
<td class="text-start in-table-title">{{ __('UPI ID') }}</td>
|
||||
<td class="clone-width">:</td>
|
||||
<td class="text-start">{{ $bank_detail->meta['upi_id'] ?? '' }}</td>
|
||||
</tr>
|
||||
<tr class="in-table-row">
|
||||
<td class="text-start in-table-title">{{ __('Holder’s Nmae') }}</td>
|
||||
<td class="clone-width">:</td>
|
||||
<td class="text-start">{{ $bank_detail->meta['account_holder'] ?? '' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
<div>
|
||||
<table class="table">
|
||||
@@ -208,17 +188,15 @@ class="pdf-btn print-btn">
|
||||
<td class="text-end">{{ __('Payable Amount') }}</td>
|
||||
<td class="text-end">:</td>
|
||||
<td class="text-end">
|
||||
{{ currency_format($due_collect->totalDue ?? 0, currency: business_currency($business_id)) }}
|
||||
{{ currency_format($due_collect->totalDue ?? 0, currency: business_currency()) }}
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="in-table-row-bottom">
|
||||
<td class="text-end">
|
||||
{{ $party->type === 'Supplier' ? __('Paid Amount') : __('Received Amount') }}
|
||||
</td>
|
||||
<td class="text-end">{{ $party->type === 'Supplier' ? __('Paid Amount') : __('Received Amount') }}</td>
|
||||
<td class="text-end">:</td>
|
||||
<td class="text-end">
|
||||
{{ currency_format($due_collect->payDueAmount ?? 0, currency: business_currency($business_id)) }}
|
||||
{{ currency_format($due_collect->payDueAmount ?? 0, currency: business_currency()) }}
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -226,7 +204,7 @@ class="pdf-btn print-btn">
|
||||
<td class="text-end">{{ __('Due Amount') }}</td>
|
||||
<td class="text-end">:</td>
|
||||
<td class="text-end">
|
||||
{{ currency_format($due_collect->dueAmountAfterPay ?? 0, currency: business_currency($business_id)) }}
|
||||
{{ currency_format($due_collect->dueAmountAfterPay ?? 0, currency: business_currency()) }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -245,28 +223,15 @@ class="pdf-btn print-btn">
|
||||
</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 mt-3">
|
||||
<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 = $due_collect->unique_id ? route('due.invoice.unique', $due_collect->unique_id) : ($due_collect->party?->phone ? route('due.invoice', ['due_id' => $due_collect->id, 'phone' => $due_collect->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])
|
||||
@@ -2,19 +2,19 @@
|
||||
<table class="table" id="datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="d-print-none">{{ __('SL') }}.</th>
|
||||
<th>{{ __('SL') }}.</th>
|
||||
<th>{{ __('Name') }}</th>
|
||||
<th>{{ __('Email') }}</th>
|
||||
<th>{{ __('Phone') }}</th>
|
||||
<th>{{ __('Type') }}</th>
|
||||
<th class="text-end">{{ __('Due Amount') }}</th>
|
||||
<th class="d-print-none">{{ __('Action') }}</th>
|
||||
<th>{{ __('Action') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($parties as $party)
|
||||
<tr>
|
||||
<td class="d-print-none">{{ ($parties->currentPage() - 1) * $parties->perPage() + $loop->iteration }}</td>
|
||||
<td>{{ ($parties->currentPage() - 1) * $parties->perPage() + $loop->iteration }}</td>
|
||||
<td>{{ $party->name }}</td>
|
||||
<td>{{ $party->email }}</td>
|
||||
<td>{{ $party->phone }}</td>
|
||||
@@ -59,14 +59,10 @@ class="view-due-payment-btn" data-bs-toggle="modal"
|
||||
{{ __('View Payment') }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@php
|
||||
$due = $party->dueCollect()->latest()->first();
|
||||
@endphp
|
||||
|
||||
@if ($due)
|
||||
@if ($party->dueCollect)
|
||||
<li>
|
||||
<a href="{{ route('business.collect.dues.invoice', $due->id) }}" target="_blank">
|
||||
<a href="{{ route('business.collect.dues.invoice', $party->id) }}"
|
||||
target="_blank">
|
||||
<img src="{{ asset('assets/images/icons/Invoic.svg') }}" alt="">
|
||||
{{ __('Invoice') }}
|
||||
</a>
|
||||
@@ -78,20 +74,6 @@ class="view-due-payment-btn" data-bs-toggle="modal"
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
@if ($parties->count() > 0)
|
||||
<tr class="table-footer">
|
||||
<td class="text-start">{{ __('Total') }}</td>
|
||||
<td class="d-print-none"></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="text-end">
|
||||
{{ currency_format($parties->sum('due'), currency: business_currency()) }}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@extends('layouts.business.master')
|
||||
|
||||
@section('title')
|
||||
{{ __(':type Due List', ['type' => request('type') === 'Retailer' ? __('Customer') : __(request('type'))]) }}
|
||||
{{ __('Due List') }}
|
||||
@endsection
|
||||
|
||||
@section('main_content')
|
||||
@@ -10,17 +10,11 @@
|
||||
|
||||
<div class="card">
|
||||
<div class="card-bodys">
|
||||
<div class="table-header p-16 d-print-none">
|
||||
<h4>{{ __(':type Due List', ['type' => request('type') === 'Retailer' ? __('Customer') : __(request('type'))]) }}</h4>
|
||||
<div class="table-header p-16">
|
||||
<h4>{{ __('Due List') }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 class="mt-2">{{ __(':type Due List', ['type' => request('type') === 'Retailer' ? __('Customer') : __(request('type'))]) }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="table-top-form p-16 d-print-none">
|
||||
<form action="{{ route('business.party.dues') }}" method="GET" class="report-filter-form" table="#party-reports-data">
|
||||
<div class="table-top-form p-16">
|
||||
<form action="{{ route('business.party.dues') }}" method="GET" class="filter-form" table="#party-reports-data">
|
||||
|
||||
@if(request('type'))
|
||||
<input type="hidden" name="type" value="{{ request('type') }}">
|
||||
@@ -47,30 +41,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="table-top-btn-group d-print-none">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.dues.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.dues.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.dues.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a onclick="window.print()" class="print-window">
|
||||
<img src="{{ asset('assets/images/logo/printer.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
@endphp
|
||||
|
||||
@section('pdf_content')
|
||||
<div class="in-container" dir="{{ app()->getLocale() == 'ar' ? 'rtl' : 'ltr' }}">
|
||||
<div class="in-container">
|
||||
<div class="in-content">
|
||||
{{-- <table width="100%" class="invoice-top-header">
|
||||
<tr>
|
||||
@@ -247,7 +247,7 @@
|
||||
<table width="100%" style="margin-bottom:10px;">
|
||||
<tr>
|
||||
<td width="50%" valign="top"
|
||||
style="text-align:{{ app()->getLocale() == 'ar' ? 'right' : 'left' }};">
|
||||
style="text-align:{{ app()->getLocale() == 'ar' ? 'left' : 'left' }};">
|
||||
<table>
|
||||
<tr>
|
||||
<td>{{ __('Invoice') }}</td>
|
||||
@@ -265,7 +265,7 @@
|
||||
</td>
|
||||
|
||||
<td width="50%" valign="top"
|
||||
style="text-align:{{ app()->getLocale() == 'ar' ? 'left' : 'right' }};">
|
||||
style="text-align:{{ app()->getLocale() == 'ar' ? 'right' : 'right' }};">
|
||||
<table>
|
||||
<tr>
|
||||
<td>{{ __('Date') }}</td>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<th class="d-print-none">{{ __('Image') }}</th>
|
||||
<th>{{ __('Product Name') }}</th>
|
||||
<th class="d-print-none">{{ __('Code') }}</th>
|
||||
<th class="d-print-none">{{ __('HSN Code') }}</th>
|
||||
<th class="d-print-none">{{ __('Brand') }}</th>
|
||||
<th>{{ __('Category') }}</th>
|
||||
<th class="d-print-none">{{ __('Unit') }}</th>
|
||||
@@ -48,7 +47,6 @@
|
||||
<td>{{ $product->productName }}</td>
|
||||
|
||||
<td class="d-print-none">{{ $product->productCode }}</td>
|
||||
<td class="d-print-none">{{ $product->hsn_code }}</td>
|
||||
|
||||
<td class="d-print-none">{{ $product->brand->brandName ?? '' }}</td>
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('SL') }}. </th>
|
||||
<th>{{ __('Image') }} </th>
|
||||
<th>{{ __('Product Name') }} </th>
|
||||
<th>{{ __('Code') }} </th>
|
||||
<th>{{ __('HSN Code') }} </th>
|
||||
<th>{{ __('Brand') }} </th>
|
||||
<th>{{ __('Category') }} </th>
|
||||
<th>{{ __('Unit') }} </th>
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
<tbody>
|
||||
@foreach ($expired_products as $product)
|
||||
|
||||
@php
|
||||
$nonEmptyStock = $product->stocks->firstWhere('productStock', '>', 0);
|
||||
$fallbackStock = $product->stocks->first(); // fallback if no stock > 0
|
||||
@@ -24,11 +25,12 @@
|
||||
$latestPurchasePrice = $stock?->productPurchasePrice ?? 0;
|
||||
$latestSalePrice = $stock?->productSalePrice ?? 0;
|
||||
@endphp
|
||||
|
||||
<tr>
|
||||
<td>{{ $loop->index + 1 }}</td>
|
||||
<td><img src="{{ asset($product->productPicture ?? 'assets/images/logo/upload2.jpg') }}" alt="Img" class="table-product-img"></td>
|
||||
<td>{{ $product->productName }}</td>
|
||||
<td>{{ $product->productCode }}</td>
|
||||
<td>{{ $product->hsn_code }}</td>
|
||||
<td>{{ $product->brand->brandName ?? '' }}</td>
|
||||
<td>{{ $product->category->categoryName ?? '' }}</td>
|
||||
<td>{{ $product->unit->unitName ?? '' }}</td>
|
||||
|
||||
@@ -47,17 +47,17 @@
|
||||
<div class="table-top-btn-group d-print-none">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.expired.products.csv') }}">
|
||||
<a href="{{ route('business.expired.products.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.expired.products.excel') }}">
|
||||
<a href="{{ route('business.expired.products.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.expired.products.pdf') }}">
|
||||
<a target="blank" href="{{ route('business.expired.product.reports.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -1,91 +1,62 @@
|
||||
@if ($filter_from_date && $filter_to_date)
|
||||
<div class="mb-2 text-center fw-bold duration-display">
|
||||
<strong>{{ __('Duration:') }}</strong>
|
||||
@if ($duration === 'today')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@elseif ($duration === 'yesterday')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@else
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
{{ __('to') }}
|
||||
{{ Carbon\Carbon::parse($filter_to_date)->format('d-m-Y') }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-start income-type">{{ __('Income Types') }}</th>
|
||||
<th class="text-start d-print-none">{{ __('Date') }}</th>
|
||||
<th class="text-start">{{ __('Sale') }}</th>
|
||||
<th class="text-end">{{ __('Income') }}</th>
|
||||
<th class="text-start expense-type">{{ __('Expenses Types') }}</th>
|
||||
<th class="text-start d-print-none">{{ __('Date') }}</th>
|
||||
<th class="text-end">{{ __('Expense') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$maxRowCount = max($mergedIncomeSaleData->count(), $mergedExpenseData->count());
|
||||
@endphp
|
||||
@php
|
||||
$maxRowCount = max($mergedIncomeSaleData->count(), $mergedExpenseData->count());
|
||||
@endphp
|
||||
|
||||
@for ($i = 0; $i < $maxRowCount; $i++)
|
||||
@php
|
||||
$incomeSaleRow = $mergedIncomeSaleData[$i] ?? null;
|
||||
$expenseRow = $mergedExpenseData[$i] ?? null;
|
||||
@endphp
|
||||
<tr>
|
||||
{{-- Sale / Income Column --}}
|
||||
<td class="text-start loss-profit-tbody">
|
||||
{{ $incomeSaleRow ? $incomeSaleRow->type : '' }}
|
||||
</td>
|
||||
<td class="text-start loss-profit-tbody d-print-none">
|
||||
{{ $incomeSaleRow ? formatted_date($incomeSaleRow->date) : '' }}
|
||||
</td>
|
||||
<td class="text-start loss-profit-tbody ">
|
||||
{{ $incomeSaleRow && isset($incomeSaleRow->total_sales) ? currency_format($incomeSaleRow->total_sales, 'icon', 2, business_currency()) : '' }}
|
||||
</td>
|
||||
<td class="text-end loss-profit-tbody ">
|
||||
{{ $incomeSaleRow && isset($incomeSaleRow->total_incomes) ? currency_format($incomeSaleRow->total_incomes, 'icon', 2, business_currency()) : '' }}
|
||||
</td>
|
||||
@for ($i = 0; $i < $maxRowCount; $i++)
|
||||
@php
|
||||
$incomeSaleRow = $mergedIncomeSaleData[$i] ?? null;
|
||||
$expenseRow = $mergedExpenseData[$i] ?? null;
|
||||
@endphp
|
||||
<tr>
|
||||
{{-- Sale / Income Column --}}
|
||||
<td class="text-start loss-profit-tbody">
|
||||
{{ $incomeSaleRow ? $incomeSaleRow->type : '' }}
|
||||
</td>
|
||||
<td class="text-start loss-profit-tbody d-print-none">
|
||||
{{ $incomeSaleRow ? formatted_date($incomeSaleRow->date) : '' }}
|
||||
</td>
|
||||
<td class="text-start loss-profit-tbody ">
|
||||
{{ $incomeSaleRow && isset($incomeSaleRow->total_sales) ? currency_format($incomeSaleRow->total_sales, 'icon', 2, business_currency()) : '' }}
|
||||
</td>
|
||||
<td class="text-end loss-profit-tbody ">
|
||||
{{ $incomeSaleRow && isset($incomeSaleRow->total_incomes) ? currency_format($incomeSaleRow->total_incomes, 'icon', 2, business_currency()) : '' }}
|
||||
</td>
|
||||
|
||||
{{-- Expense Column --}}
|
||||
<td class="text-start loss-profit-tbody expense-type">
|
||||
{{ $expenseRow ? $expenseRow->type : '' }}
|
||||
</td>
|
||||
<td class="text-start loss-profit-tbody d-print-none">
|
||||
{{ $expenseRow ? formatted_date($expenseRow->date) : '' }}
|
||||
</td>
|
||||
<td class="text-end loss-profit-tbody">
|
||||
{{ $expenseRow ? currency_format($expenseRow->total_expenses ?? 0, 'icon', 2, business_currency()) : '' }}
|
||||
</td>
|
||||
</tr>
|
||||
@endfor
|
||||
{{-- Expense Column --}}
|
||||
<td class="text-start loss-profit-tbody expense-type">
|
||||
{{ $expenseRow ? $expenseRow->type : '' }}
|
||||
</td>
|
||||
<td class="text-start loss-profit-tbody d-print-none">
|
||||
{{ $expenseRow ? formatted_date($expenseRow->date) : '' }}
|
||||
</td>
|
||||
<td class="text-end loss-profit-tbody">
|
||||
{{ $expenseRow ? currency_format($expenseRow->total_expenses ?? 0, 'icon', 2, business_currency()) : '' }}
|
||||
</td>
|
||||
</tr>
|
||||
@endfor
|
||||
|
||||
{{-- Summary Rows --}}
|
||||
<tr class="fw-bold">
|
||||
<td class="text-start bottom-profit-expense">{{ __('Gross Profit') }}</td>
|
||||
<td class="d-print-none bottom-profit-expense"></td>
|
||||
<td class="text-start bottom-profit-expense">
|
||||
{{ currency_format($grossSaleProfit, 'icon', 2, business_currency()) }}
|
||||
</td>
|
||||
<td class="text-end bottom-profit-expense">
|
||||
{{ currency_format($grossIncomeProfit, 'icon', 2, business_currency()) }}
|
||||
</td>
|
||||
<td class="text-start bottom-profit-expense expense-type">{{ __('Total Expenses') }}</td>
|
||||
<td class="d-print-none bottom-profit-expense"></td>
|
||||
<td class="text-end bottom-profit-expense">
|
||||
{{ currency_format($totalExpenses, 'icon', 2, business_currency()) }}
|
||||
</td>
|
||||
</tr>
|
||||
{{-- Summary Rows --}}
|
||||
<tr class="fw-bold">
|
||||
<td class="text-start bottom-profit-expense">{{ __('Gross Profit') }}</td>
|
||||
<td class="d-print-none bottom-profit-expense"></td>
|
||||
<td class="text-start bottom-profit-expense">
|
||||
{{ currency_format($grossSaleProfit, 'icon', 2, business_currency()) }}
|
||||
</td>
|
||||
<td class="text-end bottom-profit-expense">
|
||||
{{ currency_format($grossIncomeProfit, 'icon', 2, business_currency()) }}
|
||||
</td>
|
||||
<td class="text-start bottom-profit-expense expense-type">{{ __('Total Expenses') }}</td>
|
||||
<td class="d-print-none bottom-profit-expense"></td>
|
||||
<td class="text-end bottom-profit-expense">
|
||||
{{ currency_format($totalExpenses, 'icon', 2, business_currency()) }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="fw-bold text-center bg-light">
|
||||
<td class="bottom-net-profit" colspan="7">
|
||||
{{ __('Net Profit (Income - Expense) =') }}
|
||||
<span class="{{ $netProfit >= 0 ? 'profit-ammount' : 'expense-ammount' }}">
|
||||
{{ currency_format($netProfit, 'icon', 2, business_currency()) }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<tr class="fw-bold text-center bg-light">
|
||||
<td class="bottom-net-profit" colspan="7">
|
||||
{{ __('Net Profit (Income - Expense) =') }}
|
||||
<span class="{{ $netProfit >= 0 ? 'profit-ammount' : 'expense-ammount' }}">
|
||||
{{ currency_format($netProfit, 'icon', 2, business_currency()) }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -9,22 +9,22 @@
|
||||
<div class="container-fluid">
|
||||
<div class="card">
|
||||
<div class="card-bodys">
|
||||
<div class="row p-2 d-print-none" id="loss-profit-summery">
|
||||
<div class="row p-2 d-print-none">
|
||||
<div class="col-lg-2 col-md-12">
|
||||
<div class="loss-card p-3 m-2 text-white">
|
||||
<p class="stat-value">{{ currency_format($grossIncomeProfit, currency: business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format($cardGrossProfit, currency: business_currency()) }}</p>
|
||||
<p class="stat-title">{{ __('Gross Profit') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-6">
|
||||
<div class="profit-card p-3 m-2 text-white">
|
||||
<p class="stat-value">{{ currency_format($totalExpenses, currency: business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format($totalCardExpenses, currency: business_currency()) }}</p>
|
||||
<p class="stat-title">{{ __('Expenses') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-6">
|
||||
<div class="sales-card p-3 m-2 text-white">
|
||||
<p class="stat-value">{{ currency_format($netProfit, currency: business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format($cardNetProfit, currency: business_currency()) }}</p>
|
||||
<p class="stat-title">{{ __('Net Profit') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -45,16 +45,6 @@
|
||||
<div class="d-flex align-items-center gap-3 flex-wrap table-top-left">
|
||||
<div class="m-0 p-0 d-print-none">
|
||||
<div class="date-filters-container">
|
||||
<div class="gpt-up-down-arrow position-relative">
|
||||
<select name="per_page" class="form-control">
|
||||
<option @selected(request('per_page') == 20) value="20">{{ __('Show 20') }}</option>
|
||||
<option @selected(request('per_page') == 50) value="50">{{ __('Show 50') }}</option>
|
||||
<option @selected(request('per_page') == 100) value="100">{{ __('Show 100') }}</option>
|
||||
<option @selected(request('per_page') == 500) value="500">{{ __('Show 500') }}</option>
|
||||
</select>
|
||||
<span></span>
|
||||
</div>
|
||||
|
||||
<div class="input-wrapper align-items-center date-filters d-none">
|
||||
<label class="header-label">{{ __('From Date') }}</label>
|
||||
<input type="date" name="from_date" value="{{ now()->format('Y-m-d') }}" class="form-control filter-field filter-from-date">
|
||||
@@ -91,17 +81,17 @@
|
||||
<div class="table-top-btn-group d-print-none p-2">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="loss-profit-export-btn" href="{{ route('business.loss-profit-history.csv') }}">
|
||||
<a href="{{ route('business.loss-profit-history.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="loss-profit-export-btn" href="{{ route('business.loss-profit-history.excel') }}">
|
||||
<a href="{{ route('business.loss-profit-history.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="loss-profit-export-btn" target="_blank" href="{{ route('business.loss-profit-history.pdf') }}">
|
||||
<a target="blank" href="{{ route('business.loss-profit-history.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
@@ -116,9 +106,22 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="responsive-table m-0">
|
||||
<div id="loss-profit-history-data">
|
||||
@include('business::loss-profit-histories.datas')
|
||||
</div>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-start income-type">{{ __('Income Types') }}</th>
|
||||
<th class="text-start d-print-none">{{ __('Date') }}</th>
|
||||
<th class="text-start">{{ __('Sale') }}</th>
|
||||
<th class="text-end">{{ __('Income') }}</th>
|
||||
<th class="text-start expense-type">{{ __('Expenses Types') }}</th>
|
||||
<th class="text-start d-print-none">{{ __('Date') }}</th>
|
||||
<th class="text-end">{{ __('Expense') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="loss-profit-history-data">
|
||||
@include('business::loss-profit-histories.datas')
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -4,19 +4,6 @@
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;">{{ __('Loss Profit History List') }}</h4>
|
||||
@if ($filter_from_date && $filter_to_date)
|
||||
<p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration:') }}
|
||||
@if ($duration === 'today')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@elseif ($duration === 'yesterday')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@else
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
{{ __('to') }}
|
||||
{{ Carbon\Carbon::parse($filter_to_date)->format('d-m-Y') }}
|
||||
@endif
|
||||
</p>
|
||||
@endif
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -58,28 +58,12 @@
|
||||
</li>
|
||||
@if (moduleCheck('MarketingAddon'))
|
||||
<li class="nav-item settings-item" role="presentation">
|
||||
<button class="nav-link settings-link" id="sms-tab" data-bs-toggle="tab"
|
||||
<button class="nav-link settings-link" id="currency-setting-tab" data-bs-toggle="tab"
|
||||
data-bs-target="#sms" type="button" role="tab">
|
||||
{{__('SMS Gateways')}}
|
||||
{{__('SMS Settings')}}
|
||||
</button>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if (moduleCheck('MarketingAddon'))
|
||||
<li class="nav-item settings-item" role="presentation">
|
||||
<button class="nav-link settings-link" id="email-tab" data-bs-toggle="tab"
|
||||
data-bs-target="#email" type="button" role="tab">
|
||||
{{__('Email Settings')}}
|
||||
</button>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
<li class="nav-item settings-item" role="presentation">
|
||||
<button class="nav-link settings-link" id="theme-tab" data-bs-toggle="tab"
|
||||
data-bs-target="#theme" type="button" role="tab">
|
||||
{{__('Theme Settings')}}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content mt-3" id="settingsTabContent">
|
||||
@@ -95,10 +79,10 @@
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M15.5 12C15.5 13.933 13.933 15.5 12 15.5C10.067 15.5 8.5 13.933 8.5 12C8.5 10.067 10.067 8.5 12 8.5C13.933 8.5 15.5 10.067 15.5 12Z"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" />
|
||||
stroke="#C52127" stroke-width="1.5" />
|
||||
<path
|
||||
d="M21.011 14.0949C21.5329 13.9542 21.7939 13.8838 21.8969 13.7492C22 13.6147 22 13.3982 22 12.9653V11.0316C22 10.5987 22 10.3822 21.8969 10.2477C21.7938 10.1131 21.5329 10.0427 21.011 9.90194C19.0606 9.37595 17.8399 7.33687 18.3433 5.39923C18.4817 4.86635 18.5509 4.59992 18.4848 4.44365C18.4187 4.28738 18.2291 4.1797 17.8497 3.96432L16.125 2.98509C15.7528 2.77375 15.5667 2.66808 15.3997 2.69058C15.2326 2.71308 15.0442 2.90109 14.6672 3.27709C13.208 4.73284 10.7936 4.73278 9.33434 3.277C8.95743 2.90099 8.76898 2.71299 8.60193 2.69048C8.43489 2.66798 8.24877 2.77365 7.87653 2.98499L6.15184 3.96423C5.77253 4.17959 5.58287 4.28727 5.51678 4.44351C5.45068 4.59976 5.51987 4.86623 5.65825 5.39916C6.16137 7.33686 4.93972 9.37599 2.98902 9.90196C2.46712 10.0427 2.20617 10.1131 2.10308 10.2476C2 10.3822 2 10.5987 2 11.0316V12.9653C2 13.3982 2 13.6147 2.10308 13.7492C2.20615 13.8838 2.46711 13.9542 2.98902 14.0949C4.9394 14.6209 6.16008 16.66 5.65672 18.5976C5.51829 19.1305 5.44907 19.3969 5.51516 19.5532C5.58126 19.7095 5.77092 19.8172 6.15025 20.0325L7.87495 21.0118C8.24721 21.2231 8.43334 21.3288 8.6004 21.3063C8.76746 21.2838 8.95588 21.0957 9.33271 20.7197C10.7927 19.2628 13.2088 19.2627 14.6689 20.7196C15.0457 21.0957 15.2341 21.2837 15.4012 21.3062C15.5682 21.3287 15.7544 21.223 16.1266 21.0117L17.8513 20.0324C18.2307 19.8171 18.4204 19.7094 18.4864 19.5531C18.5525 19.3968 18.4833 19.1304 18.3448 18.5975C17.8412 16.66 19.0609 14.621 21.011 14.0949Z"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" />
|
||||
stroke="#C52127" stroke-width="1.5" stroke-linecap="round" />
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
@@ -120,14 +104,14 @@ class="text-decoration-none text-dark">
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M5.49235 11.491C5.41887 12.887 5.50334 14.373 4.25611 15.3084C3.67562 15.7438 3.33398 16.427 3.33398 17.1527C3.33398 18.1508 4.11578 19 5.13398 19H19.534C20.5522 19 21.334 18.1508 21.334 17.1527C21.334 16.427 20.9924 15.7438 20.4119 15.3084C19.1646 14.373 19.2491 12.887 19.1756 11.491C18.9841 7.85223 15.9778 5 12.334 5C8.69015 5 5.68386 7.85222 5.49235 11.491Z"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round"
|
||||
stroke="#C52127" stroke-width="1.5" stroke-linecap="round"
|
||||
stroke-linejoin="round" />
|
||||
<path
|
||||
d="M10.834 3.125C10.834 3.95343 11.5056 5 12.334 5C13.1624 5 13.834 3.95343 13.834 3.125C13.834 2.29657 13.1624 2 12.334 2C11.5056 2 10.834 2.29657 10.834 3.125Z"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" />
|
||||
stroke="#C52127" stroke-width="1.5" />
|
||||
<path
|
||||
d="M15.334 19C15.334 20.6569 13.9909 22 12.334 22C10.6771 22 9.33398 20.6569 9.33398 19"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round"
|
||||
stroke="#C52127" stroke-width="1.5" stroke-linecap="round"
|
||||
stroke-linejoin="round" />
|
||||
</svg>
|
||||
</div>
|
||||
@@ -150,10 +134,10 @@ class="text-decoration-none text-dark">
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M3.16602 12C3.16602 7.77027 3.16602 5.6554 4.36399 4.25276C4.5341 4.05358 4.7196 3.86808 4.91878 3.69797C6.32142 2.5 8.43629 2.5 12.666 2.5C16.8957 2.5 19.0106 2.5 20.4132 3.69797C20.6124 3.86808 20.7979 4.05358 20.968 4.25276C22.166 5.6554 22.166 7.77027 22.166 12C22.166 16.2297 22.166 18.3446 20.968 19.7472C20.7979 19.9464 20.6124 20.1319 20.4132 20.302C19.0106 21.5 16.8957 21.5 12.666 21.5C8.43629 21.5 6.32142 21.5 4.91878 20.302C4.7196 20.1319 4.5341 19.9464 4.36399 19.7472C3.16602 18.3446 3.16602 16.2297 3.16602 12Z"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" />
|
||||
stroke="#C52127" stroke-width="1.5" />
|
||||
<path
|
||||
d="M15.3762 10.063C15.2771 9.30039 14.4014 8.06817 12.8268 8.06814C10.9972 8.06811 10.2274 9.08141 10.0712 9.58806C9.82746 10.2657 9.8762 11.659 12.0207 11.8109C14.7014 12.0009 15.7753 12.3174 15.6387 13.958C15.502 15.5985 14.0077 15.953 12.8268 15.9149C11.6458 15.877 9.71365 15.3344 9.63867 13.8752M12.6394 7V8.07177M12.6394 15.9051V16.9999"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" />
|
||||
stroke="#C52127" stroke-width="1.5" stroke-linecap="round" />
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
@@ -174,14 +158,14 @@ class="text-decoration-none text-dark">
|
||||
fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M11.5 14.0116C9.45338 13.9164 7.38334 14.4064 5.57757 15.4816C4.1628 16.324 0.453366 18.0441 2.71266 20.1966C3.81631 21.248 5.04549 22 6.59087 22H12"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round"
|
||||
stroke="#C52127" stroke-width="1.5" stroke-linecap="round"
|
||||
stroke-linejoin="round" />
|
||||
<path
|
||||
d="M15.5 6.5C15.5 8.98528 13.4853 11 11 11C8.51472 11 6.5 8.98528 6.5 6.5C6.5 4.01472 8.51472 2 11 2C13.4853 2 15.5 4.01472 15.5 6.5Z"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" />
|
||||
stroke="#C52127" stroke-width="1.5" />
|
||||
<path
|
||||
d="M18 20.7143V22M18 20.7143C16.8432 20.7143 15.8241 20.1461 15.2263 19.2833M18 20.7143C19.1568 20.7143 20.1759 20.1461 20.7737 19.2833M15.2263 19.2833L14.0004 20.0714M15.2263 19.2833C14.8728 18.773 14.6667 18.1597 14.6667 17.5C14.6667 16.8403 14.8727 16.2271 15.2262 15.7169M20.7737 19.2833L21.9996 20.0714M20.7737 19.2833C21.1272 18.773 21.3333 18.1597 21.3333 17.5C21.3333 16.8403 21.1273 16.2271 20.7738 15.7169M18 14.2857C19.1569 14.2857 20.1761 14.854 20.7738 15.7169M18 14.2857C16.8431 14.2857 15.8239 14.854 15.2262 15.7169M18 14.2857V13M20.7738 15.7169L22 14.9286M15.2262 15.7169L14 14.9286"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" />
|
||||
stroke="#C52127" stroke-width="1.5" stroke-linecap="round" />
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
@@ -200,10 +184,10 @@ class="text-decoration-none text-dark">
|
||||
<div class="d-flex align-items-center jusitfy-content-center gap-3">
|
||||
<div class="settings-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10 18.332C9.31817 18.332 8.66683 18.0569 7.36411 17.5066C4.12137 16.1368 2.5 15.4519 2.5 14.2998C2.5 13.9772 2.5 8.38578 2.5 5.83203M10 18.332C10.6818 18.332 11.3332 18.0569 12.6359 17.5066C15.8787 16.1368 17.5 15.4519 17.5 14.2998V5.83203M10 18.332V9.46103" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M6.93827 8.07745L4.50393 6.89951C3.16797 6.25305 2.5 5.92983 2.5 5.41797C2.5 4.90611 3.16797 4.58289 4.50393 3.93643L6.93827 2.75849C8.44067 2.03148 9.19192 1.66797 10 1.66797C10.8081 1.66797 11.5593 2.03147 13.0617 2.75849L15.4961 3.93643C16.832 4.58289 17.5 4.90611 17.5 5.41797C17.5 5.92983 16.832 6.25305 15.4961 6.89951L13.0617 8.07745C11.5593 8.80447 10.8081 9.16797 10 9.16797C9.19192 9.16797 8.44067 8.80447 6.93827 8.07745Z" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M5 10L6.66667 10.8333" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M14.1673 3.33594L5.83398 7.5026" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M10 18.332C9.31817 18.332 8.66683 18.0569 7.36411 17.5066C4.12137 16.1368 2.5 15.4519 2.5 14.2998C2.5 13.9772 2.5 8.38578 2.5 5.83203M10 18.332C10.6818 18.332 11.3332 18.0569 12.6359 17.5066C15.8787 16.1368 17.5 15.4519 17.5 14.2998V5.83203M10 18.332V9.46103" stroke="#C52127" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M6.93827 8.07745L4.50393 6.89951C3.16797 6.25305 2.5 5.92983 2.5 5.41797C2.5 4.90611 3.16797 4.58289 4.50393 3.93643L6.93827 2.75849C8.44067 2.03148 9.19192 1.66797 10 1.66797C10.8081 1.66797 11.5593 2.03147 13.0617 2.75849L15.4961 3.93643C16.832 4.58289 17.5 4.90611 17.5 5.41797C17.5 5.92983 16.832 6.25305 15.4961 6.89951L13.0617 8.07745C11.5593 8.80447 10.8081 9.16797 10 9.16797C9.19192 9.16797 8.44067 8.80447 6.93827 8.07745Z" stroke="#C52127" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M5 10L6.66667 10.8333" stroke="#C52127" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M14.1673 3.33594L5.83398 7.5026" stroke="#C52127" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
@@ -216,28 +200,30 @@ class="text-decoration-none text-dark">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (moduleCheck('MarketingAddon'))
|
||||
<div>
|
||||
<a href="{{ route('business.email-settings.index') }}" class="text-decoration-none text-dark">
|
||||
<div class="setting-box">
|
||||
{{-- <a href="{{ route('business.language-settings.index') }}" class="text-decoration-none text-dark">
|
||||
<div class=" setting-box">
|
||||
<div class="d-flex align-items-center jusitfy-content-center gap-3">
|
||||
<div class="settings-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10 18.332C9.31817 18.332 8.66683 18.0569 7.36411 17.5066C4.12137 16.1368 2.5 15.4519 2.5 14.2998C2.5 13.9772 2.5 8.38578 2.5 5.83203M10 18.332C10.6818 18.332 11.3332 18.0569 12.6359 17.5066C15.8787 16.1368 17.5 15.4519 17.5 14.2998V5.83203M10 18.332V9.46103" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M6.93827 8.07745L4.50393 6.89951C3.16797 6.25305 2.5 5.92983 2.5 5.41797C2.5 4.90611 3.16797 4.58289 4.50393 3.93643L6.93827 2.75849C8.44067 2.03148 9.19192 1.66797 10 1.66797C10.8081 1.66797 11.5593 2.03147 13.0617 2.75849L15.4961 3.93643C16.832 4.58289 17.5 4.90611 17.5 5.41797C17.5 5.92983 16.832 6.25305 15.4961 6.89951L13.0617 8.07745C11.5593 8.80447 10.8081 9.16797 10 9.16797C9.19192 9.16797 8.44067 8.80447 6.93827 8.07745Z" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M5 10L6.66667 10.8333" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M14.1673 3.33594L5.83398 7.5026" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M15.5 12C15.5 13.933 13.933 15.5 12 15.5C10.067 15.5 8.5 13.933 8.5 12C8.5 10.067 10.067 8.5 12 8.5C13.933 8.5 15.5 10.067 15.5 12Z"
|
||||
stroke="#C52127" stroke-width="1.5" />
|
||||
<path
|
||||
d="M21.011 14.0949C21.5329 13.9542 21.7939 13.8838 21.8969 13.7492C22 13.6147 22 13.3982 22 12.9653V11.0316C22 10.5987 22 10.3822 21.8969 10.2477C21.7938 10.1131 21.5329 10.0427 21.011 9.90194C19.0606 9.37595 17.8399 7.33687 18.3433 5.39923C18.4817 4.86635 18.5509 4.59992 18.4848 4.44365C18.4187 4.28738 18.2291 4.1797 17.8497 3.96432L16.125 2.98509C15.7528 2.77375 15.5667 2.66808 15.3997 2.69058C15.2326 2.71308 15.0442 2.90109 14.6672 3.27709C13.208 4.73284 10.7936 4.73278 9.33434 3.277C8.95743 2.90099 8.76898 2.71299 8.60193 2.69048C8.43489 2.66798 8.24877 2.77365 7.87653 2.98499L6.15184 3.96423C5.77253 4.17959 5.58287 4.28727 5.51678 4.44351C5.45068 4.59976 5.51987 4.86623 5.65825 5.39916C6.16137 7.33686 4.93972 9.37599 2.98902 9.90196C2.46712 10.0427 2.20617 10.1131 2.10308 10.2476C2 10.3822 2 10.5987 2 11.0316V12.9653C2 13.3982 2 13.6147 2.10308 13.7492C2.20615 13.8838 2.46711 13.9542 2.98902 14.0949C4.9394 14.6209 6.16008 16.66 5.65672 18.5976C5.51829 19.1305 5.44907 19.3969 5.51516 19.5532C5.58126 19.7095 5.77092 19.8172 6.15025 20.0325L7.87495 21.0118C8.24721 21.2231 8.43334 21.3288 8.6004 21.3063C8.76746 21.2838 8.95588 21.0957 9.33271 20.7197C10.7927 19.2628 13.2088 19.2627 14.6689 20.7196C15.0457 21.0957 15.2341 21.2837 15.4012 21.3062C15.5682 21.3287 15.7544 21.223 16.1266 21.0117L17.8513 20.0324C18.2307 19.8171 18.4204 19.7094 18.4864 19.5531C18.5525 19.3968 18.4833 19.1304 18.3448 18.5975C17.8412 16.66 19.0609 14.621 21.011 14.0949Z"
|
||||
stroke="#C52127" stroke-width="1.5" stroke-linecap="round" />
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
<h6>{{__('Email Settings')}}</h6>
|
||||
<small class="text-muted d-block">{{__('View and update email settings.')}}</small>
|
||||
<h6>{{__('Languages Settings')}}</h6>
|
||||
<small class="text-muted d-block">{{__('Add, Edit, Update, Delete Languages.')}}</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</a> --}}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -253,10 +239,10 @@ class="text-decoration-none text-dark">
|
||||
fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M15.5 12C15.5 13.933 13.933 15.5 12 15.5C10.067 15.5 8.5 13.933 8.5 12C8.5 10.067 10.067 8.5 12 8.5C13.933 8.5 15.5 10.067 15.5 12Z"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" />
|
||||
stroke="#C52127" stroke-width="1.5" />
|
||||
<path
|
||||
d="M21.011 14.0949C21.5329 13.9542 21.7939 13.8838 21.8969 13.7492C22 13.6147 22 13.3982 22 12.9653V11.0316C22 10.5987 22 10.3822 21.8969 10.2477C21.7938 10.1131 21.5329 10.0427 21.011 9.90194C19.0606 9.37595 17.8399 7.33687 18.3433 5.39923C18.4817 4.86635 18.5509 4.59992 18.4848 4.44365C18.4187 4.28738 18.2291 4.1797 17.8497 3.96432L16.125 2.98509C15.7528 2.77375 15.5667 2.66808 15.3997 2.69058C15.2326 2.71308 15.0442 2.90109 14.6672 3.27709C13.208 4.73284 10.7936 4.73278 9.33434 3.277C8.95743 2.90099 8.76898 2.71299 8.60193 2.69048C8.43489 2.66798 8.24877 2.77365 7.87653 2.98499L6.15184 3.96423C5.77253 4.17959 5.58287 4.28727 5.51678 4.44351C5.45068 4.59976 5.51987 4.86623 5.65825 5.39916C6.16137 7.33686 4.93972 9.37599 2.98902 9.90196C2.46712 10.0427 2.20617 10.1131 2.10308 10.2476C2 10.3822 2 10.5987 2 11.0316V12.9653C2 13.3982 2 13.6147 2.10308 13.7492C2.20615 13.8838 2.46711 13.9542 2.98902 14.0949C4.9394 14.6209 6.16008 16.66 5.65672 18.5976C5.51829 19.1305 5.44907 19.3969 5.51516 19.5532C5.58126 19.7095 5.77092 19.8172 6.15025 20.0325L7.87495 21.0118C8.24721 21.2231 8.43334 21.3288 8.6004 21.3063C8.76746 21.2838 8.95588 21.0957 9.33271 20.7197C10.7927 19.2628 13.2088 19.2627 14.6689 20.7196C15.0457 21.0957 15.2341 21.2837 15.4012 21.3062C15.5682 21.3287 15.7544 21.223 16.1266 21.0117L17.8513 20.0324C18.2307 19.8171 18.4204 19.7094 18.4864 19.5531C18.5525 19.3968 18.4833 19.1304 18.3448 18.5975C17.8412 16.66 19.0609 14.621 21.011 14.0949Z"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" />
|
||||
stroke="#C52127" stroke-width="1.5" stroke-linecap="round" />
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
@@ -279,10 +265,8 @@ class="invoice_form">
|
||||
@csrf
|
||||
|
||||
<div class="row justify-content-center">
|
||||
|
||||
|
||||
{{-- A4 Option --}}
|
||||
<div class="col-lg-4 mb-4 text-center">
|
||||
<div class="col-lg-5 mb-4 text-center">
|
||||
<label class="invoice-option position-relative d-inline-block">
|
||||
<div class="invoice-size-radio">
|
||||
<div class="custom-radio">
|
||||
@@ -291,27 +275,11 @@ class="invoice_form">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-2">{{ __('Printer A4') }}</div>
|
||||
<img src="{{ Storage::url($invoice_setting_image->value['a4_invoice_img'] ?? 'assets/images/logo/a4-new-invoice.png') }}"
|
||||
<img src="{{ asset('assets/images/logo/a4-new-invoice.png') }}"
|
||||
alt="A4 Invoice" class="img-fluid border rounded invoice-image ">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@if (moduleCheck('TaxInvoiceAddon'))
|
||||
<div class="col-lg-4 mb-4 text-center">
|
||||
<label class="invoice-option position-relative d-inline-block">
|
||||
<div class="invoice-size-radio">
|
||||
<div class="custom-radio">
|
||||
<input type="radio" name="invoice_size" value="standard_a4" {{ data_get($invoice_setting, 'value') == 'standard_a4' ? 'checked' : '' }}>
|
||||
<span class="checkmark"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-2">{{ __('Tax Invoice A4 Print') }}</div>
|
||||
<img src="{{ Storage::url($invoice_setting_image->value['standard_a4_img'] ?? 'assets/images/logo/tax-invoice-img.png') }}" alt="Invoice" class="img-fluid border rounded invoice-image">
|
||||
</label>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
@if (moduleCheck('ThermalPrinterAddon'))
|
||||
<div class="col-lg-3 mb-4 text-center">
|
||||
<label class="invoice-option position-relative d-inline-block">
|
||||
@@ -322,15 +290,15 @@ class="invoice_form">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-2">{{ __('Thermal: 3 inch 80mm') }}</div>
|
||||
<img src="{{ Storage::url($invoice_setting_image->value['thermal_invoice_img'] ?? 'assets/images/logo/3-inch-size-new-invoice.png') }}" alt="Invoice" class="img-fluid border rounded invoice-image">
|
||||
<img src="{{ asset('assets/images/logo/3-inch-size-new-invoice.png') }}" alt="Invoice" class="img-fluid border rounded invoice-image">
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-lg-4 mb-4"></div>
|
||||
@endif
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="role" role="tabpanel" aria-labelledby="invoice-tab">
|
||||
<div>
|
||||
<div class="settings-box-container">
|
||||
@@ -342,14 +310,14 @@ class="invoice_form">
|
||||
fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M11.5 14.0116C9.45338 13.9164 7.38334 14.4064 5.57757 15.4816C4.1628 16.324 0.453366 18.0441 2.71266 20.1966C3.81631 21.248 5.04549 22 6.59087 22H12"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round"
|
||||
stroke="#C52127" stroke-width="1.5" stroke-linecap="round"
|
||||
stroke-linejoin="round" />
|
||||
<path
|
||||
d="M15.5 6.5C15.5 8.98528 13.4853 11 11 11C8.51472 11 6.5 8.98528 6.5 6.5C6.5 4.01472 8.51472 2 11 2C13.4853 2 15.5 4.01472 15.5 6.5Z"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" />
|
||||
stroke="#C52127" stroke-width="1.5" />
|
||||
<path
|
||||
d="M18 20.7143V22M18 20.7143C16.8432 20.7143 15.8241 20.1461 15.2263 19.2833M18 20.7143C19.1568 20.7143 20.1759 20.1461 20.7737 19.2833M15.2263 19.2833L14.0004 20.0714M15.2263 19.2833C14.8728 18.773 14.6667 18.1597 14.6667 17.5C14.6667 16.8403 14.8727 16.2271 15.2262 15.7169M20.7737 19.2833L21.9996 20.0714M20.7737 19.2833C21.1272 18.773 21.3333 18.1597 21.3333 17.5C21.3333 16.8403 21.1273 16.2271 20.7738 15.7169M18 14.2857C19.1569 14.2857 20.1761 14.854 20.7738 15.7169M18 14.2857C16.8431 14.2857 15.8239 14.854 15.2262 15.7169M18 14.2857V13M20.7738 15.7169L22 14.9286M15.2262 15.7169L14 14.9286"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" />
|
||||
stroke="#C52127" stroke-width="1.5" stroke-linecap="round" />
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
@@ -362,7 +330,6 @@ class="invoice_form">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="Currencies" role="tabpanel" aria-labelledby="invoice-tab">
|
||||
<div>
|
||||
<div class="settings-box-container">
|
||||
@@ -375,10 +342,10 @@ class="text-decoration-none text-dark">
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M3.16602 12C3.16602 7.77027 3.16602 5.6554 4.36399 4.25276C4.5341 4.05358 4.7196 3.86808 4.91878 3.69797C6.32142 2.5 8.43629 2.5 12.666 2.5C16.8957 2.5 19.0106 2.5 20.4132 3.69797C20.6124 3.86808 20.7979 4.05358 20.968 4.25276C22.166 5.6554 22.166 7.77027 22.166 12C22.166 16.2297 22.166 18.3446 20.968 19.7472C20.7979 19.9464 20.6124 20.1319 20.4132 20.302C19.0106 21.5 16.8957 21.5 12.666 21.5C8.43629 21.5 6.32142 21.5 4.91878 20.302C4.7196 20.1319 4.5341 19.9464 4.36399 19.7472C3.16602 18.3446 3.16602 16.2297 3.16602 12Z"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" />
|
||||
stroke="#C52127" stroke-width="1.5" />
|
||||
<path
|
||||
d="M15.3762 10.063C15.2771 9.30039 14.4014 8.06817 12.8268 8.06814C10.9972 8.06811 10.2274 9.08141 10.0712 9.58806C9.82746 10.2657 9.8762 11.659 12.0207 11.8109C14.7014 12.0009 15.7753 12.3174 15.6387 13.958C15.502 15.5985 14.0077 15.953 12.8268 15.9149C11.6458 15.877 9.71365 15.3344 9.63867 13.8752M12.6394 7V8.07177M12.6394 15.9051V16.9999"
|
||||
stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" />
|
||||
stroke="#C52127" stroke-width="1.5" stroke-linecap="round" />
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
@@ -393,7 +360,7 @@ class="text-decoration-none text-dark">
|
||||
</div>
|
||||
|
||||
@if (moduleCheck('MarketingAddon'))
|
||||
<div class="tab-pane fade" id="sms" role="tabpanel" aria-labelledby="sms-tab">
|
||||
<div class="tab-pane fade" id="sms" role="tabpanel" aria-labelledby="invoice-tab">
|
||||
<div>
|
||||
<div class="settings-box-container">
|
||||
<a href="{{ route('business.sms-gateway-settings.index') }}" class="text-decoration-none text-dark">
|
||||
@@ -401,10 +368,10 @@ class="text-decoration-none text-dark">
|
||||
<div class="d-flex align-items-center jusitfy-content-center gap-3">
|
||||
<div class="settings-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10 18.332C9.31817 18.332 8.66683 18.0569 7.36411 17.5066C4.12137 16.1368 2.5 15.4519 2.5 14.2998C2.5 13.9772 2.5 8.38578 2.5 5.83203M10 18.332C10.6818 18.332 11.3332 18.0569 12.6359 17.5066C15.8787 16.1368 17.5 15.4519 17.5 14.2998V5.83203M10 18.332V9.46103" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M6.93827 8.07745L4.50393 6.89951C3.16797 6.25305 2.5 5.92983 2.5 5.41797C2.5 4.90611 3.16797 4.58289 4.50393 3.93643L6.93827 2.75849C8.44067 2.03148 9.19192 1.66797 10 1.66797C10.8081 1.66797 11.5593 2.03147 13.0617 2.75849L15.4961 3.93643C16.832 4.58289 17.5 4.90611 17.5 5.41797C17.5 5.92983 16.832 6.25305 15.4961 6.89951L13.0617 8.07745C11.5593 8.80447 10.8081 9.16797 10 9.16797C9.19192 9.16797 8.44067 8.80447 6.93827 8.07745Z" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M5 10L6.66667 10.8333" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M14.1673 3.33594L5.83398 7.5026" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M10 18.332C9.31817 18.332 8.66683 18.0569 7.36411 17.5066C4.12137 16.1368 2.5 15.4519 2.5 14.2998C2.5 13.9772 2.5 8.38578 2.5 5.83203M10 18.332C10.6818 18.332 11.3332 18.0569 12.6359 17.5066C15.8787 16.1368 17.5 15.4519 17.5 14.2998V5.83203M10 18.332V9.46103" stroke="#C52127" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M6.93827 8.07745L4.50393 6.89951C3.16797 6.25305 2.5 5.92983 2.5 5.41797C2.5 4.90611 3.16797 4.58289 4.50393 3.93643L6.93827 2.75849C8.44067 2.03148 9.19192 1.66797 10 1.66797C10.8081 1.66797 11.5593 2.03147 13.0617 2.75849L15.4961 3.93643C16.832 4.58289 17.5 4.90611 17.5 5.41797C17.5 5.92983 16.832 6.25305 15.4961 6.89951L13.0617 8.07745C11.5593 8.80447 10.8081 9.16797 10 9.16797C9.19192 9.16797 8.44067 8.80447 6.93827 8.07745Z" stroke="#C52127" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M5 10L6.66667 10.8333" stroke="#C52127" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M14.1673 3.33594L5.83398 7.5026" stroke="#C52127" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
@@ -418,111 +385,6 @@ class="text-decoration-none text-dark">
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (moduleCheck('MarketingAddon'))
|
||||
<div class="tab-pane fade" id="email" role="tabpanel" aria-labelledby="email-tab">
|
||||
<div>
|
||||
<div class="settings-box-container">
|
||||
<a href="{{ route('business.email-settings.index') }}" class="text-decoration-none text-dark">
|
||||
<div class="setting-box">
|
||||
<div class="d-flex align-items-center jusitfy-content-center gap-3">
|
||||
<div class="settings-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10 18.332C9.31817 18.332 8.66683 18.0569 7.36411 17.5066C4.12137 16.1368 2.5 15.4519 2.5 14.2998C2.5 13.9772 2.5 8.38578 2.5 5.83203M10 18.332C10.6818 18.332 11.3332 18.0569 12.6359 17.5066C15.8787 16.1368 17.5 15.4519 17.5 14.2998V5.83203M10 18.332V9.46103" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M6.93827 8.07745L4.50393 6.89951C3.16797 6.25305 2.5 5.92983 2.5 5.41797C2.5 4.90611 3.16797 4.58289 4.50393 3.93643L6.93827 2.75849C8.44067 2.03148 9.19192 1.66797 10 1.66797C10.8081 1.66797 11.5593 2.03147 13.0617 2.75849L15.4961 3.93643C16.832 4.58289 17.5 4.90611 17.5 5.41797C17.5 5.92983 16.832 6.25305 15.4961 6.89951L13.0617 8.07745C11.5593 8.80447 10.8081 9.16797 10 9.16797C9.19192 9.16797 8.44067 8.80447 6.93827 8.07745Z" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M5 10L6.66667 10.8333" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M14.1673 3.33594L5.83398 7.5026" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
<h6>{{__('Email Settings')}}</h6>
|
||||
<small class="text-muted d-block">{{__('View and update email settings.')}}</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="tab-pane fade" id="theme" role="tabpanel" aria-labelledby="theme-tab">
|
||||
<form action="{{ route('business.theme.update') }}" method="POST" class="ajaxform">
|
||||
@csrf
|
||||
<div class="kot-color-wrapper">
|
||||
<div class="kot-color-item">
|
||||
<span class="kot-label">{{ __('Primary Color') }}</span>
|
||||
|
||||
<div class="kot-input-box">
|
||||
<div class="kot-color-preview" style="background:{{ $theme_settings['primary_color'] ?? '#C52127' }};"></div>
|
||||
<input type="text" value="{{ $theme_settings['primary_color'] ?? '#C52127' }}" readonly>
|
||||
<label class="kot-picker-btn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.1958 5.82812L5.96596 11.058M5.96596 11.058L4.02273 13.0012C3.27141 13.7525 2.89574 14.1282 2.69787 14.606C2.5 15.0836 2.5 15.6149 2.5 16.6775V17.4948H3.31735C4.37988 17.4948 4.91115 17.4948 5.38886 17.297C5.86657 17.099 6.24223 16.7234 6.99356 15.972L11.9076 11.058M5.96596 11.058H11.9076M11.9076 11.058L14.1667 8.79896" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M16.0066 6.99057L17.3493 8.33333M16.0066 6.99057L16.7248 6.27235C16.9685 6.02859 17.0904 5.90671 17.1752 5.78774C17.6074 5.18063 17.6074 4.36627 17.1752 3.75916C17.0904 3.6402 16.9685 3.51831 16.7248 3.27456C16.481 3.03081 16.3592 2.90891 16.2402 2.82421C15.6331 2.39193 14.8187 2.39193 14.2116 2.82421C14.0927 2.90891 13.9708 3.03079 13.727 3.27456L13.0088 3.99277M16.0066 6.99057L13.0088 3.99277M13.0088 3.99277L11.666 2.65001" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
<input type="color" name="primary_color" value="{{ $theme_settings['primary_color'] ?? '#C52127' }}" id="primaryColor">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="kot-color-item">
|
||||
<span class="kot-label">{{ __('Secondary Color') }}</span>
|
||||
|
||||
<div class="kot-input-box">
|
||||
<div class="kot-color-preview" style="background:{{ $theme_settings['secondary_color'] ?? '#F68A3D' }};"></div>
|
||||
<input type="text" value="{{ $theme_settings['secondary_color'] ?? '#F68A3D' }}"readonly>
|
||||
<label class="kot-picker-btn secondary">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.1958 5.82812L5.96596 11.058M5.96596 11.058L4.02273 13.0012C3.27141 13.7525 2.89574 14.1282 2.69787 14.606C2.5 15.0836 2.5 15.6149 2.5 16.6775V17.4948H3.31735C4.37988 17.4948 4.91115 17.4948 5.38886 17.297C5.86657 17.099 6.24223 16.7234 6.99356 15.972L11.9076 11.058M5.96596 11.058H11.9076M11.9076 11.058L14.1667 8.79896" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M16.0066 6.99057L17.3493 8.33333M16.0066 6.99057L16.7248 6.27235C16.9685 6.02859 17.0904 5.90671 17.1752 5.78774C17.6074 5.18063 17.6074 4.36627 17.1752 3.75916C17.0904 3.6402 16.9685 3.51831 16.7248 3.27456C16.481 3.03081 16.3592 2.90891 16.2402 2.82421C15.6331 2.39193 14.8187 2.39193 14.2116 2.82421C14.0927 2.90891 13.9708 3.03079 13.727 3.27456L13.0088 3.99277M16.0066 6.99057L13.0088 3.99277M13.0088 3.99277L11.666 2.65001" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
<input type="color" name="secondary_color" value="{{ $theme_settings['secondary_color'] ?? '#F68A3D' }}" id="secondaryColor">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="kot-color-item">
|
||||
<span class="kot-label">{{ __('Sidebar Color') }}</span>
|
||||
|
||||
<div class="kot-input-box">
|
||||
<div class="kot-color-preview" style="background:{{ $theme_settings['sidebar_color'] ?? '#201415' }};"></div>
|
||||
<input type="text" value="{{ $theme_settings['sidebar_color'] ?? '#201415' }}" readonly>
|
||||
<label class="kot-picker-btn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.1958 5.82812L5.96596 11.058M5.96596 11.058L4.02273 13.0012C3.27141 13.7525 2.89574 14.1282 2.69787 14.606C2.5 15.0836 2.5 15.6149 2.5 16.6775V17.4948H3.31735C4.37988 17.4948 4.91115 17.4948 5.38886 17.297C5.86657 17.099 6.24223 16.7234 6.99356 15.972L11.9076 11.058M5.96596 11.058H11.9076M11.9076 11.058L14.1667 8.79896" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M16.0066 6.99057L17.3493 8.33333M16.0066 6.99057L16.7248 6.27235C16.9685 6.02859 17.0904 5.90671 17.1752 5.78774C17.6074 5.18063 17.6074 4.36627 17.1752 3.75916C17.0904 3.6402 16.9685 3.51831 16.7248 3.27456C16.481 3.03081 16.3592 2.90891 16.2402 2.82421C15.6331 2.39193 14.8187 2.39193 14.2116 2.82421C14.0927 2.90891 13.9708 3.03079 13.727 3.27456L13.0088 3.99277M16.0066 6.99057L13.0088 3.99277M13.0088 3.99277L11.666 2.65001" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
<input type="color" name="sidebar_color" value="{{ $theme_settings['sidebar_color'] ?? '#201415' }}" id="sidebarColor">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="kot-color-item">
|
||||
<span class="kot-label">{{ __('Accent Color') }}</span>
|
||||
<div class="kot-input-box">
|
||||
<div class="kot-color-preview" style="background:{{ $theme_settings['accent_color'] ?? '#fef0f1' }};"></div>
|
||||
<input type="text" value="{{ $theme_settings['accent_color'] ?? '#fef0f1' }}" readonly>
|
||||
<label class="kot-picker-btn">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.1958 5.82812L5.96596 11.058M5.96596 11.058L4.02273 13.0012C3.27141 13.7525 2.89574 14.1282 2.69787 14.606C2.5 15.0836 2.5 15.6149 2.5 16.6775V17.4948H3.31735C4.37988 17.4948 4.91115 17.4948 5.38886 17.297C5.86657 17.099 6.24223 16.7234 6.99356 15.972L11.9076 11.058M5.96596 11.058H11.9076M11.9076 11.058L14.1667 8.79896" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M16.0066 6.99057L17.3493 8.33333M16.0066 6.99057L16.7248 6.27235C16.9685 6.02859 17.0904 5.90671 17.1752 5.78774C17.6074 5.18063 17.6074 4.36627 17.1752 3.75916C17.0904 3.6402 16.9685 3.51831 16.7248 3.27456C16.481 3.03081 16.3592 2.90891 16.2402 2.82421C15.6331 2.39193 14.8187 2.39193 14.2116 2.82421C14.0927 2.90891 13.9708 3.03079 13.727 3.27456L13.0088 3.99277M16.0066 6.99057L13.0088 3.99277M13.0088 3.99277L11.666 2.65001" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
<input type="color" name="accent_color" value="{{ $theme_settings['accent_color'] ?? '#fef0f1' }}" id="accentColor">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="text-center mt-5">
|
||||
<button type="submit" class="theme-btn m-2 submit-btn">{{ __('Update') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,6 +27,16 @@
|
||||
</svg>
|
||||
</h3>
|
||||
|
||||
<div class="d-flex align-items-center mb-3">
|
||||
<input type="hidden" name="show_product_price" value="0">
|
||||
<input id="product_price" class="delete-checkbox-item multi-delete" type="checkbox"
|
||||
name="show_product_price" value="1"
|
||||
{{ is_null($product_setting) || is_null($product_setting->modules) || (optional($product_setting->modules)['show_product_price'] ?? false) ? 'checked' : '' }}>
|
||||
<label for="product_price">
|
||||
{{__('Product Price')}}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="d-flex align-items-center mb-3">
|
||||
<input type="hidden" name="show_product_code" value="0">
|
||||
<input id="product_code" class="delete-checkbox-item multi-delete" type="checkbox"
|
||||
@@ -35,13 +45,6 @@
|
||||
<label for="product_code">{{__('Product Code')}}</label>
|
||||
</div>
|
||||
|
||||
<div class="d-flex align-items-center mb-3">
|
||||
<input type="hidden" name="show_hsn_code" value="0">
|
||||
<input id="hsn_code" class="delete-checkbox-item multi-delete" type="checkbox" name="show_hsn_code" value="1"
|
||||
{{ optional($product_setting?->modules)['show_hsn_code'] === '1' ? 'checked' : '' }}>
|
||||
<label for="hsn_code">{{__('HSN Code')}}</label>
|
||||
</div>
|
||||
|
||||
<div class="d-flex align-items-center mb-3">
|
||||
<input type="hidden" name="show_product_stock" value="0">
|
||||
<input id="stock" class="delete-checkbox-item multi-delete" type="checkbox"
|
||||
@@ -54,7 +57,7 @@
|
||||
<input type="hidden" name="show_product_unit" value="0">
|
||||
<input id="unit" class="delete-checkbox-item multi-delete" type="checkbox"
|
||||
name="show_product_unit" value="1"
|
||||
{{ optional($product_setting?->modules)['show_product_unit'] === '1' ? 'checked' : '' }}>
|
||||
{{ is_null($product_setting) || is_null($product_setting->modules) || (optional($product_setting->modules)['show_product_unit'] ?? false) ? 'checked' : '' }}>
|
||||
<label for="unit">{{__('Product Unit')}}</label>
|
||||
</div>
|
||||
|
||||
@@ -102,7 +105,7 @@
|
||||
<input type="hidden" name="show_alert_qty" value="0">
|
||||
<input id="quantity" class="delete-checkbox-item multi-delete" type="checkbox"
|
||||
name="show_alert_qty" value="1"
|
||||
{{ optional($product_setting?->modules)['show_alert_qty'] === '1' ? 'checked' : '' }}>
|
||||
{{ is_null($product_setting) || is_null($product_setting->modules) || (optional($product_setting->modules)['show_alert_qty'] ?? false) ? 'checked' : '' }}>
|
||||
<label for="quantity">{{__('Low Stock Alert')}}</label>
|
||||
</div>
|
||||
|
||||
@@ -454,8 +457,6 @@ class="form-control mfg-my"
|
||||
{{ optional($product_setting?->modules)['allow_product_discount'] === '1' ? 'checked' : '' }}>
|
||||
<label for="allow_product_discount">{{ __('Product Discount') }}</label>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
|
||||
@@ -5,6 +5,13 @@
|
||||
@endsection
|
||||
|
||||
@php
|
||||
$file = base_path('lang/countrylist.json');
|
||||
|
||||
if (file_exists($file)) {
|
||||
$countries = json_decode(file_get_contents($file), true);
|
||||
} else {
|
||||
$countries = [];
|
||||
}
|
||||
$type = request('type') !== 'Supplier' ? 'Customer' : 'Supplier';
|
||||
@endphp
|
||||
|
||||
@@ -20,18 +27,12 @@
|
||||
|
||||
<h4>{{ __('Add new :type', ['type' => __($type)]) }}</h4>
|
||||
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<a data-bs-toggle="modal" data-bs-target="#parties-import-modal" class="save-publish-btn" href="#">
|
||||
{{__('Bulk Upload')}}
|
||||
</a>
|
||||
|
||||
@usercan('parties.read')
|
||||
<a href="{{ route('business.parties.index', ['type' => request('type')]) }}"
|
||||
class="add-order-btn rounded-2 {{ Route::is('business.parties.create') ? 'active' : '' }}">
|
||||
<i class="far fa-list" aria-hidden="true"></i>{{ __(':type List', ['type' => __($type)]) }}
|
||||
</a>
|
||||
@endusercan
|
||||
</div>
|
||||
@usercan('parties.read')
|
||||
<a href="{{ route('business.parties.index', ['type' => request('type')]) }}"
|
||||
class="add-order-btn rounded-2 {{ Route::is('business.parties.create') ? 'active' : '' }}">
|
||||
<i class="far fa-list" aria-hidden="true"></i>{{ __(':type List', ['type' => __($type)]) }}
|
||||
</a>
|
||||
@endusercan
|
||||
</div>
|
||||
|
||||
<div class="order-form-section p-16">
|
||||
@@ -42,11 +43,11 @@ class="add-order-btn rounded-2 {{ Route::is('business.parties.create') ? 'active
|
||||
<div class="row col-lg-9">
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __($type . ' Name') }}</label>
|
||||
<input type="text" name="name" required class="form-control" placeholder="{{ __('Enter :type Name', ['type' => __($type)]) }}">
|
||||
<input type="text" name="name" required class="form-control" placeholder="{{ __('Enter '.$type.' Name') }}">
|
||||
</div>
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Phone Number') }}</label>
|
||||
<input type="text" name="phone" class="form-control" placeholder="{{ __('Enter Phone Number') }}">
|
||||
<input type="number" name="phone" class="form-control" placeholder="{{ __('Enter Phone Number') }}">
|
||||
</div>
|
||||
@if (request('type') !== 'Supplier')
|
||||
<div class="col-lg-6 mb-2">
|
||||
@@ -94,12 +95,6 @@ class="add-order-btn rounded-2 {{ Route::is('business.parties.create') ? 'active
|
||||
<label>{{ __('Address') }}</label>
|
||||
<input type="text" name="address" class="form-control" placeholder="{{ __('Enter Address') }}">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Tax No') }}</label>
|
||||
<input type="text" name="tax_no" class="form-control" placeholder="{{ __('Enter tax') }}">
|
||||
</div>
|
||||
|
||||
<div class="accordion" id="customAccordion">
|
||||
<div class="accordion-item border-0">
|
||||
<h2 class="accordion-header">
|
||||
@@ -111,39 +106,31 @@ class="add-order-btn rounded-2 {{ Route::is('business.parties.create') ? 'active
|
||||
data-bs-parent="#customAccordion">
|
||||
<div class="accordion-body fst-italic text-secondary p-0">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Country') }}</label>
|
||||
<select name="country_id" id="country_id" class="form-control">
|
||||
<option value="">{{ __('Select a country') }}</option>
|
||||
@foreach ($countries as $country)
|
||||
<option value="{{ $country->id }}">{{ __($country->name) }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('State') }}</label>
|
||||
<select name="state_id" id="state_id" class="form-control">
|
||||
<option value="">{{ __('Select state') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('City') }}</label>
|
||||
<input type="text" name="billing_address[city]" class="form-control" placeholder="{{ __('Enter city') }}">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Zip Code') }}</label>
|
||||
<input type="text" name="billing_address[zip_code]" class="form-control" placeholder="{{ __('Enter zip code') }}">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Address line 1') }}</label>
|
||||
<input type="text" name="billing_address[address]" class="form-control" placeholder="{{ __('Enter address') }}">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('City') }}</label>
|
||||
<input type="text" name="billing_address[city]" class="form-control" placeholder="{{ __('Enter city') }}">
|
||||
</div>
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('State') }}</label>
|
||||
<input type="text" name="billing_address[state]" class="form-control" placeholder="{{ __('Enter state') }}">
|
||||
</div>
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Zip Code') }}</label>
|
||||
<input type="text" name="billing_address[zip_code]" class="form-control" placeholder="{{ __('Enter zip code') }}">
|
||||
</div>
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Country') }}</label>
|
||||
<select name="billing_address[country]" class="form-control">
|
||||
<option value="">{{ __('Select a country') }}</option>
|
||||
@foreach ($countries as $country)
|
||||
<option value="{{ $country['name'] }}">{{ __($country['name']) }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -197,7 +184,7 @@ class="add-order-btn rounded-2 {{ Route::is('business.parties.create') ? 'active
|
||||
<img src="{{ asset('assets/images/icons/img.png') }}" alt="icon" />
|
||||
</div>
|
||||
<p>{{__('Drag & drop your Image')}}</p>
|
||||
<p>{{__('or')}} <span class="browse-text">{{__('Browse')}}</span></p>
|
||||
<p>or <span class="browse-text">{{__('Browse')}}</span></p>
|
||||
</div>
|
||||
</div>
|
||||
<input type="file" name="image" id="fileInput" accept="image/*">
|
||||
@@ -218,11 +205,4 @@ class="add-order-btn rounded-2 {{ Route::is('business.parties.create') ? 'active
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" value="{{ route('business.get-states.index') }}" id="get-state">
|
||||
|
||||
@endsection
|
||||
|
||||
@push('modal')
|
||||
@include('business::parties.bulk-upload.parties-import')
|
||||
@endpush
|
||||
|
||||
@@ -65,21 +65,9 @@ class="table-product-img">
|
||||
@endusercan
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('business.parties.advance-payments', [$party->id, 'type' => request('type')]) }}">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" class="pt-1 me-0" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M1.66602 3.75H7.29715C7.96019 3.75 8.5961 4.01339 9.06493 4.48223L11.666 7.08333" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M4.16602 11.25H1.66602" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M7.08268 6.25L8.74935 7.91667C9.2096 8.37692 9.2096 9.12308 8.74935 9.58333C8.28912 10.0436 7.54292 10.0436 7.08268 9.58333L5.83268 8.33333C5.11544 9.05058 3.97994 9.13125 3.16847 8.52267L2.91602 8.33333" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M4.16602 9.16536V12.9154C4.16602 14.4867 4.16602 15.2724 4.65417 15.7605C5.14232 16.2487 5.928 16.2487 7.49935 16.2487H14.9993C16.5707 16.2487 17.3563 16.2487 17.8445 15.7605C18.3327 15.2724 18.3327 14.4867 18.3327 12.9154V10.4154C18.3327 8.84403 18.3327 8.05834 17.8445 7.57019C17.3563 7.08203 16.5707 7.08203 14.9993 7.08203H7.91602" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M12.7077 11.6654C12.7077 12.4708 12.0548 13.1237 11.2493 13.1237C10.4439 13.1237 9.79102 12.4708 9.79102 11.6654C9.79102 10.8599 10.4439 10.207 11.2493 10.207C12.0548 10.207 12.7077 10.8599 12.7077 11.6654Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
{{ $party->type == 'Supplier' ? __('Advance Pay') : __('Advance Collect') }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('business.parties.edit', [$party->id, 'type' => request('type')]) }}">
|
||||
<i class="fal fa-edit"></i>{{ __('Edit') }}
|
||||
</a>
|
||||
<a
|
||||
href="{{ route('business.parties.edit', [$party->id, 'type' => request('type')]) }}"><i
|
||||
class="fal fa-edit"></i>{{ __('Edit') }}</a>
|
||||
</li>
|
||||
<li>
|
||||
@usercan('parties.delete')
|
||||
|
||||
@@ -5,6 +5,13 @@
|
||||
@endsection
|
||||
|
||||
@php
|
||||
$file = base_path('lang/countrylist.json');
|
||||
|
||||
if (file_exists($file)) {
|
||||
$countries = json_decode(file_get_contents($file), true);
|
||||
} else {
|
||||
$countries = [];
|
||||
}
|
||||
$type = request('type') !== 'Supplier' ? 'Customer' : 'Supplier';
|
||||
@endphp
|
||||
|
||||
@@ -42,7 +49,7 @@ class="ajaxform_instant_reload">
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Phone') }}</label>
|
||||
<input type="text" value="{{ $party->phone }}" name="phone"
|
||||
<input type="number" value="{{ $party->phone }}" name="phone"
|
||||
class="form-control" placeholder="{{ __('Enter phone number') }}">
|
||||
</div>
|
||||
|
||||
@@ -70,8 +77,7 @@ class="form-control" placeholder="{{ __('Enter phone number') }}">
|
||||
@endif
|
||||
|
||||
@php
|
||||
$branch_id = auth()->user()->branch_id ?? auth()->user()->active_branch_id ?? null;
|
||||
$branch_logic = $party->branch_id != $branch_id;
|
||||
$branch_logic = $party->branch_id != (auth()->user()->active_branch?->id);
|
||||
@endphp
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
@@ -110,11 +116,6 @@ class="form-control" placeholder="{{ __('Enter Email') }}">
|
||||
class="form-control" placeholder="{{ __('Enter Address') }}">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Tax No') }}</label>
|
||||
<input type="text" value="{{ $party->tax_no }}" name="tax_no" class="form-control" placeholder="{{ __('Enter tax') }}">
|
||||
</div>
|
||||
|
||||
<div class="accordion" id="customAccordion">
|
||||
<div class="accordion-item border-0">
|
||||
<h2 class="accordion-header">
|
||||
@@ -130,22 +131,12 @@ class="accordion-button address-accordion collapsed fw-medium text-primary bg-t
|
||||
data-bs-parent="#customAccordion">
|
||||
<div class="accordion-body fst-italic text-secondary p-0">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Country') }}</label>
|
||||
<select name="country_id" id="country_id" class="form-control">
|
||||
<option value="">{{ __('Select a country') }}</option>
|
||||
@foreach ($countries as $country)
|
||||
<option value="{{ $country->id }}" @selected(($party->country_id ?? '') == $country->id)>{{ __($country->name) }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('State') }}</label>
|
||||
<select name="state_id" id="state_id" class="form-control" data-selected="{{ $party->state_id ?? '' }}">
|
||||
<option value="">{{ __('Select state') }}</option>
|
||||
</select>
|
||||
<label>{{ __('Address') }}</label>
|
||||
<input type="text" name="billing_address[address]"
|
||||
value="{{ $party->billing_address['address'] ?? '' }}"
|
||||
class="form-control"
|
||||
placeholder="{{ __('Enter address') }}">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
@@ -156,6 +147,14 @@ class="form-control"
|
||||
placeholder="{{ __('Enter city') }}">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('State') }}</label>
|
||||
<input type="text" name="billing_address[state]"
|
||||
value="{{ $party->billing_address['state'] ?? '' }}"
|
||||
class="form-control"
|
||||
placeholder="{{ __('Enter state') }}">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Zip Code') }}</label>
|
||||
<input type="text" name="billing_address[zip_code]"
|
||||
@@ -164,18 +163,24 @@ class="form-control"
|
||||
placeholder="{{ __('Enter zip code') }}">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Address') }}</label>
|
||||
<input type="text" name="billing_address[address]"
|
||||
value="{{ $party->billing_address['address'] ?? '' }}"
|
||||
class="form-control"
|
||||
placeholder="{{ __('Enter address') }}">
|
||||
</div>
|
||||
|
||||
@php
|
||||
$billing = is_array($party->billing_address) ? $party->billing_address : json_decode($party->billing_address, true) ?? [];
|
||||
@endphp
|
||||
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Country') }}</label>
|
||||
<select name="billing_address[country]"
|
||||
class="form-control">
|
||||
<option value="">{{ __('Select a country') }}
|
||||
</option>
|
||||
@foreach ($countries as $country)
|
||||
<option value="{{ $country['name'] }}"
|
||||
@selected(($billing['country'] ?? '') == $country['name'])>
|
||||
{{ __($country['name']) }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -199,7 +204,7 @@ class="accordion-button address-accordion fw-medium text-dark bg-transparent sha
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Address') }}</label>
|
||||
<input type="text" name="shipping_address[address]"
|
||||
value="{{ $party->shipping_address['address'] ?? '' }}"
|
||||
value="{{ $party->billing_address['address'] ?? '' }}"
|
||||
class="form-control"
|
||||
placeholder="{{ __('Enter address') }}">
|
||||
</div>
|
||||
@@ -207,7 +212,7 @@ class="form-control"
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('City') }}</label>
|
||||
<input type="text" name="shipping_address[city]"
|
||||
value="{{ $party->shipping_address['city'] ?? '' }}"
|
||||
value="{{ $party->billing_address['city'] ?? '' }}"
|
||||
class="form-control"
|
||||
placeholder="{{ __('Enter city') }}">
|
||||
</div>
|
||||
@@ -215,7 +220,7 @@ class="form-control"
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('State') }}</label>
|
||||
<input type="text" name="shipping_address[state]"
|
||||
value="{{ $party->shipping_address['state'] ?? '' }}"
|
||||
value="{{ $party->billing_address['state'] ?? '' }}"
|
||||
class="form-control"
|
||||
placeholder="{{ __('Enter state') }}">
|
||||
</div>
|
||||
@@ -223,7 +228,7 @@ class="form-control"
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Zip Code') }}</label>
|
||||
<input type="text" name="shipping_address[zip_code]"
|
||||
value="{{ $party->shipping_address['zip_code'] ?? '' }}"
|
||||
value="{{ $party->billing_address['zip_code'] ?? '' }}"
|
||||
class="form-control"
|
||||
placeholder="{{ __('Enter zip code') }}">
|
||||
</div>
|
||||
@@ -260,7 +265,7 @@ class="form-control">
|
||||
<img src="{{ asset( $party->image ?? 'assets/images/icons/img.png') }}" alt="icon" />
|
||||
</div>
|
||||
<p>{{__('Drag & drop your Image')}}</p>
|
||||
<p>{{__('or')}} <span class="browse-text">{{__('Browse')}}</span></p>
|
||||
<p>or <span class="browse-text">{{__('Browse')}}</span></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -285,6 +290,5 @@ class="theme-btn border-btn m-2">{{ __('Cancel') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" value="{{ route('business.get-states.index') }}" id="get-state">
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@@ -55,16 +55,16 @@
|
||||
<div class="table-top-btn-group d-print-none">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.customer-ledger.csv') }}">
|
||||
<a href="{{ route('business.customer-ledger.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.customer-ledger.excel') }}">
|
||||
<a href="{{ route('business.customer-ledger.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.customer-ledger.pdf') }}">
|
||||
<a target="blank" href="{{ route('business.customer-ledger.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Customer Ledger List') }}</h4>
|
||||
{{-- <p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration: 14-12-2025 to 24-12-2025') }}</p> --}}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -25,41 +25,13 @@
|
||||
<td class="text-start d-print-none">{{ $index + 1 }}</td>
|
||||
<td class="text-start">{{ formatted_date($row['date']) }}</td>
|
||||
|
||||
@php
|
||||
$invoice_no = $row['invoice_no'] ?? null;
|
||||
$invoice_route = null;
|
||||
|
||||
if ($invoice_no) {
|
||||
if ($row['platform'] === 'Sales') {
|
||||
$businessId = $row['business_id'] ?? null;
|
||||
$tax_invoice = moduleCheck('TaxInvoiceAddon') && invoice_setting($businessId) == 'standard_a4';
|
||||
|
||||
$invoice_route = $tax_invoice
|
||||
? route('business.sales.tax.invoice', $row['id'])
|
||||
: route('business.sales.invoice', $row['id']);
|
||||
} else {
|
||||
$invoice_route = route('business.collect.dues.invoice', $row['id'] ?? '');
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
|
||||
<td class="text-start">
|
||||
@if($invoice_route)
|
||||
<a target="_blank" href="{{ $invoice_route }}" class="stock-view-data text-primary">
|
||||
{{ $invoice_no }}
|
||||
</a>
|
||||
@else
|
||||
{{ $invoice_no ?? '-' }}
|
||||
@endif
|
||||
<a target="_blank" href="{{ $row['platform'] === 'Sales' ? route('business.sales.invoice', $row['id'] ?? '') : route('business.collect.dues.invoice', $row['id'] ?? '') }}" class="stock-view-data text-primary">
|
||||
{{ $row['invoice_no'] ?? '-' }}
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td class="text-start">
|
||||
@if(in_array($row['platform'], ['Opening Collection', 'Opening Payment']))
|
||||
{{ $row['platform'] }}: {{ currency_format($row['amount'] ?? 0, currency: business_currency()) }}
|
||||
@else
|
||||
{{ $row['platform'] }}
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-start">{{ $row['platform'] }}</td>
|
||||
|
||||
<td class="text-start">{{ currency_format($row['credit_amount'], currency: business_currency() ) }}</td>
|
||||
|
||||
|
||||
@@ -25,24 +25,12 @@
|
||||
<td class="text-start">{{ formatted_date($row['date']) }}</td>
|
||||
|
||||
<td class="text-start">
|
||||
@if($row['invoice_no'] && $row['platform'] === 'Sales')
|
||||
<a target="_blank" href="{{ route('business.sales.invoice', $row['id'] ?? '') }}" class="stock-view-data text-primary">
|
||||
{{ $row['invoice_no'] }}
|
||||
</a>
|
||||
@elseif($row['invoice_no'])
|
||||
{{ $row['invoice_no'] }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
<a target="_blank" href="{{ $row['platform'] === 'Sales' ? route('business.sales.invoice', $row['id'] ?? '') : route('business.collect.dues.invoice', $row['id'] ?? '') }}" class="stock-view-data text-primary">
|
||||
{{ $row['invoice_no'] ?? '-' }}
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td class="d-print-none text-start">
|
||||
@if(in_array($row['platform'], ['Opening Collection', 'Opening Payment']))
|
||||
{{ $row['platform'] }}: {{ currency_format($row['amount'] ?? 0) }}
|
||||
@else
|
||||
{{ $row['platform'] }}
|
||||
@endif
|
||||
</td>
|
||||
<td class="d-print-none text-start">{{ $row['platform'] }}</td>
|
||||
|
||||
<td class="text-start">{{ currency_format($row['credit_amount']) }}</td>
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
<div class="gpt-up-down-arrow position-relative d-print-none custom-date-filter">
|
||||
<select name="duration" class="form-control custom-days">
|
||||
<option value="">{{ __('All Time') }}</option>
|
||||
<option value="">{{ __('All') }}</option>
|
||||
<option value="today"> {{ __('Today') }}</option>
|
||||
<option value="yesterday"> {{ __('Yesterday') }}</option>
|
||||
<option value="last_seven_days"> {{ __('Last 7 Days') }}</option>
|
||||
@@ -64,17 +64,17 @@
|
||||
<div class="table-top-btn-group d-print-none">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.single-customer-ledger.csv', $party->id) }}">
|
||||
<a href="{{ route('business.single-customer-ledger.csv', $party->id) }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.single-customer-ledger.excel', $party->id) }}">
|
||||
<a href="{{ route('business.single-customer-ledger.excel', $party->id) }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.single-customer-ledger.pdf', $party->id) }}">
|
||||
<a target="blank" href="{{ route('business.single-customer-ledger.pdf', $party->id) }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -5,19 +5,6 @@
|
||||
@include('business::print.header')
|
||||
<p style="text-align: center; margin: 0; padding: 0; margin-bottom:5px; font-size: 16px;">
|
||||
{{ $party->name }} ({{ __('Ledger')}})
|
||||
@if ($fromDate && $toDate)
|
||||
<p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration:') }}
|
||||
@if ($duration === 'today')
|
||||
{{ Carbon\Carbon::parse($fromDate)->format('d-m-Y') }}
|
||||
@elseif ($duration === 'yesterday')
|
||||
{{ Carbon\Carbon::parse($fromDate)->format('d-m-Y') }}
|
||||
@else
|
||||
{{ Carbon\Carbon::parse($fromDate)->format('d-m-Y') }}
|
||||
{{ __('to') }}
|
||||
{{ Carbon\Carbon::parse($toDate)->format('d-m-Y') }}
|
||||
@endif
|
||||
</p>
|
||||
@endif
|
||||
</p>
|
||||
@endsection
|
||||
|
||||
@@ -60,11 +47,7 @@
|
||||
</td>
|
||||
|
||||
<td style="border:1px solid gainsboro; text-align:center;">
|
||||
@if(in_array($row['platform'], ['Opening Collection', 'Opening Payment']))
|
||||
{{ $row['platform'] }}: {{ currency_format($row['amount'] ?? 0, currency: business_currency()) }}
|
||||
@else
|
||||
{{ $row['platform'] }}
|
||||
@endif
|
||||
{{ $row['platform'] }}
|
||||
</td>
|
||||
|
||||
<td style="border:1px solid gainsboro; text-align:center;">
|
||||
|
||||
@@ -48,12 +48,12 @@
|
||||
<tr>
|
||||
<td class="text-start fw-bold">{{__('Total')}}</td>
|
||||
<td></td>
|
||||
<td class="text-start fw-bold">{{ currency_format($totalSaleAmount, currency: business_currency()) }}</td>
|
||||
<td class="text-start fw-bold">{{ currency_format($parties->sum(fn($party) => $party->sales?->sum('totalAmount') ?? 0), currency: business_currency()) }}</td>
|
||||
<td class="text-start fw-bold">
|
||||
{{ currency_format($totalProfit, currency: business_currency()) }}
|
||||
{{ currency_format($parties->sum(fn($party) => $party->sales?->where('lossProfit', '>', 0)->sum('lossProfit') ?? 0), currency: business_currency()) }}
|
||||
</td>
|
||||
<td class="text-start fw-bold text-danger">
|
||||
{{ currency_format(abs($totalLoss), currency: business_currency()) }}
|
||||
{{ currency_format(abs($parties->sum(fn($party) => $party->sales?->where('lossProfit', '<', 0)->sum('lossProfit') ?? 0)), currency: business_currency()) }}
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
@@ -18,19 +18,19 @@
|
||||
<div class="col-lg-2 col-md-6">
|
||||
<div class="sales-card p-3 m-2 text-white">
|
||||
<p class="stat-title">{{ __('Sales Amount') }}</p>
|
||||
<p class="stat-value" id="totalSaleAmount">{{ currency_format($totalSaleAmount, currency: business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format($totalAmount, currency: business_currency()) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-6">
|
||||
<div class="profit-card p-3 m-2 text-white">
|
||||
<p class="stat-title">{{ __('Profit') }}</p>
|
||||
<p class="stat-value" id="totalProfit">{{ currency_format($totalProfit, currency: business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format($totalProfit, currency: business_currency()) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-12 ">
|
||||
<div class="loss-card p-3 m-2 text-white">
|
||||
<p class="stat-title">{{ __('Loss') }}</p>
|
||||
<p class="stat-value" id="totalLoss">{{ currency_format($totalLoss, currency: business_currency()) }}</p>
|
||||
<p class="stat-value">{{ currency_format(abs($totalLoss), currency: business_currency()) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -70,17 +70,17 @@
|
||||
<div class="table-top-btn-group d-print-none">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.party-loss-profit.csv') }}">
|
||||
<a href="{{ route('business.party-loss-profit.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.party-loss-profit.excel') }}">
|
||||
<a href="{{ route('business.party-loss-profit.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.party-loss-profit.pdf') }}">
|
||||
<a target="blank" href="{{ route('business.party-loss-profit.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Party Loss Profit Report') }}</h4>
|
||||
{{-- <p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration: 14-12-2025 to 24-12-2025') }}</p> --}}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
@foreach ($suppliers as $supplier)
|
||||
<tr>
|
||||
<td class="d-print-none">{{ $suppliers->firstItem() + $loop->index }}</td>
|
||||
<td class=" text-start">
|
||||
<td class="d-print-none text-start">
|
||||
<a href="{{ route('business.supplier-ledger.show', $supplier->id) }}" class="stock-view-data text-primary">
|
||||
{{ $supplier->name }}
|
||||
</a>
|
||||
|
||||
@@ -46,17 +46,17 @@
|
||||
<div class="table-top-btn-group d-print-none">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.supplier-ledger.csv') }}">
|
||||
<a href="{{ route('business.supplier-ledger.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.supplier-ledger.excel') }}">
|
||||
<a href="{{ route('business.supplier-ledger.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.supplier-ledger.pdf') }}">
|
||||
<a target="blank" href="{{ route('business.supplier-ledger.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Supplier Ledger List') }}</h4>
|
||||
{{-- <p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration: 14-12-2025 to 24-12-2025') }}</p> --}}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -25,41 +25,12 @@
|
||||
<td class="text-start">{{ $index + 1 }}</td>
|
||||
<td class="text-start">{{ formatted_date($row['date']) }}</td>
|
||||
|
||||
@php
|
||||
$invoice_no = $row['invoice_no'] ?? null;
|
||||
$invoice_route = null;
|
||||
|
||||
if ($invoice_no) {
|
||||
if ($row['platform'] === 'Purchase') {
|
||||
$businessId = $row['business_id'] ?? null;
|
||||
$tax_invoice = moduleCheck('TaxInvoiceAddon') && invoice_setting($businessId) == 'standard_a4';
|
||||
|
||||
$invoice_route = $tax_invoice
|
||||
? route('business.purchases.tax.invoice', $row['id'])
|
||||
: route('business.purchases.invoice', $row['id']);
|
||||
} else {
|
||||
$invoice_route = route('business.collect.dues.invoice', $row['id'] ?? '');
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
|
||||
<td class="text-start">
|
||||
@if($invoice_route)
|
||||
<a target="_blank" href="{{ $invoice_route }}" class="stock-view-data text-primary">
|
||||
{{ $invoice_no }}
|
||||
</a>
|
||||
@else
|
||||
{{ $invoice_no ?? '-' }}
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td class="text-start">
|
||||
@if(in_array($row['platform'], ['Opening Collection', 'Opening Payment']))
|
||||
{{ $row['platform'] }}: {{ currency_format($row['amount'] ?? 0, currency: business_currency()) }}
|
||||
@else
|
||||
{{ $row['platform'] }}
|
||||
@endif
|
||||
<a target="_blank" href="{{ $row['platform'] === 'Purchase' ? route('business.purchases.invoice', $row['id'] ?? '') : route('business.collect.dues.invoice', $row['id'] ?? '') }}" class="stock-view-data text-primary">
|
||||
{{ $row['invoice_no'] ?? '-' }} - {{ $row['id'] }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="d-print-none text-start">{{ $row['platform'] }}</td>
|
||||
<td class="text-start">{{ currency_format($row['credit_amount'], currency: business_currency()) }}</td>
|
||||
<td class="text-start">{{ currency_format($row['debit_amount'], currency: business_currency()) }}</td>
|
||||
<td class="text-start">{{ currency_format($row['balance'], currency: business_currency()) }}</td>
|
||||
|
||||
@@ -24,21 +24,9 @@
|
||||
<td class="text-start">{{ $index + 1 }}</td>
|
||||
<td class="text-start">{{ formatted_date($row['date']) }}</td>
|
||||
<td class="text-start">
|
||||
@if($row['invoice_no'] && $row['platform'] === 'Purchase')
|
||||
{{ $row['invoice_no'] }} - {{ $row['id'] }}
|
||||
@elseif($row['invoice_no'])
|
||||
{{ $row['invoice_no'] }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td class="d-print-none text-start">
|
||||
@if(in_array($row['platform'], ['Opening Collection', 'Opening Payment']))
|
||||
{{ $row['platform'] }}: {{ currency_format($row['amount'] ?? 0) }}
|
||||
@else
|
||||
{{ $row['platform'] }}
|
||||
@endif
|
||||
{{ $row['invoice_no'] ?? '-' }} - {{ $row['id'] }}
|
||||
</td>
|
||||
<td class="d-print-none text-start">{{ $row['platform'] }}</td>
|
||||
<td class="text-start">{{ currency_format($row['credit_amount']) }}</td>
|
||||
<td class="text-start">{{ currency_format($row['debit_amount']) }}</td>
|
||||
<td class="text-start">{{ currency_format($row['balance']) }}</td>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
<div class="gpt-up-down-arrow position-relative d-print-none custom-date-filter">
|
||||
<select name="duration" class="form-control custom-days">
|
||||
<option value="">{{ __('All Time') }}</option>
|
||||
<option value="">{{ __('All') }}</option>
|
||||
<option value="today"> {{ __('Today') }}</option>
|
||||
<option value="yesterday"> {{ __('Yesterday') }}</option>
|
||||
<option value="last_seven_days"> {{ __('Last 7 Days') }}</option>
|
||||
@@ -64,17 +64,17 @@
|
||||
<div class="table-top-btn-group d-print-none">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.single-supplier-ledger.csv', $party->id) }}">
|
||||
<a href="{{ route('business.single-supplier-ledger.csv', $party->id) }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.single-supplier-ledger.excel', $party->id) }}">
|
||||
<a href="{{ route('business.single-supplier-ledger.excel', $party->id) }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.single-supplier-ledger.pdf', $party->id) }}">
|
||||
<a target="blank" href="{{ route('business.single-supplier-ledger.pdf', $party->id) }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -5,19 +5,6 @@
|
||||
@include('business::print.header')
|
||||
<p style="text-align: center; margin: 0; padding: 0; margin-bottom:5px; font-size: 16px;">
|
||||
{{ $party->name }} ({{ __('Ledger')}})
|
||||
@if ($fromDate && $toDate)
|
||||
<p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration:') }}
|
||||
@if ($duration === 'today')
|
||||
{{ Carbon\Carbon::parse($fromDate)->format('d-m-Y') }}
|
||||
@elseif ($duration === 'yesterday')
|
||||
{{ Carbon\Carbon::parse($fromDate)->format('d-m-Y') }}
|
||||
@else
|
||||
{{ Carbon\Carbon::parse($fromDate)->format('d-m-Y') }}
|
||||
{{ __('to') }}
|
||||
{{ Carbon\Carbon::parse($toDate)->format('d-m-Y') }}
|
||||
@endif
|
||||
</p>
|
||||
@endif
|
||||
</p>
|
||||
@endsection
|
||||
|
||||
@@ -54,18 +41,10 @@
|
||||
{{ formatted_date($row['date']) }}
|
||||
</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">
|
||||
@if($row['invoice_no'])
|
||||
{{ $row['invoice_no'] }} - {{ $row['id'] }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
{{ $row['invoice_no'] ?? '-' }} - {{ $row['id'] }}
|
||||
</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">
|
||||
@if(in_array($row['platform'], ['Opening Collection', 'Opening Payment']))
|
||||
{{ $row['platform'] }}: {{ currency_format($row['amount'] ?? 0, currency: business_currency()) }}
|
||||
@else
|
||||
{{ $row['platform'] }}
|
||||
@endif
|
||||
{{ $row['platform'] }}
|
||||
</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">
|
||||
{{ currency_format($row['credit_amount'], currency: business_currency()) }}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
|
||||
<div class="table-top-form p-16">
|
||||
<form action="{{ route('business.top-customers.index') }}" method="GET" class="report-filter-form" table="#top-customers-data">
|
||||
<form action="{{ route('business.top-customers.index') }}" method="GET" class="filter-form" table="#top-customers-data">
|
||||
|
||||
<div class="table-top-left d-flex gap-3 ">
|
||||
<div class="table-search position-relative d-print-none">
|
||||
@@ -46,17 +46,17 @@
|
||||
<div class="table-top-btn-group d-print-none">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.top-customers.csv') }}">
|
||||
<a href="{{ route('business.top-customers.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.top-customers.excel') }}">
|
||||
<a href="{{ route('business.top-customers.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.top-customers.pdf') }}">
|
||||
<a target="blank" href="{{ route('business.top-customers.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Top 5 Customer Report List') }}</h4>
|
||||
{{-- <p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration: 14-12-2025 to 24-12-2025') }}</p> --}}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -37,17 +37,17 @@
|
||||
<div class="table-top-btn-group d-print-none">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.top-suppliers.csv') }}">
|
||||
<a href="{{ route('business.top-suppliers.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.top-suppliers.excel') }}">
|
||||
<a href="{{ route('business.top-suppliers.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.top-suppliers.pdf') }}">
|
||||
<a target="blank" href="{{ route('business.top-suppliers.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Top 5 Supplier Report List') }}</h4>
|
||||
{{-- <p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration: 14-12-2025 to 24-12-2025') }}</p> --}}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -1,27 +1,4 @@
|
||||
<style>
|
||||
:root {
|
||||
--clr-primary: var(--dynamic-primary, #c52127);
|
||||
--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;
|
||||
}
|
||||
/* Load Bangla font from storage/fonts */
|
||||
@font-face {
|
||||
font-family: 'NotoSans';
|
||||
@@ -438,7 +415,7 @@
|
||||
font-size: 20px;
|
||||
/* font-weight: 600; */
|
||||
color: white;
|
||||
background-color: var(--clr-primary);
|
||||
background-color: #c52127;
|
||||
padding: 5px 12px;
|
||||
border-radius: 30px;
|
||||
margin: 0;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
<th>{{ __('SL.') }}</th>
|
||||
<th>{{ __('Date') }}</th>
|
||||
<th>{{ __('Invoice') }}</th>
|
||||
<th>{{ __('Supplier') }}</th>
|
||||
<th>{{ __('Type') }}</th>
|
||||
<th>{{ __('Cost Price') }}</th>
|
||||
<th>{{ __('Purchase Qty') }}</th>
|
||||
@@ -32,7 +31,6 @@
|
||||
<td>{{ formatted_date($purchaseDetail->purchase?->purchaseDate) }}, {{ formatted_time($purchaseDetail->purchase?->purchaseDate)}}
|
||||
</td>
|
||||
<td>{{ $purchaseDetail->purchase?->invoiceNumber }}</td>
|
||||
<td>{{ $purchaseDetail->purchase?->party?->name }}</td>
|
||||
<td>{{ __('Purchase') }}</td>
|
||||
<td>{{ currency_format($purchaseDetail->productPurchasePrice, currency: business_currency()) }}
|
||||
</td>
|
||||
@@ -46,7 +44,6 @@
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>{{ currency_format($purchaseDetails->sum('productPurchasePrice'), currency: business_currency()) }}</td>
|
||||
<td>{{ $purchaseDetails->sum('quantities') }} </td>
|
||||
</tr>
|
||||
|
||||
@@ -78,17 +78,17 @@
|
||||
<div class="table-top-btn-group d-print-none">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.product-purchase-detail-reports.csv', $product->id) }}">
|
||||
<a href="{{ route('business.product-purchase-detail-reports.csv', $product->id) }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.product-purchase-detail-reports.excel', $product->id) }}">
|
||||
<a href="{{ route('business.product-purchase-detail-reports.excel', $product->id) }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.product-purchase-detail-reports.pdf', $product->id) }}">
|
||||
<a target="blank" href="{{ route('business.product-purchase-detail-reports.pdf', $product->id) }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<th>{{ __('SL.') }}</th>
|
||||
<th>{{ __('Date') }}</th>
|
||||
<th>{{ __('Invoice') }}</th>
|
||||
<th>{{ __('Supplier') }}</th>
|
||||
<th>{{ __('Type') }}</th>
|
||||
<th>{{ __('Cost Price') }}</th>
|
||||
<th>{{ __('Purchase Qty') }}</th>
|
||||
@@ -17,7 +16,6 @@
|
||||
<td>{{ formatted_date($purchaseDetail->purchase?->purchaseDate) }}, {{ formatted_time($purchaseDetail->purchase?->purchaseDate)}}
|
||||
</td>
|
||||
<td>{{ $purchaseDetail->purchase?->invoiceNumber }}</td>
|
||||
<td>{{ $purchaseDetail->purchase?->party?->name }}</td>
|
||||
<td>{{ __('Purchase') }}</td>
|
||||
<td>{{ currency_format($purchaseDetail->productPurchasePrice, currency: business_currency()) }}
|
||||
</td>
|
||||
@@ -31,7 +29,6 @@
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>{{ currency_format($purchaseDetails->sum('productPurchasePrice'), currency: business_currency()) }}</td>
|
||||
<td>{{ $purchaseDetails->sum('quantities') }} </td>
|
||||
</tr>
|
||||
|
||||
@@ -78,17 +78,17 @@
|
||||
<div class="table-top-btn-group d-print-none">
|
||||
<ul>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.product-purchase-history-reports.csv') }}">
|
||||
<a href="{{ route('business.product-purchase-history-reports.csv') }}">
|
||||
<img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" href="{{ route('business.product-purchase-history-reports.excel') }}">
|
||||
<a href="{{ route('business.product-purchase-history-reports.excel') }}">
|
||||
<img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="export-btn" target="_blank" href="{{ route('business.product-purchase-history-reports.pdf') }}">
|
||||
<a target="blank" href="{{ route('business.product-purchase-history-reports.pdf') }}">
|
||||
<img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -4,19 +4,7 @@
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ $product->productName }} {{ __('Purchase Details') }}</h4>
|
||||
@if ($filter_from_date && $filter_to_date)
|
||||
<p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration:') }}
|
||||
@if ($duration === 'today')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@elseif ($duration === 'yesterday')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@else
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
{{ __('to') }}
|
||||
{{ Carbon\Carbon::parse($filter_to_date)->format('d-m-Y') }}
|
||||
@endif
|
||||
</p>
|
||||
@endif
|
||||
{{-- <p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration: 14-12-2025 to 24-12-2025') }}</p> --}}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@@ -28,7 +16,6 @@
|
||||
<tr style="background-color: #C52127; color: white;">
|
||||
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Date') }}</th>
|
||||
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Invoice') }}</th>
|
||||
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Supplier') }}</th>
|
||||
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Type') }}</th>
|
||||
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Cost Price') }}</th>
|
||||
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Purchase Qty') }}</th>
|
||||
@@ -43,9 +30,6 @@
|
||||
<td style="border:1px solid gainsboro; text-align:center;">
|
||||
{{ $purchaseDetail->purchase?->invoiceNumber }}
|
||||
</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">
|
||||
{{ $purchaseDetail->purchase?->party?->name }}
|
||||
</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;">
|
||||
{{ __('Purchase') }}
|
||||
</td>
|
||||
@@ -66,7 +50,6 @@
|
||||
</td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;"></td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;"></td>
|
||||
<td style="border:1px solid gainsboro; text-align:center;"></td>
|
||||
<td style="border:1px solid gainsboro; text-align:center; color: white; font-weight: 600;">
|
||||
{{ currency_format($purchaseDetails->sum('productPurchasePrice'), currency: business_currency()) }}
|
||||
</td>
|
||||
|
||||
@@ -4,19 +4,7 @@
|
||||
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
||||
@include('business::print.header')
|
||||
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Product Purchase History Report') }}</h4>
|
||||
@if ($filter_from_date && $filter_to_date)
|
||||
<p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration:') }}
|
||||
@if ($duration === 'today')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@elseif ($duration === 'yesterday')
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
@else
|
||||
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
||||
{{ __('to') }}
|
||||
{{ Carbon\Carbon::parse($filter_to_date)->format('d-m-Y') }}
|
||||
@endif
|
||||
</p>
|
||||
@endif
|
||||
{{-- <p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration: 14-12-2025 to 24-12-2025') }}</p> --}}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user