Compare commits

...

6 Commits

Author SHA1 Message Date
bc6ae43121 update elusive price
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 4m55s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 42s
Build, Push and Deploy / deploy-production (push) Has been skipped
2026-05-18 10:48:12 +07:00
8307b9e66d finishing to dev
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m41s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 42s
Build, Push and Deploy / deploy-production (push) Has been skipped
2026-05-14 22:50:44 +07:00
2fabdf8fc9 update perbaikan pos, return, dan report profit nlost
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 4m17s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 15s
Build, Push and Deploy / deploy-staging (push) Successful in 41s
Build, Push and Deploy / deploy-production (push) Has been skipped
2026-05-14 22:19:01 +07:00
1dfc06635d update wuerry
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m59s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 17s
Build, Push and Deploy / deploy-staging (push) Successful in 41s
Build, Push and Deploy / deploy-production (push) Has been skipped
2026-05-14 13:29:43 +07:00
6f9bdff115 update
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m59s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 18s
Build, Push and Deploy / deploy-staging (push) Successful in 39s
Build, Push and Deploy / deploy-production (push) Has been skipped
2026-05-14 12:25:21 +07:00
ce2b815b07 Fix BadMethodCallException and remaining PostgreSQL issues 2026-05-14 12:24:33 +07:00
271 changed files with 4539 additions and 7753 deletions

Binary file not shown.

View File

@@ -31,6 +31,16 @@ public function index(Request $request)
->where('business_id', auth()->user()->business_id) ->where('business_id', auth()->user()->business_id)
->whereIn('type', ['debit', 'credit']); ->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 // Date Filter
$duration = $request->custom_days ?: 'today'; $duration = $request->custom_days ?: 'today';
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date); [$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); $perPage = $request->input('per_page', 20);
$cash_flows = $query->paginate($perPage)->appends($request->query()); $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; $firstDate = $cash_flows->first()?->date;
if ($firstDate) { if ($firstDate) {
@@ -83,14 +83,11 @@ public function index(Request $request)
if ($request->ajax()) { if ($request->ajax()) {
return response()->json([ 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(), '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()
'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()),
]); ]);
} }
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() public function exportExcel()
@@ -103,9 +100,9 @@ public function exportCsv()
return Excel::download(new ExportCashFlowReport, 'cash-flow.csv'); 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', 'paymentType:id,name',
'sale:id,party_id', 'sale:id,party_id',
'sale.party:id,name', 'sale.party:id,name',
@@ -117,47 +114,12 @@ public function exportPdf(Request $request)
'dueCollect.party:id,name', 'dueCollect.party:id,name',
]) ])
->where('business_id', auth()->user()->business_id) ->where('business_id', auth()->user()->business_id)
->whereIn('type', ['debit', 'credit']); ->whereIn('type', ['debit', 'credit'])
->latest()
->get();
// Date Filter $opening_balance = 0;
$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); return PdfService::render('business::cash-flow.pdf', compact('cash_flows', 'opening_balance'),'cash-flow-report.pdf');
// 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');
} }
} }

View File

@@ -86,54 +86,27 @@ public function exportCsv()
return Excel::download(new ExportComboProductReport, 'combo-product-report.csv'); return Excel::download(new ExportComboProductReport, 'combo-product-report.csv');
} }
public function exportPdf(Request $request) public function exportPdf()
{ {
$user = auth()->user(); $combo_products = Product::with(['combo_products', 'unit:id,unitName', 'category:id,categoryName'])
$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'])
->where('business_id', auth()->user()->business_id) ->where('business_id', auth()->user()->business_id)
->where('product_type', 'combo') ->where('product_type', 'combo')
->withCount('combo_products as total_combo_products') ->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() ->latest()
->limit($request->per_page ?? 20)->get(); ->get();
$combo_products->transform(function ($product) { $combo_products->transform(function ($product) {
$product->total_stock = $product->combo_products->sum(function ($combo) { $product->total_stock = $product->combo_products->sum(function ($combo) {
return optional($combo->stock)->productStock ?? 0; 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;
}); });
$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'); return PdfService::render('business::reports.combo-products.pdf', compact('combo_products'),'combo-product-report.pdf');
} }
} }

View File

@@ -60,31 +60,44 @@ public function index(Request $request)
$query->where('platform', $request->platform); $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 // Paginate data
$perPage = $request->input('per_page', 20); $perPage = $request->input('per_page', 20);
$day_books = $query->latest()->paginate($perPage)->appends($request->query()); $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()) { if ($request->ajax()) {
return response()->json([ 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(), '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()
'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()),
]); ]);
} }
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() public function exportExcel()
@@ -97,9 +110,9 @@ public function exportCsv()
return Excel::download(new ExportDayBookReport, 'day-book.csv'); 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', 'paymentType:id,name',
'sale:id,user_id,party_id,totalAmount', 'sale:id,user_id,party_id,totalAmount',
'sale.party:id,name', 'sale.party:id,name',
@@ -114,37 +127,10 @@ public function exportPdf(Request $request)
'dueCollect.user:id,name', 'dueCollect.user:id,name',
]) ])
->where('business_id', auth()->user()->business_id) ->where('business_id', auth()->user()->business_id)
->whereIn('type', ['debit', 'credit']); ->whereIn('type', ['debit', 'credit'])
->latest()
->get();
// Apply date filter return PdfService::render('business::day-book.pdf', compact('day_books'), 'day-book-report.pdf');
$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');
} }
} }

View File

@@ -13,6 +13,7 @@ class AcnooDiscountProductReportController extends Controller
{ {
public function index(Request $request) public function index(Request $request)
{ {
$user = auth()->user(); $user = auth()->user();
$branchId = null; $branchId = null;
@@ -20,7 +21,7 @@ public function index(Request $request)
$branchId = $user->branch_id ?? $user->active_branch_id; $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) { ->whereHas('product', function ($q) {
$q->where('business_id', auth()->user()->business_id); $q->where('business_id', auth()->user()->business_id);
}) })
@@ -61,35 +62,13 @@ public function exportCsv()
return Excel::download(new ExportDiscountProduct, 'discount-products.csv'); return Excel::download(new ExportDiscountProduct, 'discount-products.csv');
} }
public function exportPdf(Request $request) public function exportPdf()
{ {
$user = auth()->user(); $discount_products = SaleDetails::with('product:id,productName,productCode')
$branchId = null;
if (moduleCheck('MultiBranchAddon')) {
$branchId = $user->branch_id ?? $user->active_branch_id;
}
$discount_products = SaleDetails::with('product:id,productName,productCode,hsn_code')
->whereHas('product', function ($q) { ->whereHas('product', function ($q) {
$q->where('business_id', auth()->user()->business_id); $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) ->where('discount', '>', 0)
->limit($request->per_page ?? 20)
->get(); ->get();
return PdfService::render('business::reports.discount-products.pdf', compact('discount_products'),'discount-product-report.pdf'); return PdfService::render('business::reports.discount-products.pdf', compact('discount_products'),'discount-product-report.pdf');

View File

@@ -32,56 +32,79 @@ public function index(Request $request)
->orWhere('credit_limit', 'like', '%' . $request->search . '%'); ->orWhere('credit_limit', 'like', '%' . $request->search . '%');
}); });
}) })
->when($request->type, function ($q) use ($request) { ->when(request('type'), function ($q) use ($request) {
$q->where('type', $request->type); $q->where(function ($q) use ($request) {
$q->where('type', $request->type);
});
}) })
->with('sales_dues') ->with('sales_dues')
->latest(); ->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) { if ($activeBranch) {
$parties->setCollection( $parties->setCollection(
$parties->getCollection() $parties->getCollection()
->transform(function ($customer) use ($activeBranch) { ->transform(function ($customer) use ($activeBranch) {
$party_due = $customer->sales_dues $customer->due = $customer->sales_dues
->where('branch_id', $activeBranch->id) ->where('branch_id', $activeBranch->id)
->sum('dueAmount'); ->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; return $customer;
}) })
->filter(fn($customer) => $customer->due > 0) ->filter(fn($customer) => $customer->due > 0)
->values() ->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 { } 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->setCollection(
$parties->getCollection() $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() ->values()
); );
} }
$customer_total_due = $parties->getCollection()->sum('due'); // Calculate total_due
$total_due = $parties->sum(fn($customer) => $customer->due);
if ($request->ajax()) { return view('business::reports.due.due-reports', compact('parties', 'total_due'));
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'));
} }
public function exportExcel() public function exportExcel()
@@ -94,59 +117,37 @@ public function exportCsv()
return Excel::download(new ExportDue, 'customer-due.csv'); return Excel::download(new ExportDue, 'customer-due.csv');
} }
public function exportPdf(Request $request) public function exportPdf()
{ {
$user = auth()->user(); $user = auth()->user();
$businessId = $user->business_id;
$activeBranch = $user->active_branch; $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') ->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') ->with('sales_dues')
->latest(); ->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(); $parties = $query->get();
if ($activeBranch) { if ($activeBranch) {
$parties = $parties $parties->transform(function ($supplier) use ($activeBranch) {
->transform(function ($customer) use ($activeBranch) { $supplier->due = $supplier->sales_dues
$party_due = $customer->sales_dues ->where('branch_id', $activeBranch->id)
->where('branch_id', $activeBranch->id) ->sum('dueAmount');
->sum('dueAmount'); return $supplier;
})->filter(fn($supplier) => $supplier->due > 0);
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();
} }
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');
} }
} }

View File

@@ -5,6 +5,7 @@
use App\Models\Branch; use App\Models\Branch;
use App\Models\Expense; use App\Models\Expense;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Services\PdfService; use App\Services\PdfService;
use App\Traits\DateFilterTrait; use App\Traits\DateFilterTrait;
@@ -25,6 +26,10 @@ public function index(Request $request)
{ {
$businessId = auth()->user()->business_id; $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') $expenseQuery = Expense::with('category:id,categoryName', 'payment_type:id,name', 'branch:id,name', 'transactions')
->where('business_id', $businessId); ->where('business_id', $businessId);
@@ -85,40 +90,10 @@ public function exportCsv()
public function exportPdf(Request $request) public function exportPdf(Request $request)
{ {
$expenseQuery = Expense::with('category:id,categoryName', 'payment_type:id,name', 'branch:id,name', 'transactions') $expense_reports = Expense::with('category:id,categoryName', 'payment_type:id,name', 'branch:id,name', 'transactions')->where('business_id', auth()->user()->business_id)
->where('business_id', auth()->user()->business_id); ->latest()
->get();
$expenseQuery->when($request->branch_id, function ($q) use ($request) { return PdfService::render('business::reports.expense.pdf', compact('expense_reports'),'expenses-report.pdf');
$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');
} }
} }

View File

@@ -80,46 +80,17 @@ public function exportCsv()
return Excel::download(new ExportExpiredProductReport, 'expired-product-reports.csv'); return Excel::download(new ExportExpiredProductReport, 'expired-product-reports.csv');
} }
public function exportPdf(Request $request) public function exportPdf()
{ {
$businessId = auth()->user()->business_id; $expired_products = Product::with('unit:id,unitName', 'brand:id,brandName', 'category:id,categoryName', 'stocks')
$expiredProductsQuery = Product::with(['unit:id,unitName', 'brand:id,brandName', 'category:id,categoryName', 'stocks'])
->withSum('stocks', 'productStock') ->withSum('stocks', 'productStock')
->where('business_id', $businessId) ->where('business_id', auth()->user()->business_id)
->whereHas('stocks', function ($query) { ->whereHas('stocks', function ($query) {
$query->whereDate('expire_date', '<=', today())->where('productStock', '>', 0); $query->whereDate('expire_date', '<', today())->where('productStock', '>', 0);
}); })
->latest()
->get();
// Date Filter return PdfService::render('business::reports.expired-products.pdf', compact('expired_products'),'expired-product-report.pdf');
$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');
} }
} }

View File

@@ -83,36 +83,10 @@ public function exportCsv()
public function exportPdf(Request $request) public function exportPdf(Request $request)
{ {
$incomeQuery = Income::with('category:id,categoryName', 'payment_type:id,name', 'branch:id,name', 'transactions') $income_reports = Income::with('category:id,categoryName', 'payment_type:id,name', 'branch:id,name', 'transactions')->where('business_id', auth()->user()->business_id)
->where('business_id', auth()->user()->business_id); ->latest()
->get();
// Branch filter return PdfService::render('business::reports.income.pdf', compact('income_reports'),'incomes-report.pdf');
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');
} }
} }

View File

@@ -33,14 +33,14 @@ public function lossProfitDetails()
$query->where('business_id', $businessId); $query->where('business_id', $businessId);
}) })
->whereDate('created_at', '<', $today) ->whereDate('created_at', '<', $today)
->sum(DB::raw('"productPurchasePrice" * "productStock"')); ->sum(DB::raw('productPurchasePrice * productStock'));
// Closing stock (up to today) from stocks table // Closing stock (up to today) from stocks table
$closing_stock_by_purchase = Stock::whereHas('product', function ($query) use ($businessId) { $closing_stock_by_purchase = Stock::whereHas('product', function ($query) use ($businessId) {
$query->where('business_id', $businessId); $query->where('business_id', $businessId);
}) })
->whereDate('created_at', '<=', $today) ->whereDate('created_at', '<=', $today)
->sum(DB::raw('"productPurchasePrice" * "productStock"')); ->sum(DB::raw('productPurchasePrice * productStock'));
$total_purchase_price = (clone $purchaseQuery)->sum('totalAmount'); $total_purchase_price = (clone $purchaseQuery)->sum('totalAmount');
$total_purchase_shipping_charge = (clone $purchaseQuery)->sum('shipping_charge'); $total_purchase_shipping_charge = (clone $purchaseQuery)->sum('shipping_charge');
@@ -59,13 +59,13 @@ public function lossProfitDetails()
$query->where('business_id', $businessId); $query->where('business_id', $businessId);
}) })
->whereDate('created_at', '<', $today) ->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) { $closing_stock_by_sale = Stock::whereHas('product', function ($query) use ($businessId) {
$query->where('business_id', $businessId); $query->where('business_id', $businessId);
}) })
->whereDate('created_at', '<=', $today) ->whereDate('created_at', '<=', $today)
->sum(DB::raw('"productSalePrice" * "productStock"')); ->sum(DB::raw('productSalePrice * productStock'));
$total_sale_price = (clone $salesQuery)->sum('totalAmount'); $total_sale_price = (clone $salesQuery)->sum('totalAmount');
$total_sale_shipping_charge = (clone $salesQuery)->sum('shipping_charge'); $total_sale_shipping_charge = (clone $salesQuery)->sum('shipping_charge');
@@ -135,14 +135,14 @@ public function lossProfitFilter(Request $request)
$q->where('business_id', $businessId); $q->where('business_id', $businessId);
}) })
->whereDate('created_at', '<', $startDate) ->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 (up to end date)
$closing_stock_by_purchase = Stock::whereHas('product', function ($q) use ($businessId) { $closing_stock_by_purchase = Stock::whereHas('product', function ($q) use ($businessId) {
$q->where('business_id', $businessId); $q->where('business_id', $businessId);
}) })
->whereDate('created_at', '<=', $endDate) ->whereDate('created_at', '<=', $endDate)
->sum(DB::raw('"productPurchasePrice" * "productStock"')); ->sum(DB::raw('productPurchasePrice * productStock'));
$total_purchase_price = (clone $purchaseQuery)->sum('totalAmount'); $total_purchase_price = (clone $purchaseQuery)->sum('totalAmount');
$total_purchase_shipping_charge = (clone $purchaseQuery)->sum('shipping_charge'); $total_purchase_shipping_charge = (clone $purchaseQuery)->sum('shipping_charge');
@@ -159,14 +159,14 @@ public function lossProfitFilter(Request $request)
$q->where('business_id', $businessId); $q->where('business_id', $businessId);
}) })
->whereDate('created_at', '<', $startDate) ->whereDate('created_at', '<', $startDate)
->sum(DB::raw('"productSalePrice" * "productStock"')); ->sum(DB::raw('productSalePrice * productStock'));
// Closing stock by sale // Closing stock by sale
$closing_stock_by_sale = Stock::whereHas('product', function ($q) use ($businessId) { $closing_stock_by_sale = Stock::whereHas('product', function ($q) use ($businessId) {
$q->where('business_id', $businessId); $q->where('business_id', $businessId);
}) })
->whereDate('created_at', '<=', $endDate) ->whereDate('created_at', '<=', $endDate)
->sum(DB::raw('"productSalePrice" * "productStock"')); ->sum(DB::raw('productSalePrice * productStock'));
$total_sale_price = (clone $salesQuery)->sum('totalAmount'); $total_sale_price = (clone $salesQuery)->sum('totalAmount');
$total_sale_shipping_charge = (clone $salesQuery)->sum('shipping_charge'); $total_sale_shipping_charge = (clone $salesQuery)->sum('shipping_charge');

View File

@@ -7,19 +7,17 @@
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Services\PdfService; use App\Services\PdfService;
use App\Traits\DateRangeTrait;
use Maatwebsite\Excel\Facades\Excel; use Maatwebsite\Excel\Facades\Excel;
use Modules\Business\App\Exports\ExportLossProfitHistory; use Modules\Business\App\Exports\ExportLossProfitHistory;
class AcnooLossProfitHistoryController extends Controller class AcnooLossProfitHistoryController extends Controller
{ {
use DateFilterTrait, DateRangeTrait; use DateFilterTrait;
public function index(Request $request) public function index(Request $request)
{ {
$user = auth()->user(); $user = auth()->user();
$businessId = $user->business_id; $businessId = $user->business_id;
$perPage = request('per_page') ?? 20;
$branchId = null; $branchId = null;
if (moduleCheck('MultiBranchAddon')) { if (moduleCheck('MultiBranchAddon')) {
@@ -27,59 +25,42 @@ public function index(Request $request)
} }
$duration = $request->custom_days ?: 'today'; $duration = $request->custom_days ?: 'today';
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
$salesQuery = DB::table('sales') $salesQuery = DB::table('sales')
->select( ->select(
DB::raw('"saleDate"::date as date'), DB::raw('DATE("saleDate") as date'),
DB::raw("
CASE
WHEN \"lossProfit\" >= 0 THEN 'positive'
ELSE 'negative'
END as profit_type
"),
DB::raw('SUM(actual_total_amount) as total_sales'), DB::raw('SUM(actual_total_amount) as total_sales'),
DB::raw('SUM("lossProfit") as total_sale_income') DB::raw('SUM("lossProfit") as total_sale_income')
) )
->where('business_id', $businessId) ->where('business_id', $businessId)
->when($branchId, fn ($q) => ->when($branchId, fn ($q) =>
$q->where('branch_id', $branchId) $q->where('branch_id', $branchId)
) )
->groupBy( ->groupBy(DB::raw('DATE("saleDate")'));
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); $this->applyDateFilter($salesQuery, $duration, 'saleDate', $request->from_date, $request->to_date);
$dailySales = $salesQuery->get();
$dailySales = $salesQuery->limit($perPage)->get();
$sale_datas = $dailySales->map(fn ($sale) => (object)[ $sale_datas = $dailySales->map(fn ($sale) => (object)[
'type' => 'Sale', 'type' => 'Sale',
'date' => $sale->date, 'date' => $sale->date,
'profit_type' => $sale->profit_type,
'total_sales' => $sale->total_sales, 'total_sales' => $sale->total_sales,
'total_incomes' => $sale->total_sale_income, 'total_incomes' => $sale->total_sale_income,
]); ]);
$incomeQuery = DB::table('incomes') $incomeQuery = DB::table('incomes')
->select( ->select(
DB::raw('"incomeDate"::date as date'), DB::raw('DATE("incomeDate") as date'),
DB::raw('SUM(amount) as total_incomes') DB::raw('SUM(amount) as total_incomes')
) )
->where('business_id', $businessId) ->where('business_id', $businessId)
->when($branchId, fn ($q) => ->when($branchId, fn ($q) =>
$q->where('branch_id', $branchId) $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); $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)[ $income_datas = $dailyIncomes->map(fn ($income) => (object)[
'type' => 'Income', 'type' => 'Income',
@@ -99,10 +80,7 @@ public function index(Request $request)
$mergedIncomeSaleData->push($income); $mergedIncomeSaleData->push($income);
} }
// multiple sale rows handle if ($sale = $sale_datas->firstWhere('date', $date)) {
$salesOfDate = $sale_datas->where('date', $date);
foreach ($salesOfDate as $sale) {
$mergedIncomeSaleData->push($sale); $mergedIncomeSaleData->push($sale);
} }
} }
@@ -112,32 +90,32 @@ public function index(Request $request)
if (moduleCheck('HrmAddon')) { if (moduleCheck('HrmAddon')) {
$payrollQuery = DB::table('payrolls') $payrollQuery = DB::table('payrolls')
->select( ->select(
DB::raw('"date"::date as date'), DB::raw('DATE("date") as date'),
DB::raw('SUM(amount) as total_payrolls') DB::raw('SUM(amount) as total_payrolls')
) )
->where('business_id', $businessId) ->where('business_id', $businessId)
->when($branchId, fn ($q) => ->when($branchId, fn ($q) =>
$q->where('branch_id', $branchId) $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); $this->applyDateFilter($payrollQuery, $duration, 'date', $request->from_date, $request->to_date);
$dailyPayrolls = $payrollQuery->limit($perPage)->get(); $dailyPayrolls = $payrollQuery->get();
} }
$expenseQuery = DB::table('expenses') $expenseQuery = DB::table('expenses')
->select( ->select(
DB::raw('"expenseDate"::date as date'), DB::raw('DATE("expenseDate") as date'),
DB::raw('SUM(amount) as total_expenses_only') DB::raw('SUM(amount) as total_expenses_only')
) )
->where('business_id', $businessId) ->where('business_id', $businessId)
->when($branchId, fn ($q) => ->when($branchId, fn ($q) =>
$q->where('branch_id', $branchId) $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); $this->applyDateFilter($expenseQuery, $duration, 'expenseDate', $request->from_date, $request->to_date);
$dailyExpenses = $expenseQuery->limit($perPage)->get(); $dailyExpenses = $expenseQuery->get();
$mergedExpenseData = collect(); $mergedExpenseData = collect();
$allExpenseDates = $dailyExpenses->pluck('date') $allExpenseDates = $dailyExpenses->pluck('date')
@@ -170,6 +148,34 @@ public function index(Request $request)
$totalExpenses = $mergedExpenseData->sum('total_expenses'); $totalExpenses = $mergedExpenseData->sum('total_expenses');
$netProfit = $grossIncomeProfit - $totalExpenses; $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( return view('business::loss-profit-histories.index', compact(
'mergedIncomeSaleData', 'mergedIncomeSaleData',
'mergedExpenseData', 'mergedExpenseData',
@@ -177,9 +183,9 @@ public function index(Request $request)
'grossIncomeProfit', 'grossIncomeProfit',
'totalExpenses', 'totalExpenses',
'netProfit', 'netProfit',
'duration', 'cardGrossProfit',
'filter_from_date', 'totalCardExpenses',
'filter_to_date' 'cardNetProfit'
)); ));
} }
@@ -193,158 +199,111 @@ public function exportCsv()
return Excel::download(new ExportLossProfitHistory, 'loss-profit-history.csv'); return Excel::download(new ExportLossProfitHistory, 'loss-profit-history.csv');
} }
public function exportPdf(Request $request) public function exportPdf()
{ {
$user = auth()->user(); $user = auth()->user();
$businessId = $user->business_id; $businessId = $user->business_id;
$perPage = request('per_page') ?? 20;
$branchId = null; $branchId = null;
if (moduleCheck('MultiBranchAddon')) { if (moduleCheck('MultiBranchAddon')) {
$branchId = $user->branch_id ?? $user->active_branch_id; $branchId = $user->branch_id ?? $user->active_branch_id;
} }
$duration = $request->custom_days ?: 'today'; // SALES
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date); $dailySales = DB::table('sales')
$salesQuery = DB::table('sales')
->select( ->select(
DB::raw('"saleDate"::date as date'), DB::raw('DATE("saleDate") as date'),
DB::raw("
CASE
WHEN \"lossProfit\" >= 0 THEN 'positive'
ELSE 'negative'
END as profit_type
"),
DB::raw('SUM(actual_total_amount) as total_sales'), DB::raw('SUM(actual_total_amount) as total_sales'),
DB::raw('SUM("lossProfit") as total_sale_income') DB::raw('SUM("lossProfit") as total_sale_income')
) )
->where('business_id', $businessId) ->where('business_id', $businessId)
->when($branchId, fn ($q) => ->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
$q->where('branch_id', $branchId) ->groupBy(DB::raw('DATE(saleDate)'))
) ->get();
->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();
$sale_datas = $dailySales->map(fn ($sale) => (object)[ $sale_datas = $dailySales->map(fn ($sale) => (object)[
'type' => 'Sale', 'type' => 'Sale',
'date' => $sale->date, 'date' => $sale->date,
'profit_type' => $sale->profit_type, 'total_sales' => $sale->total_sales,
'total_sales' => $sale->total_sales, 'total_incomes' => $sale->total_sale_income,
'total_incomes' => $sale->total_sale_income,
]); ]);
$incomeQuery = DB::table('incomes') // INCOME
$dailyIncomes = DB::table('incomes')
->select( ->select(
DB::raw('"incomeDate"::date as date'), DB::raw('DATE("incomeDate") as date'),
DB::raw('SUM(amount) as total_incomes') DB::raw('SUM(amount) as total_incomes')
) )
->where('business_id', $businessId) ->where('business_id', $businessId)
->when($branchId, fn ($q) => ->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
$q->where('branch_id', $branchId) ->groupBy(DB::raw('DATE(incomeDate)'))
) ->get();
->groupBy(DB::raw('"incomeDate"::date'));
$this->applyDateFilter($incomeQuery, $duration, 'incomeDate', $request->from_date, $request->to_date);
$dailyIncomes = $incomeQuery->limit($perPage)->get();
$income_datas = $dailyIncomes->map(fn ($income) => (object)[ $income_datas = $dailyIncomes->map(fn ($income) => (object)[
'type' => 'Income', 'type' => 'Income',
'date' => $income->date, 'date' => $income->date,
'total_incomes' => $income->total_incomes, 'total_incomes' => $income->total_incomes,
]); ]);
// MERGE SALE + INCOME
$mergedIncomeSaleData = collect(); $mergedIncomeSaleData = collect();
$allDates = $dailySales->pluck('date') $allDates = $dailySales->pluck('date')->merge($dailyIncomes->pluck('date'))->unique()->sort();
->merge($dailyIncomes->pluck('date'))
->unique()
->sort();
foreach ($allDates as $date) { foreach ($allDates as $date) {
if ($income = $income_datas->firstWhere('date', $date)) { if ($income = $income_datas->firstWhere('date', $date)) {
$mergedIncomeSaleData->push($income); $mergedIncomeSaleData->push($income);
} }
if ($sale = $sale_datas->firstWhere('date', $date)) {
// multiple sale rows handle
$salesOfDate = $sale_datas->where('date', $date);
foreach ($salesOfDate as $sale) {
$mergedIncomeSaleData->push($sale); $mergedIncomeSaleData->push($sale);
} }
} }
// PAYROLL
$dailyPayrolls = collect(); $dailyPayrolls = collect();
if (moduleCheck('HrmAddon')) { if (moduleCheck('HrmAddon')) {
$payrollQuery = DB::table('payrolls') $dailyPayrolls = DB::table('payrolls')
->select( ->select(
DB::raw('"date"::date as date'), DB::raw('DATE("date") as date'),
DB::raw('SUM(amount) as total_payrolls') DB::raw('SUM(amount) as total_payrolls')
) )
->where('business_id', $businessId) ->where('business_id', $businessId)
->when($branchId, fn ($q) => ->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
$q->where('branch_id', $branchId) ->groupBy(DB::raw('DATE(date)'))
) ->get();
->groupBy(DB::raw('"date"::date'));
$this->applyDateFilter($payrollQuery, $duration, 'date', $request->from_date, $request->to_date);
$dailyPayrolls = $payrollQuery->limit($perPage)->get();
} }
$expenseQuery = DB::table('expenses') // EXPENSES
$dailyExpenses = DB::table('expenses')
->select( ->select(
DB::raw('"expenseDate"::date as date'), DB::raw('DATE("expenseDate") as date'),
DB::raw('SUM(amount) as total_expenses_only') DB::raw('SUM(amount) as total_expenses_only')
) )
->where('business_id', $businessId) ->where('business_id', $businessId)
->when($branchId, fn ($q) => ->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
$q->where('branch_id', $branchId) ->groupBy(DB::raw('DATE(expenseDate)'))
) ->get();
->groupBy(DB::raw('"expenseDate"::date'));
$this->applyDateFilter($expenseQuery, $duration, 'expenseDate', $request->from_date, $request->to_date);
$dailyExpenses = $expenseQuery->limit($perPage)->get();
$mergedExpenseData = collect(); $mergedExpenseData = collect();
$allExpenseDates = $dailyExpenses->pluck('date') $allExpenseDates = $dailyExpenses->pluck('date')->merge($dailyPayrolls->pluck('date'))->unique()->sort();
->merge($dailyPayrolls->pluck('date'))
->unique()
->sort();
foreach ($allExpenseDates as $date) { foreach ($allExpenseDates as $date) {
if ($expense = $dailyExpenses->firstWhere('date', $date)) { if ($expense = $dailyExpenses->firstWhere('date', $date)) {
$mergedExpenseData->push((object)[ $mergedExpenseData->push((object)[
'type' => 'Expense', 'type' => 'Expense',
'date' => $date, 'date' => $date,
'total_expenses' => $expense->total_expenses_only, 'total_expenses' => $expense->total_expenses_only,
]); ]);
} }
if ($payroll = $dailyPayrolls->firstWhere('date', $date)) { if ($payroll = $dailyPayrolls->firstWhere('date', $date)) {
$mergedExpenseData->push((object)[ $mergedExpenseData->push((object)[
'type' => 'Payroll', 'type' => 'Payroll',
'date' => $date, 'date' => $date,
'total_expenses' => $payroll->total_payrolls, 'total_expenses' => $payroll->total_payrolls,
]); ]);
} }
} }
// SUMMARY
$grossSaleProfit = $sale_datas->sum('total_sales'); $grossSaleProfit = $sale_datas->sum('total_sales');
$grossIncomeProfit = $income_datas->sum('total_incomes') + $sale_datas->sum('total_incomes'); $grossIncomeProfit = $income_datas->sum('total_incomes') + $sale_datas->sum('total_incomes');
$totalExpenses = $mergedExpenseData->sum('total_expenses'); $totalExpenses = $mergedExpenseData->sum('total_expenses');
$netProfit = $grossIncomeProfit - $totalExpenses; $netProfit = $grossIncomeProfit - $totalExpenses;
@@ -357,10 +316,7 @@ public function exportPdf(Request $request)
'grossSaleProfit', 'grossSaleProfit',
'grossIncomeProfit', 'grossIncomeProfit',
'totalExpenses', 'totalExpenses',
'netProfit', 'netProfit'
'duration',
'filter_to_date',
'filter_from_date'
), ),
'loss-profit-history.pdf' 'loss-profit-history.pdf'
); );

View File

@@ -6,11 +6,10 @@
use App\Traits\DateFilterTrait; use App\Traits\DateFilterTrait;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Traits\DateRangeTrait;
class AcnooLossProfitHistoryReportController extends Controller class AcnooLossProfitHistoryReportController extends Controller
{ {
use DateFilterTrait, DateRangeTrait; use DateFilterTrait;
public function index(Request $request) public function index(Request $request)
{ {
@@ -23,56 +22,39 @@ public function index(Request $request)
} }
$duration = $request->custom_days ?: 'today'; $duration = $request->custom_days ?: 'today';
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
$salesQuery = DB::table('sales') $salesQuery = DB::table('sales')
->select( ->select(
DB::raw('"saleDate"::date as date'), DB::raw('DATE("saleDate") as date'),
DB::raw("
CASE
WHEN \"lossProfit\" >= 0 THEN 'positive'
ELSE 'negative'
END as profit_type
"),
DB::raw('SUM(actual_total_amount) as total_sales'), DB::raw('SUM(actual_total_amount) as total_sales'),
DB::raw('SUM("lossProfit") as total_sale_income') DB::raw('SUM("lossProfit") as total_sale_income')
) )
->where('business_id', $businessId) ->where('business_id', $businessId)
->when($branchId, fn ($q) => ->when($branchId, fn ($q) =>
$q->where('branch_id', $branchId) $q->where('branch_id', $branchId)
) )
->groupBy( ->groupBy(DB::raw('DATE("saleDate")'));
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); $this->applyDateFilter($salesQuery, $duration, 'saleDate', $request->from_date, $request->to_date);
$dailySales = $salesQuery->get(); $dailySales = $salesQuery->get();
$sale_datas = $dailySales->map(fn ($sale) => (object)[ $sale_datas = $dailySales->map(fn ($sale) => (object)[
'type' => 'Sale', 'type' => 'Sale',
'date' => $sale->date, 'date' => $sale->date,
'profit_type' => $sale->profit_type,
'total_sales' => $sale->total_sales, 'total_sales' => $sale->total_sales,
'total_incomes' => $sale->total_sale_income, 'total_incomes' => $sale->total_sale_income,
]); ]);
$incomeQuery = DB::table('incomes') $incomeQuery = DB::table('incomes')
->select( ->select(
DB::raw('"incomeDate"::date as date'), DB::raw('DATE("incomeDate") as date'),
DB::raw('SUM(amount) as total_incomes') DB::raw('SUM(amount) as total_incomes')
) )
->where('business_id', $businessId) ->where('business_id', $businessId)
->when($branchId, fn ($q) => ->when($branchId, fn ($q) =>
$q->where('branch_id', $branchId) $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); $this->applyDateFilter($incomeQuery, $duration, 'incomeDate', $request->from_date, $request->to_date);
$dailyIncomes = $incomeQuery->get(); $dailyIncomes = $incomeQuery->get();
@@ -95,10 +77,7 @@ public function index(Request $request)
$mergedIncomeSaleData->push($income); $mergedIncomeSaleData->push($income);
} }
// multiple sale rows handle if ($sale = $sale_datas->firstWhere('date', $date)) {
$salesOfDate = $sale_datas->where('date', $date);
foreach ($salesOfDate as $sale) {
$mergedIncomeSaleData->push($sale); $mergedIncomeSaleData->push($sale);
} }
} }
@@ -108,14 +87,14 @@ public function index(Request $request)
if (moduleCheck('HrmAddon')) { if (moduleCheck('HrmAddon')) {
$payrollQuery = DB::table('payrolls') $payrollQuery = DB::table('payrolls')
->select( ->select(
DB::raw('"date"::date as date'), DB::raw('DATE("date") as date'),
DB::raw('SUM(amount) as total_payrolls') DB::raw('SUM(amount) as total_payrolls')
) )
->where('business_id', $businessId) ->where('business_id', $businessId)
->when($branchId, fn ($q) => ->when($branchId, fn ($q) =>
$q->where('branch_id', $branchId) $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); $this->applyDateFilter($payrollQuery, $duration, 'date', $request->from_date, $request->to_date);
$dailyPayrolls = $payrollQuery->get(); $dailyPayrolls = $payrollQuery->get();
@@ -123,14 +102,14 @@ public function index(Request $request)
$expenseQuery = DB::table('expenses') $expenseQuery = DB::table('expenses')
->select( ->select(
DB::raw('"expenseDate"::date as date'), DB::raw('DATE("expenseDate") as date'),
DB::raw('SUM(amount) as total_expenses_only') DB::raw('SUM(amount) as total_expenses_only')
) )
->where('business_id', $businessId) ->where('business_id', $businessId)
->when($branchId, fn ($q) => ->when($branchId, fn ($q) =>
$q->where('branch_id', $branchId) $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); $this->applyDateFilter($expenseQuery, $duration, 'expenseDate', $request->from_date, $request->to_date);
$dailyExpenses = $expenseQuery->get(); $dailyExpenses = $expenseQuery->get();
@@ -166,6 +145,34 @@ public function index(Request $request)
$totalExpenses = $mergedExpenseData->sum('total_expenses'); $totalExpenses = $mergedExpenseData->sum('total_expenses');
$netProfit = $grossIncomeProfit - $totalExpenses; $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( return view('business::loss-profit-histories.index', compact(
'mergedIncomeSaleData', 'mergedIncomeSaleData',
'mergedExpenseData', 'mergedExpenseData',
@@ -173,9 +180,9 @@ public function index(Request $request)
'grossIncomeProfit', 'grossIncomeProfit',
'totalExpenses', 'totalExpenses',
'netProfit', 'netProfit',
'duration', 'cardGrossProfit',
'filter_from_date', 'totalCardExpenses',
'filter_to_date' 'cardNetProfit'
)); ));
} }

View File

@@ -5,6 +5,7 @@
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Party; use App\Models\Party;
use App\Models\Sale;
use App\Services\PdfService; use App\Services\PdfService;
use Maatwebsite\Excel\Facades\Excel; use Maatwebsite\Excel\Facades\Excel;
use Modules\Business\App\Exports\ExportPartyLossProfit; use Modules\Business\App\Exports\ExportPartyLossProfit;
@@ -13,6 +14,12 @@ class AcnooPartyLossProfitController extends Controller
{ {
public function index(Request $request) 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') $parties = Party::with('sales')
->where('business_id', auth()->user()->business_id) ->where('business_id', auth()->user()->business_id)
->where('type', '!=', 'Supplier') ->where('type', '!=', 'Supplier')
@@ -25,20 +32,13 @@ public function index(Request $request)
->paginate($request->per_page ?? 20) ->paginate($request->per_page ?? 20)
->appends($request->query()); ->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()) { if ($request->ajax()) {
return response()->json([ return response()->json([
'data' => view('business::party-reports.loss-profit.datas', compact('parties', 'totalSaleAmount', 'totalProfit', 'totalLoss'))->render(), 'data' => view('business::party-reports.loss-profit.datas', compact('parties'))->render()
'totalSaleAmount' => currency_format($totalSaleAmount, currency: business_currency()),
'totalProfit' => currency_format($totalProfit, currency: business_currency()),
'totalLoss' => currency_format($totalLoss, currency: business_currency()),
]); ]);
} }
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() public function exportExcel()
@@ -51,24 +51,18 @@ public function exportCsv()
return Excel::download(new ExportPartyLossProfit, 'party-loss-profit.csv'); return Excel::download(new ExportPartyLossProfit, 'party-loss-profit.csv');
} }
public function exportPdf(Request $request) public function exportPdf()
{ {
$parties = Party::with('sales') $parties = Party::with('sales')
->where('business_id', auth()->user()->business_id) ->where('business_id', auth()->user()->business_id)
->where('type', '!=', 'Supplier') ->where('type', '!=', 'Supplier')
->when($request->search, function ($query) use ($request) {
$query->where(function ($q) use ($request) {
$q->where('name', 'like', '%' . $request->search . '%');
});
})
->latest() ->latest()
->limit($request->per_page ?? 20)
->get(); ->get();
return PdfService::render('business::party-reports.loss-profit.pdf', compact('parties'),'party-loss-profit-report.pdf'); 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') $party = Party::with('sales.details', 'sales.details.product')
->where('id', $id) ->where('id', $id)

View File

@@ -233,7 +233,6 @@ function ($attribute, $value, $fail) use ($request) {
$stockData[] = [ $stockData[] = [
'business_id' => $business_id, 'business_id' => $business_id,
'product_id' => $product->id, 'product_id' => $product->id,
'exclusive_price' => $stock['exclusive_price'] ?? 0,
'batch_no' => $stock['batch_no'] ?? null, 'batch_no' => $stock['batch_no'] ?? null,
'warehouse_id' => $stock['warehouse_id'] ?? null, 'warehouse_id' => $stock['warehouse_id'] ?? null,
'productStock' => $stock['productStock'] ?? 0, 'productStock' => $stock['productStock'] ?? 0,
@@ -431,7 +430,6 @@ function ($attribute, $value, $fail) use ($request) {
'batch_no' => $stock['batch_no'] ?? null, 'batch_no' => $stock['batch_no'] ?? null,
'warehouse_id' => $stock['warehouse_id'] ?? null, 'warehouse_id' => $stock['warehouse_id'] ?? null,
'productStock' => $stock['productStock'] ?? 0, 'productStock' => $stock['productStock'] ?? 0,
'exclusive_price' => $stock['exclusive_price'] ?? 0,
'productPurchasePrice' =>$stock['inclusive_price'] ?? 0, 'productPurchasePrice' =>$stock['inclusive_price'] ?? 0,
'profit_percent' => $stock['profit_percent'] ?? 0, 'profit_percent' => $stock['profit_percent'] ?? 0,
'productSalePrice' => $stock['productSalePrice'] ?? 0, 'productSalePrice' => $stock['productSalePrice'] ?? 0,

View File

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

View File

@@ -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')); 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; $businessId = auth()->user()->business_id;
$duration = $request->custom_days ?: 'today'; $duration = $request->custom_days ?: 'today';
@@ -65,7 +65,7 @@ public function show(Request $request, string $id)
->whereHas('purchase', function ($purchase) use ($duration, $request) { ->whereHas('purchase', function ($purchase) use ($duration, $request) {
$this->applyDateFilter($purchase, $duration, 'purchaseDate', $request->from_date, $request->to_date); $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'); ->select('id', 'purchase_id', 'product_id', 'quantities', 'productPurchasePrice');
$purchaseDetailsQuery->when(filled($request->search), function ($q) use ($request) { $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) { ->orWhereHas('purchase', function ($q) use ($search) {
$q->where('invoiceNumber', 'like', "%{$search}%") $q->where('invoiceNumber', 'like', "%{$search}%")
->orWhere('purchaseDate', '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') compact('product', 'purchaseDetails', 'filter_from_date', 'filter_to_date', 'duration')
); );
} }
@@ -110,20 +108,9 @@ public function exportCsv()
public function exportPdf(Request $request) public function exportPdf(Request $request)
{ {
$businessId = auth()->user()->business_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);
$productQuery = Product::with(['saleDetails', 'purchaseDetails', 'purchaseDetails.purchase', 'stocks', 'combo_products']) $productQuery = Product::with('saleDetails', 'purchaseDetails', 'stocks', 'combo_products')->where('business_id', $businessId);
->where('business_id', $businessId) $products = $productQuery->get();
->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();
$total_purchase_qty = $products->sum(function ($product) { $total_purchase_qty = $products->sum(function ($product) {
return $product->purchaseDetails->sum('quantities'); return $product->purchaseDetails->sum('quantities');
@@ -133,54 +120,31 @@ public function exportPdf(Request $request)
return $product->saleDetails->sum('quantities'); 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'); 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'); 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') $product = Product::select('id', 'business_id', 'productName')
->where('business_id', $businessId) ->where('business_id', auth()->user()->business_id)
->findOrFail($id); ->findOrFail($id);
$purchaseDetailsQuery = $product->purchaseDetails() $purchaseDetailsQuery = $product->purchaseDetails()
->whereHas('purchase', function ($purchase) use ($duration, $request) { ->with('purchase:id,invoiceNumber,purchaseDate')
$this->applyDateFilter($purchase, $duration, 'purchaseDate', $request->from_date, $request->to_date);
})
->with('purchase:id,party_id,invoiceNumber,purchaseDate', 'purchase.party:id,name')
->select('id', 'purchase_id', 'product_id', 'quantities', 'productPurchasePrice'); ->select('id', 'purchase_id', 'product_id', 'quantities', 'productPurchasePrice');
$purchaseDetailsQuery->when(filled($request->search), function ($q) use ($request) { $purchaseDetails = $purchaseDetailsQuery->get();
$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->limit($request->per_page ?? 20)->get(); return PdfService::render('business::product-purchase-history-report.pdf-detail', compact('product', 'purchaseDetails'), 'product-purchase-history-details.pdf');
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');
} }
} }

View File

@@ -22,6 +22,19 @@ public function index(Request $request)
$q->where('business_id', auth()->user()->business_id); $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 // Date Filter
$duration = $request->custom_days ?: 'today'; $duration = $request->custom_days ?: 'today';
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date); [$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); $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()); $product_purchases = $query->paginate($request->per_page ?? 20)->appends($request->query());
if ($request->ajax()) { if ($request->ajax()) {
@@ -66,38 +64,14 @@ public function exportCsv()
return Excel::download(new ExportProductPurchaseReport, 'product-purchase.csv'); 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) { ->whereHas('purchase', function ($q) {
$q->where('business_id', auth()->user()->business_id); $q->where('business_id', auth()->user()->business_id);
}); })
->get();
// Date Filter return PdfService::render('business::reports.product-purchase.pdf', compact('product_purchases'),'product-purchase-report.pdf');
$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');
} }
} }

View File

@@ -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')); 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; $businessId = auth()->user()->business_id;
$duration = $request->custom_days ?: 'today'; $duration = $request->custom_days ?: 'today';
@@ -82,9 +82,6 @@ public function show(Request $request, string $id)
->orWhereHas('sale', function ($q) use ($search) { ->orWhereHas('sale', function ($q) use ($search) {
$q->where('invoiceNumber', 'like', "%{$search}%") $q->where('invoiceNumber', 'like', "%{$search}%")
->orWhere('saleDate', '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) public function exportPdf(Request $request)
{ {
$businessId = auth()->user()->business_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);
$productQuery = Product::with(['saleDetails', 'purchaseDetails', 'saleDetails.sale', 'stocks', 'combo_products']) $productQuery = Product::with('saleDetails', 'purchaseDetails', 'stocks', 'combo_products')->where('business_id', $businessId);
->where('business_id', $businessId) $products = $productQuery->get();
->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();
$total_single_sale_price = $products->sum(function ($product) { $total_single_sale_price = $products->sum(function ($product) {
return $product->saleDetails->sum('price'); return $product->saleDetails->sum('price');
@@ -143,54 +129,31 @@ public function exportPdf(Request $request)
return $product->saleDetails->sum('quantities'); 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'); 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'); 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') $product = Product::select('id', 'business_id', 'productName')
->where('business_id', $businessId) ->where('business_id', auth()->user()->business_id)
->findOrFail($id); ->findOrFail($id);
$saleDetailsQuery = $product->saleDetails() $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') ->with('sale:id,party_id,invoiceNumber,saleDate', 'sale.party:id,name')
->select('id', 'sale_id', 'product_id', 'quantities', 'lossprofit', 'price', 'productPurchasePrice'); ->select('id', 'sale_id', 'product_id', 'quantities', 'lossprofit', 'price', 'productPurchasePrice');
$saleDetailsQuery->when(filled($request->search), function ($q) use ($request) { $saleDetails = $saleDetailsQuery->get();
$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->limit($request->per_page ?? 20)->get(); return PdfService::render('business::product-sale-history-report.pdf-detail', compact('product', 'saleDetails'), 'product-sale-history-details.pdf');
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');
} }
} }

View File

@@ -3,7 +3,7 @@
namespace Modules\Business\App\Http\Controllers; namespace Modules\Business\App\Http\Controllers;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\SaleDetails; use App\Models\Sale;
use App\Services\PdfService; use App\Services\PdfService;
use App\Traits\DateFilterTrait; use App\Traits\DateFilterTrait;
use App\Traits\DateRangeTrait; use App\Traits\DateRangeTrait;
@@ -17,34 +17,26 @@ class AcnooProductSaleReportController extends Controller
public function index(Request $request) public function index(Request $request)
{ {
$query = SaleDetails::with('product:id,productName', 'sale:id,party_id,invoiceNumber,saleDate', 'sale.party:id,name') $query = Sale::with('details:id,sale_id,product_id,quantities,price', 'details.product:id,productName', 'party:id,name')
->whereHas('sale', function ($q) { ->where('business_id', auth()->user()->business_id);
$q->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'; $duration = $request->custom_days ?: 'today';
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date); [$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($query, $duration, 'saleDate', $request->from_date, $request->to_date);
$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->paginate($request->per_page ?? 20)->appends($request->query()); $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'); 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') $product_sales = Sale::with('details:id,sale_id,product_id,quantities,price', 'details.product:id,productName', 'party:id,name')
->whereHas('sale', function ($q) { ->where('business_id', auth()->user()->business_id)
$q->where('business_id', auth()->user()->business_id); ->latest()
}); ->get();
// Date Filter return PdfService::render('business::reports.product-sale.pdf', compact('product_sales'),'product-sale-report.pdf');
$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');
} }
} }

View File

@@ -26,6 +26,10 @@ public function index(Request $request)
{ {
$businessId = auth()->user()->business_id; $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') $purchasesQuery = Purchase::with('user:id,name', 'party:id,name,email,phone,type', 'payment_type:id,name', 'branch:id,name', 'transactions')
->where('business_id', $businessId); ->where('business_id', $businessId);
@@ -85,38 +89,11 @@ public function exportCsv()
public function exportPdf(Request $request) 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') $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); ->where('business_id', auth()->user()->business_id)
->latest()
->get();
$purchasesQuery->when($request->branch_id, function ($q) use ($request) { return PdfService::render('business::reports.purchase.pdf', compact('purchases'), 'purchases-report.pdf');
$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');
} }
} }

View File

@@ -6,6 +6,7 @@
use App\Models\Purchase; use App\Models\Purchase;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\PurchaseReturnDetail;
use App\Services\PdfService; use App\Services\PdfService;
use App\Traits\DateFilterTrait; use App\Traits\DateFilterTrait;
use App\Traits\DateRangeTrait; use App\Traits\DateRangeTrait;
@@ -25,6 +26,12 @@ public function index(Request $request)
{ {
$businessId = auth()->user()->business_id; $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([ $purchasesQuery = Purchase::with([
'user:id,name', 'user:id,name',
'branch:id,name', 'branch:id,name',
@@ -47,9 +54,7 @@ public function index(Request $request)
$duration = $request->custom_days ?: 'today'; $duration = $request->custom_days ?: 'today';
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date); [$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($purchasesQuery, $duration, 'purchaseDate', $request->from_date, $request->to_date);
$this->applyDateFilter($query, $duration, 'return_date', $request->from_date, $request->to_date);
});
// Search Filter // Search Filter
if ($request->filled('search')) { 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 // Pagination
$perPage = $request->input('per_page', 20); $perPage = $request->input('per_page', 20);
$purchases = $purchasesQuery->latest()->paginate($perPage)->appends($request->query()); $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 // Handle AJAX Request
if ($request->ajax()) { if ($request->ajax()) {
return response()->json([ return response()->json([
@@ -102,7 +105,7 @@ public function exportCsv()
public function exportPdf(Request $request) public function exportPdf(Request $request)
{ {
$purchasesQuery = Purchase::with([ $purchases = Purchase::with([
'user:id,name', 'user:id,name',
'branch:id,name', 'branch:id,name',
'party:id,name,email,phone,type', 'party:id,name,email,phone,type',
@@ -114,35 +117,10 @@ public function exportPdf(Request $request)
} }
]) ])
->where('business_id', auth()->user()->business_id) ->where('business_id', auth()->user()->business_id)
->whereHas('purchaseReturns'); ->whereHas('purchaseReturns')
->latest()
->get();
$purchasesQuery->when($request->branch_id, function ($q) use ($request) { return PdfService::render('business::reports.purchase-return.pdf', compact('purchases'), 'purchase-return-report.pdf');
$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');
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -5,6 +5,7 @@
use App\Models\Sale; use App\Models\Sale;
use App\Models\Branch; use App\Models\Branch;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Services\PdfService; use App\Services\PdfService;
use App\Traits\DateFilterTrait; use App\Traits\DateFilterTrait;
@@ -25,8 +26,11 @@ public function index(Request $request)
{ {
$businessId = auth()->user()->business_id; $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) { $salesQuery->when($request->branch_id, function ($q) use ($request) {
$q->where('branch_id', $request->branch_id); $q->where('branch_id', $request->branch_id);
}); });
@@ -84,38 +88,10 @@ public function exportCsv()
public function exportPdf(Request $request) 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') $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)
->where('business_id', auth()->user()->business_id); ->latest()
->get();
$salesQuery->when($request->branch_id, function ($q) use ($request) { return PdfService::render('business::reports.sales.pdf', compact('sales'),'sales-report.pdf');
$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');
} }
} }

View File

@@ -5,6 +5,7 @@
use App\Models\Sale; use App\Models\Sale;
use App\Models\Branch; use App\Models\Branch;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\SaleReturnDetails;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Services\PdfService; use App\Services\PdfService;
use App\Traits\DateFilterTrait; use App\Traits\DateFilterTrait;
@@ -23,6 +24,12 @@ public function __construct()
public function index(Request $request) 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; $businessId = auth()->user()->business_id;
$salesQuery = Sale::with([ $salesQuery = Sale::with([
@@ -37,7 +44,9 @@ public function index(Request $request)
->with('branch:id,name'); ->with('branch:id,name');
} }
]) ])
->where('business_id', $businessId) ->where('business_id', $businessId)
->when($request->branch_id, function ($q) use ($request) { ->when($request->branch_id, function ($q) use ($request) {
$q->where('branch_id', $request->branch_id); $q->where('branch_id', $request->branch_id);
})->whereHas('saleReturns'); })->whereHas('saleReturns');
@@ -46,9 +55,7 @@ public function index(Request $request)
$duration = $request->custom_days ?: 'today'; $duration = $request->custom_days ?: 'today';
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date); [$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($salesQuery, $duration, 'saleDate', $request->from_date, $request->to_date);
$this->applyDateFilter($query, $duration, 'return_date', $request->from_date, $request->to_date);
});
// Search Filter // Search Filter
if ($request->filled('search')) { 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); $perPage = $request->input('per_page', 20);
$sales = $salesQuery->latest()->paginate($perPage)->appends($request->query()); $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()) { if ($request->ajax()) {
return response()->json([ return response()->json([
'data' => view('business::reports.sales-return.datas', compact('sales', 'filter_from_date', 'filter_to_date', 'duration'))->render(), '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) public function exportPdf(Request $request)
{ {
$salesQuery = Sale::with([ $sales = Sale::with([
'user:id,name', 'user:id,name',
'party:id,name', 'party:id,name',
'branch:id,name', 'branch:id,name',
@@ -112,33 +116,10 @@ public function exportPdf(Request $request)
} }
]) ])
->where('business_id', auth()->user()->business_id) ->where('business_id', auth()->user()->business_id)
->when($request->branch_id, function ($q) use ($request) { ->whereHas('saleReturns')
$q->where('branch_id', $request->branch_id); ->latest()
})->whereHas('saleReturns'); ->get();
// Date Filter return PdfService::render('business::reports.sales-return.pdf', compact('sales'), 'sales-return-report.pdf');
$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');
} }
} }

View File

@@ -2,8 +2,10 @@
namespace Modules\Business\App\Http\Controllers; namespace Modules\Business\App\Http\Controllers;
use App\Models\Stock;
use App\Models\Product; use App\Models\Product;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Services\PdfService; use App\Services\PdfService;
use Maatwebsite\Excel\Facades\Excel; use Maatwebsite\Excel\Facades\Excel;
@@ -20,42 +22,31 @@ public function index(Request $request)
{ {
$businessId = auth()->user()->business_id; $businessId = auth()->user()->business_id;
$productsQuery = Product::with(['stocks' => function ($q) { $total_stock_value = Stock::whereHas('product', function ($q) use ($businessId) {
$q->select('id', 'product_id', 'productStock', 'productPurchasePrice', 'productSalePrice'); $q->where('business_id', $businessId);
}]) })->sum(DB::raw('"productPurchasePrice" * "productStock"'));
->where('business_id', $businessId)
->where('product_type', '!=', 'combo');
if ($request->search) { $total_qty = Stock::whereHas('product', function ($q) use ($businessId) {
$productsQuery->where(function ($q) use ($request) { $q->where('business_id', $businessId);
$q->where('productName', 'like', '%' . $request->search . '%') })->sum('productStock');
->orWhereHas('stocks', function ($stock) use ($request) {
$stock->where('productSalePrice', 'like', '%' . $request->search . '%')
->orWhere('productPurchasePrice', 'like', '%' . $request->search . '%');
});
});
}
$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() ->latest()
->paginate($request->per_page ?? 20) ->paginate($request->per_page ?? 20)->appends($request->query());
->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;
});
});
if ($request->ajax()) { if ($request->ajax()) {
return response()->json([ return response()->json([
'data' => view('business::reports.stocks.datas', compact('stock_reports'))->render(), '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
]); ]);
} }
@@ -72,29 +63,21 @@ public function exportCsv()
return Excel::download(new ExportCurrentStockReport, 'current-stock-report.csv'); return Excel::download(new ExportCurrentStockReport, 'current-stock-report.csv');
} }
public function exportPdf(Request $request) public function exportPdf()
{ {
$productsQuery = Product::with(['stocks' => function ($q) { $query = Product::with('stocks')
$q->select('id', 'product_id', 'productStock', 'productPurchasePrice', 'productSalePrice');
}])
->where('business_id', auth()->user()->business_id) ->where('business_id', auth()->user()->business_id)
->where('product_type', '!=', 'combo'); ->where('product_type', '!=', 'combo');
if ($request->search) { if (request('alert_qty')) {
$productsQuery->where(function ($q) use ($request) { $stock_reports = $query->get()->filter(function ($product) {
$q->where('productName', 'like', '%' . $request->search . '%') $totalStock = $product->stocks->sum('productStock');
->orWhereHas('stocks', function ($stock) use ($request) { return $totalStock <= $product->alert_qty;
$stock->where('productSalePrice', 'like', '%' . $request->search . '%')
->orWhere('productPurchasePrice', 'like', '%' . $request->search . '%');
});
}); });
} 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'); return PdfService::render('business::reports.stocks.pdf', compact('stock_reports'), 'stock-report.pdf');
} }
} }

View File

@@ -72,42 +72,16 @@ public function exportCsv()
return Excel::download(new ExportSubscription, 'subscribers.csv'); 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 return PdfService::render('business::reports.subscription-reports.pdf', compact('subscribers'),'subscription-reports.pdf');
$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');
} }
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); $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')); return view('business::reports.subscription-reports.invoice', compact('subscriber'));

View File

@@ -35,52 +35,82 @@ public function index(Request $request)
->with('purchases_dues') ->with('purchases_dues')
->latest(); ->latest();
$parties = $query // Branch-aware due filter
->paginate($request->per_page ?? 20) if ($activeBranch) {
->appends($request->query()); $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) { if ($activeBranch) {
$parties->setCollection( $parties->setCollection(
$parties->getCollection() $parties->getCollection()
->transform(function ($supplier) use ($activeBranch) { ->transform(function ($supplier) use ($activeBranch) {
$party_due = $supplier->purchases_dues $supplier->due = $supplier->purchases_dues
->where('branch_id', $activeBranch->id) ->where('branch_id', $activeBranch->id)
->sum('dueAmount'); ->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; return $supplier;
}) })
->filter(fn($supplier) => $supplier->due > 0) ->filter(fn($supplier) => $supplier->due > 0)
->values() ->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 { } 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->setCollection(
$parties->getCollection() $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() ->values()
); );
} }
$supplier_total_due = $parties->getCollection()->sum('due'); return view('business::reports.supplier-due.due-reports', compact('parties', 'total_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'));
} }
public function exportExcel() public function exportExcel()
@@ -93,7 +123,7 @@ public function exportCsv()
return Excel::download(new ExportSupplierDue, 'supplier-due.csv'); return Excel::download(new ExportSupplierDue, 'supplier-due.csv');
} }
public function exportPdf(Request $request) public function exportPdf()
{ {
$user = auth()->user(); $user = auth()->user();
$businessId = $user->business_id; $businessId = $user->business_id;
@@ -101,48 +131,29 @@ public function exportPdf(Request $request)
$query = Party::where('business_id', $businessId) $query = Party::where('business_id', $businessId)
->where('type', 'Supplier') ->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') ->with('purchases_dues')
->latest(); ->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(); $parties = $query->get();
if ($activeBranch) { if ($activeBranch) {
$parties = $parties $parties->transform(function ($supplier) use ($activeBranch) {
->transform(function ($supplier) use ($activeBranch) { $supplier->due = $supplier->purchases_dues
$party_due = $supplier->purchases_dues ->where('branch_id', $activeBranch->id)
->where('branch_id', $activeBranch->id) ->sum('dueAmount');
->sum('dueAmount'); return $supplier;
})->filter(fn($supplier) => $supplier->due > 0);
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();
} }
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');
} }
} }

View File

@@ -23,7 +23,7 @@ public function index(Request $request)
} }
$top_products = SaleDetails::query() $top_products = SaleDetails::query()
->with('product:id,productName,productCode,hsn_code') ->with('product:id,productName,productCode')
->whereHas('product', function ($q) use ($businessId) { ->whereHas('product', function ($q) use ($businessId) {
$q->where('business_id', $businessId); $q->where('business_id', $businessId);
}) })
@@ -67,41 +67,28 @@ public function exportCsv()
return Excel::download(new ExportTopProduct, 'top-products.csv'); return Excel::download(new ExportTopProduct, 'top-products.csv');
} }
public function exportPdf(Request $request) public function exportPdf()
{ {
$user = auth()->user(); $branchId = moduleCheck('MultiBranchAddon') ? auth()->user()->branch_id ?? auth()->user()->active_branch_id : null;
$businessId = $user->business_id;
$branchId = null; $top_products = SaleDetails::with('product:id,productName,productCode')
if (moduleCheck('MultiBranchAddon')) { ->whereHas('product', function ($q) {
$branchId = $user->branch_id ?? $user->active_branch_id; $q->where('business_id', auth()->user()->business_id);
} })
->when($branchId, function ($q) use ($branchId) {
$top_products = SaleDetails::query() $q->whereHas('sale', function ($sale) use ($branchId) {
->with('product:id,productName,productCode,hsn_code') $sale->where('branch_id', $branchId);
->whereHas('product', function ($q) use ($businessId) { });
$q->where('business_id', $businessId); })
}) ->select(
->when($request->filled('search'), function ($q) use ($request) { 'product_id',
$q->whereHas('product', function ($q) use ($request) { DB::raw('SUM(quantities) as total_sold_qty'),
$q->where('productName', 'like', "%{$request->search}%") DB::raw('SUM(price * quantities) as total_sale_amount')
->orWhere('productCode', 'like', "%{$request->search}%"); )
}); ->groupBy('product_id')
}) ->orderByDesc('total_sold_qty')
->when($branchId, function ($q) use ($branchId) { ->take(5)
$q->whereHas('sale', function ($q) use ($branchId) { ->get();
$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();
return PdfService::render('business::reports.top-products.pdf', compact('top_products'),'top-product-report.pdf'); return PdfService::render('business::reports.top-products.pdf', compact('top_products'),'top-product-report.pdf');
} }

View File

@@ -8,6 +8,7 @@
use App\Services\PdfService; use App\Services\PdfService;
use App\Traits\DateFilterTrait; use App\Traits\DateFilterTrait;
use App\Traits\DateRangeTrait; use App\Traits\DateRangeTrait;
use Illuminate\Support\Carbon;
use Maatwebsite\Excel\Facades\Excel; use Maatwebsite\Excel\Facades\Excel;
use Modules\Business\App\Exports\ExportTransaction; use Modules\Business\App\Exports\ExportTransaction;
@@ -23,6 +24,15 @@ public function __construct()
public function index(Request $request) public function index(Request $request)
{ {
$businessId = auth()->user()->business_id; $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); $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'); 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); return PdfService::render('business::reports.transaction-history.pdf', compact('transactions'),'due-transactions-report.pdf');
// 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');
} }
} }

View File

@@ -247,7 +247,6 @@ public function store(Request $request)
'productPurchasePrice' => $fromStock->productPurchasePrice, 'productPurchasePrice' => $fromStock->productPurchasePrice,
'profit_percent' => $fromStock->profit_percent, 'profit_percent' => $fromStock->profit_percent,
'productSalePrice' => $fromStock->productSalePrice, 'productSalePrice' => $fromStock->productSalePrice,
'exclusive_price' => $fromStock->exclusive_price,
'productWholeSalePrice' => $fromStock->productWholeSalePrice, 'productWholeSalePrice' => $fromStock->productWholeSalePrice,
'productDealerPrice' => $fromStock->productDealerPrice, 'productDealerPrice' => $fromStock->productDealerPrice,
'mfg_date' => $fromStock->mfg_date, 'mfg_date' => $fromStock->mfg_date,
@@ -454,7 +453,6 @@ public function update(Request $request, $id)
'warehouse_id' => $toWh, 'warehouse_id' => $toWh,
'productStock' => 0, 'productStock' => 0,
'productPurchasePrice' => $fromStock->productPurchasePrice, 'productPurchasePrice' => $fromStock->productPurchasePrice,
'exclusive_price' => $fromStock->exclusive_price,
'profit_percent' => $fromStock->profit_percent, 'profit_percent' => $fromStock->profit_percent,
'productSalePrice' => $fromStock->productSalePrice, 'productSalePrice' => $fromStock->productSalePrice,
'productWholeSalePrice' => $fromStock->productWholeSalePrice, 'productWholeSalePrice' => $fromStock->productWholeSalePrice,

View File

@@ -2,20 +2,16 @@
namespace Modules\Business\App\Http\Controllers; 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\Vat;
use App\Models\VatTransaction; use App\Models\Sale;
use App\Models\Purchase;
use App\Http\Controllers\Controller;
use App\Services\PdfService; use App\Services\PdfService;
use App\Traits\DateFilterTrait; use App\Traits\DateFilterTrait;
use App\Traits\DateRangeTrait; use App\Traits\DateRangeTrait;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel; use Maatwebsite\Excel\Facades\Excel;
use Modules\Business\App\Exports\ExportTaxReport; use Modules\Business\App\Exports\ExportVatReport;
class AcnooVatReportController extends Controller class AcnooVatReportController extends Controller
{ {
@@ -29,441 +25,134 @@ public function __construct()
public function index(Request $request) public function index(Request $request)
{ {
$businessId = auth()->user()->business_id; $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'; $duration = $request->custom_days ?: 'today';
[$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date); [$filter_from_date, $filter_to_date] = $this->applyDateRange($duration, $request->from_date, $request->to_date);
$salesQuery = Sale::where('business_id', $businessId) $salesQuery = Sale::with('user:id,name', 'party:id,name,email,phone,type', 'business:id,companyName', 'payment_type:id,name', 'transactions')
->with([ ->where('business_id', $businessId)
'user:id,name', ->where('vat_amount', '>', 0);
'party:id,name,email,phone,type',
'business:id,companyName',
'payment_type:id,name',
'transactions'
]);
$this->applyDateFilter( // Date Filter
$salesQuery, $this->applyDateFilter($salesQuery, $duration, 'saleDate', $request->from_date, $request->to_date);
$duration,
'saleDate',
$request->from_date,
$request->to_date
);
if ($request->filled('search')) { $sales = $salesQuery->latest()->paginate(20, ['*'], 'sales');
$search = $request->search;
$salesQuery->where(function ($query) use ($search) { $salesVatTotals = [];
$query->where('invoiceNumber', 'like', '%' . $search . '%') foreach ($vats as $vat) {
->orWhere('totalAmount', 'like', '%' . $search . '%') $salesVatTotals[$vat->id] = (clone $salesQuery)->where('vat_id', $vat->id)->sum('vat_amount');
->orWhere('discountAmount', 'like', '%' . $search . '%')
->orWhereHas('party', fn($q) => $q->where('name', 'like', '%' . $search . '%')->orWhere('tax_no', 'like', '%' . $search . '%'));
});
} }
$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) // Date Filter
->where('vat_transactions.vatable_type', SaleDetails::class) $this->applyDateFilter($purchasesQuery, $duration, 'purchaseDate', $request->from_date, $request->to_date);
->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) $purchases = $purchasesQuery->latest()->paginate(20, ['*'], 'purchases');
->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) $purchasesVatTotals = [];
->where('vatable_type', \App\Models\SaleDetails::class) foreach ($vats as $vat) {
->whereIn('vatable_id', function ($query) use ($businessId, $duration, $request) { $purchasesVatTotals[$vat->id] = (clone $purchasesQuery)->where('vat_id', $vat->id)->sum('vat_amount');
$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 . '%'));
});
} }
$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()) { if ($request->ajax()) {
return response()->json([ return response()->json([
'sale_data' => view('business::reports.vats.sale-datas', compact( 'sale_data' => view('business::reports.vats.sale-datas', compact('sales', 'salesVatTotals', 'vats', 'filter_from_date', 'filter_to_date', 'duration'))->render(),
'sales', 'purchase_data' => view('business::reports.vats.purchase-datas', compact('purchases', 'purchasesVatTotals', 'vats', 'filter_from_date', 'filter_to_date', 'duration'))->render(),
'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(),
]); ]);
} }
return view('business::reports.vats.index', compact( return view('business::reports.vats.index', compact('sales', 'salesVatTotals', 'purchases', 'purchasesVatTotals', 'vats', 'filter_from_date', 'filter_to_date', 'duration'));
'sales',
'salesVatTotals',
'salesReturnVatTotals',
'saleVatRowMap',
'saleReturnVatRowMap',
'purchases',
'purchasesVatTotals',
'purchaseReturnVatTotals',
'purchaseVatRowMap',
'purchaseReturnVatRowMap',
'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; $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(); $sales = collect();
$purchases = collect(); $purchases = collect();
$limit = $request->per_page ?? 20; if ($type === 'sales' || $type === 'all') {
$sales = Sale::with('user:id,name', 'party:id,name,email,phone,type', 'payment_type:id,name', 'transactions')
if ($type === 'sales') { ->where('business_id', $businessId)
$sales = $salesQuery->latest()->limit($limit)->get(); ->where('vat_amount', '>', 0)
->latest()
->get();
} }
if ($type === 'purchases') { if ($type === 'purchases' || $type === 'all') {
$purchases = $purchasesQuery->latest()->limit($limit)->get(); $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(); $vats = Vat::where('business_id', $businessId)->get();
return PdfService::render('business::reports.vats.pdf', $salesVatTotals = [];
compact( foreach ($vats as $vat) {
'sales', $salesVatTotals[$vat->id] = $sales->where('vat_id', $vat->id)->sum('vat_amount');
'salesVatTotals', }
'salesReturnVatTotals',
'saleVatRowMap', $purchasesVatTotals = [];
'saleReturnVatRowMap', foreach ($vats as $vat) {
'purchases', $purchasesVatTotals[$vat->id] = $purchases->where('vat_id', $vat->id)->sum('vat_amount');
'purchasesVatTotals', }
'purchaseReturnVatTotals',
'purchaseVatRowMap', $export = new ExportVatReport($sales, $purchases, $vats, $salesVatTotals, $purchasesVatTotals);
'purchaseReturnVatRowMap',
'vats', return Excel::download($export, $filename, $format);
'type', }
'filter_from_date',
'filter_to_date', public function exportPdf($type = 'all')
'duration' {
), 'tax-report.pdf', 'A4', 'L' $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');
} }
} }

View File

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

View File

@@ -17,6 +17,7 @@
use App\Models\PurchaseReturnDetail; use App\Models\PurchaseReturnDetail;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
class DashboardController extends Controller class DashboardController extends Controller
{ {

View File

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

View File

@@ -76,17 +76,17 @@
<div class="table-top-btn-group d-print-none p-2"> <div class="table-top-btn-group d-print-none p-2">
<ul> <ul>
<li> <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=""> <img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>

View File

@@ -6,19 +6,6 @@
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;"> <h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;">
{{ __('Balance Sheet Report') }} {{ __('Balance Sheet Report') }}
</h4> </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>
@endsection @endsection

View File

@@ -53,7 +53,7 @@
</div> </div>
<!-- Button --> <!-- 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"> <div class="form-check mt-2">
<input type="hidden" name="show_in_invoice" value="0"> <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"> <input type="checkbox" name="show_in_invoice" class="form-check-input multi-delete" id="bankDetails" value="1">

View File

@@ -60,7 +60,7 @@
</div> </div>
<!-- Button --> <!-- 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"> <div class="form-check mt-2">
<input type="hidden" name="show_in_invoice" value="0"> <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"> <input type="checkbox" name="show_in_invoice" id="show_in_invoice" class="form-check-input multi-delete" value="1">

View File

@@ -13,7 +13,7 @@
@csrf @csrf
<label>{{ __('Select Product') }}</label> <label>{{ __('Select Product') }}</label>
<div class="search-container"> <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> <ul id="search-results" class="barcode-dropdown search-hidden"></ul>
</div> </div>
<div class="table-responsive mt-3 barcode-table"> <div class="table-responsive mt-3 barcode-table">

View File

@@ -110,17 +110,17 @@
<div class="table-top-btn-group d-print-none p-2"> <div class="table-top-btn-group d-print-none p-2">
<ul> <ul>
<li> <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=""> <img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>

View File

@@ -4,19 +4,7 @@
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center"> <div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
@include('business::print.header') @include('business::print.header')
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Bill Wise Profit & Loss') }}</h4> <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: 14-12-2025 to 24-12-2025') }}</p> --}}
<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>
@endsection @endsection

View File

@@ -20,21 +20,13 @@ class="ajaxform_instant_reload">
<div class="col-lg-12"> <div class="col-lg-12">
<label>{{ __('Icon') }}</label> <label>{{ __('Icon') }}</label>
<div class="custom-upload-wrapper"> <div class="border rounded upload-img-container">
<div class="custom-image-box"> <label class="upload-v4">
<div class="custom-image-content"> <div class="img-wrp">
<svg width="30" height="30" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> <img src="{{ asset('assets/images/icons/upload-icon.svg') }}" alt="Brand" id="brand-img">
<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> </div>
<input type="file" name="icon" class="d-none" onchange="document.getElementById('brand-img').src = window.URL.createObjectURL(this.files[0])" accept="image/*">
<!-- Preview image --> </label>
<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>
</div> </div>
</div> </div>

View File

@@ -52,7 +52,7 @@ class="table-product-img">
<a href="#brand-edit-modal" data-bs-toggle="modal" class="brand-edit-btn" <a href="#brand-edit-modal" data-bs-toggle="modal" class="brand-edit-btn"
data-url="{{ route('business.brands.update', $brand->id) }}" data-url="{{ route('business.brands.update', $brand->id) }}"
data-brands-name="{{ $brand->brandName }}" 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 data-brands-description="{{ $brand->description }}"><i
class="fal fa-pencil-alt"></i>{{ __('Edit') }}</a> class="fal fa-pencil-alt"></i>{{ __('Edit') }}</a>
@endusercan @endusercan

View File

@@ -20,21 +20,13 @@ class="ajaxform_instant_reload brandUpdateForm">
<div class="col-lg-12 mb-2"> <div class="col-lg-12 mb-2">
<label>{{ __("Icon") }}</label> <label>{{ __("Icon") }}</label>
<div class="custom-upload-wrapper"> <div class="border rounded upload-img-container">
<div class="custom-image-box"> <label class="upload-v4">
<div class="custom-image-content"> <div class="img-wrp">
<svg width="30" height="30" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> <img src="" alt="user" id="edit_icon">
<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> </div>
<input type="file" name="icon" class="d-none" onchange="document.getElementById('edit_icon').src = window.URL.createObjectURL(this.files[0])" accept="image/*">
<!-- Preview image --> </label>
<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>
</div> </div>
</div> </div>

View File

@@ -9,33 +9,22 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="border-0"> <div class="border-0">
<div class="card-bodys"> <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="bulk-upload-container">
<div class="row align-items-center"> <div class="d-flex justify-content-between align-items-center ">
<div class="col-lg-6"> <div class="bulk-input">
<div class="custom-upload-wrapper"> <input class="form-control" type="file" name="file" required>
<div class="custom-file-box">
<div class="custom-file-content">
<svg width="30" height="30" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 5V19M5 12H19" stroke="#4B5563" stroke-width="2.0" stroke-linecap="round"/>
</svg>
<span class="custom-upload-text">{{ __('Add File') }}</span>
</div>
<p class="preview-file d-none"></p>
<input type="file" name="file" class="preview-file-input" required>
</div>
</div>
</div> </div>
</div> </div>
<div class="d-flex align-items-center justify-content-between">
<div class="d-flex align-items-center justify-content-between mt-3">
@usercan('bulk-uploads.create') @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 @endusercan
<a href="{{ asset('assets/bulk-products-upload.xlsx') }}"
<a href="{{ asset('assets/bulk-products-upload.xlsx') }}" download class="download-file-btn"> download="bulk-products-upload.xlsx"
<i class="fas fa-download"></i> {{ __('Download File') }} class="download-file-btn mt-3">
<i class="fas fa-download"></i> {{__('Download File')}}
</a> </a>
</div> </div>
</div> </div>

View File

@@ -60,11 +60,11 @@
<td class="text-start d-print-none">{{ ucwords(str_replace('_', ' ', $cash_flow->platform)) }}</td> <td class="text-start d-print-none">{{ ucwords(str_replace('_', ' ', $cash_flow->platform)) }}</td>
<td class="text-center {{ $cash_flow->type === 'credit' ? 'text-success' : '' }}"> <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>
<td class="text-center {{ $cash_flow->type === 'debit' ? 'text-danger' : '' }}"> <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>
<td class="text-center {{ $runningCash < 0 ? 'text-danger' : 'text-success' }}"> <td class="text-center {{ $runningCash < 0 ? 'text-danger' : 'text-success' }}">
@@ -92,8 +92,10 @@
<td class="d-print-none"></td> <td class="d-print-none"></td>
<td></td> <td></td>
<td class="d-print-none text-start"></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-success">{{ currency_format($page_cash_in, currency: business_currency()) }}
<td class="text-center text-danger">{{ currency_format($page_cash_out, currency: business_currency()) }}</td> </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' }}"> <td class="text-center {{ $page_running_cash < 0 ? 'text-danger' : 'text-success' }}">
{{ currency_format($page_running_cash, currency: business_currency()) }} {{ currency_format($page_running_cash, currency: business_currency()) }}
</td> </td>

View File

@@ -44,15 +44,17 @@
<td class="text-start">{{ ucwords(str_replace('_', ' ', $cash_flow->platform)) }}</td> <td class="text-start">{{ ucwords(str_replace('_', ' ', $cash_flow->platform)) }}</td>
@if ($cash_flow->type === 'credit') @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 @else
<td class="text-start">{{ currency_format(0) }}</td> <td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
@endif @endif
@if ($cash_flow->type === 'debit') @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 @else
<td class="text-start">{{ currency_format(0) }}</td> <td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
@endif @endif
<td class="text-start {{ $runningCash < 0 ? 'text-danger' : 'text-success' }}"> <td class="text-start {{ $runningCash < 0 ? 'text-danger' : 'text-success' }}">
@@ -81,8 +83,10 @@
<td class="d-print-none"></td> <td class="d-print-none"></td>
<td></td> <td></td>
<td class="d-print-none text-start"></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-success">{{ currency_format($page_cash_in, currency: business_currency()) }}
<td class="text-center text-danger">{{ currency_format($page_cash_out, currency: business_currency()) }}</td> </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' }}"> <td class="text-center {{ $page_running_cash < 0 ? 'text-danger' : 'text-success' }}">
{{ currency_format($page_running_cash, currency: business_currency()) }} {{ currency_format($page_running_cash, currency: business_currency()) }}
</td> </td>

View File

@@ -23,19 +23,19 @@
<div class="col-lg-2 col-md-6"> <div class="col-lg-2 col-md-6">
<div class="profit-card p-3 m-2 text-white"> <div class="profit-card p-3 m-2 text-white">
<p class="stat-title">{{ __('Cash In') }}</p> <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> </div>
<div class="col-lg-2 col-md-6 "> <div class="col-lg-2 col-md-6 ">
<div class="sales-card p-3 m-2 text-white"> <div class="sales-card p-3 m-2 text-white">
<p class="stat-title">{{ __('Cash Out') }}</p> <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> </div>
<div class="col-lg-2 col-md-12 "> <div class="col-lg-2 col-md-12 ">
<div class="loss-card p-3 m-2 text-white"> <div class="loss-card p-3 m-2 text-white">
<p class="stat-title">{{ __('Running Cash') }}</p> <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> </div>
</div> </div>
@@ -114,17 +114,17 @@
<div class="table-top-btn-group d-print-none p-2"> <div class="table-top-btn-group d-print-none p-2">
<ul> <ul>
<li> <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=""> <img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>

View File

@@ -1,27 +1,15 @@
@extends('layouts.business.pdf.pdf_layout') @extends('layouts.business.pdf.pdf_layout')
@section('pdf_title') @section('pdf_title')
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center"> <div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
@include('business::print.header') @include('business::print.header')
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;">{{ __('Cash Flow Report List') }}</h4> <h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;">{{ __('Cash Flow Report List') }}</h4>
@if ($filter_from_date && $filter_to_date) </div>
<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 @endsection
@section('pdf_content') @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> <thead>
<tr style="background-color: #C52127; color: white;"> <tr style="background-color: #C52127; color: white;">
<th style="border:1px solid gainsboro; color:white;" class="text-start">{{ __('Date') }}</th> <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> <td style="border:1px solid gainsboro; text-align:center;">{{ $cash_flow->invoice_no }}</td>
@if ($cash_flow->platform == 'sale') @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') @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') @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') @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') @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 @else
<td style="border:1px solid gainsboro; text-align:center;">N/A</td> <td style="border:1px solid gainsboro; text-align:center;">N/A</td>
@endif @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;' : '' }}"> <td
{{ $cash_flow->type === 'credit' ? currency_format($cash_flow->amount, currency: business_currency()) : currency_format(0) }} 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>
<td style="border:1px solid gainsboro; text-align:center; {{ $cash_flow->type === 'debit' ? 'color:red;' : '' }}"> <td
{{ $cash_flow->type === 'debit' ? currency_format($cash_flow->amount, currency: business_currency()) : currency_format(0) }} 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>
<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()) }} {{ currency_format($runningCash, currency: business_currency()) }}
</td> </td>
</tr> </tr>
@@ -87,7 +84,8 @@
@if ($cash_flows->count() > 0) @if ($cash_flows->count() > 0)
<tfoot> <tfoot>
<tr style="background-color:#C52127; color:white; font-weight:bold;"> <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> <td style="border:1px solid gainsboro;"></td>
<td style="border:1px solid gainsboro;"></td> <td style="border:1px solid gainsboro;"></td>

View File

@@ -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"> <div class="responsive-table m-0">
<table class="table" id="datatable"> <table class="table" id="datatable">
<thead> <thead>
<tr> <tr>
<th class="w-60 d-print-none"> <th class="w-60">
<div class="d-flex align-items-center gap-3"> <div class="d-flex align-items-center gap-3">
<input type="checkbox" class="select-all-delete multi-delete"> <input type="checkbox" class="select-all-delete multi-delete">
</div> </div>
@@ -28,16 +13,15 @@
<th>{{ __('Payment') }}</th> <th>{{ __('Payment') }}</th>
<th>{{ __('Name') }}</th> <th>{{ __('Name') }}</th>
<th>{{ __('Amount') }}</th> <th>{{ __('Amount') }}</th>
<th class="text-center d-print-none">{{ __('Action') }}</th> <th class="text-center">{{ __('Action') }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach ($cashes as $cash) @foreach ($cashes as $cash)
<tr> <tr>
<td class="w-60 checkbox d-print-none"> <td class="w-60 checkbox">
@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"
<input type="checkbox" name="ids[]" class="delete-checkbox-item multi-delete" value="{{ $cash->id }}"> value="{{ $cash->id }}">
@endif
</td> </td>
<td>{{ ($cashes->currentPage() - 1) * $cashes->perPage() + $loop->iteration }}</td> <td>{{ ($cashes->currentPage() - 1) * $cashes->perPage() + $loop->iteration }}</td>
@@ -55,7 +39,7 @@
</td> </td>
<td> <td>
<div class="dropdown table-action d-print-none"> <div class="dropdown table-action">
<button type="button" data-bs-toggle="dropdown"> <button type="button" data-bs-toggle="dropdown">
<i class="far fa-ellipsis-v"></i> <i class="far fa-ellipsis-v"></i>
</button> </button>
@@ -116,10 +100,10 @@
$editConfig = ['url' => route('business.sales.index')]; $editConfig = ['url' => route('business.sales.index')];
} elseif ($cash->platform === 'purchase') { } elseif ($cash->platform === 'purchase') {
$editConfig = ['url' => route('business.purchases.index')]; $editConfig = ['url' => route('business.purchases.index')];
} elseif ($cash->platform === 'income') { } elseif ($cash->platform === 'income' && $cash->reference_id) {
$editConfig = ['url' => route('business.incomes.index')]; $editConfig = ['url' => route('business.incomes.edit', $cash->reference_id)];
}elseif ($cash->platform === 'expense') { }elseif ($cash->platform === 'expense' && $cash->reference_id) {
$editConfig = ['url' => route('business.expenses.index')]; $editConfig = ['url' => route('business.expenses.edit', $cash->reference_id)];
}elseif ($cash->platform === 'sale_return') { }elseif ($cash->platform === 'sale_return') {
$editConfig = ['url' => route('business.sale-returns.index')]; $editConfig = ['url' => route('business.sale-returns.index')];
}elseif ($cash->platform === 'purchase_return') { }elseif ($cash->platform === 'purchase_return') {
@@ -154,14 +138,12 @@
{{-- Delete --}} {{-- Delete --}}
@usercan('cashes.delete') @usercan('cashes.delete')
@if($cash->platform === 'cash' && in_array($cash->transaction_type, ['cash_to_bank','adjust_cash']))
<li> <li>
<a href="{{ route('business.cashes.destroy', $cash->id) }}" <a href="{{ route('business.cashes.destroy', $cash->id) }}"
class="confirm-action" data-method="DELETE"> class="confirm-action" data-method="DELETE">
<i class="fal fa-trash-alt"></i> {{ __('Delete') }} <i class="fal fa-trash-alt"></i> {{ __('Delete') }}
</a> </a>
</li> </li>
@endif
@endusercan @endusercan
</ul> </ul>
@@ -173,6 +155,6 @@ class="confirm-action" data-method="DELETE">
</table> </table>
</div> </div>
<div class="d-print-none"> <div>
{{ $cashes->links('vendor.pagination.bootstrap-5') }} {{ $cashes->links('vendor.pagination.bootstrap-5') }}
</div> </div>

View File

@@ -14,13 +14,13 @@
<div class="col-lg-2 col-md-6 "> <div class="col-lg-2 col-md-6 ">
<div class="profit-card p-3 m-2 text-white"> <div class="profit-card p-3 m-2 text-white">
<p class="stat-title">{{ __('Balance') }}</p> <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> </div>
</div> </div>
<div class="table-header p-16 d-print-none"> <div class="table-header p-16">
<h4>{{ __('Cash In Hand') }}</h4> <h4>{{ __('Cash In Hand') }}</h4>
<div class="d-flex align-items-center gap-3"> <div class="d-flex align-items-center gap-3">
@@ -35,14 +35,8 @@
</a> </a>
</div> </div>
</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"> <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="table-top-left d-flex gap-3 margin-l-16">
<div class="gpt-up-down-arrow position-relative"> <div class="gpt-up-down-arrow position-relative">
@@ -98,30 +92,6 @@
</div> </div>
</div> </div>
</form> </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>
</div> </div>

View File

@@ -18,21 +18,13 @@
<div class="mt-3 col-lg-12"> <div class="mt-3 col-lg-12">
<label>{{ __('Icon') }}</label> <label>{{ __('Icon') }}</label>
<div class="custom-upload-wrapper"> <div class="border rounded upload-img-container">
<div class="custom-image-box"> <label class="upload-v4">
<div class="custom-image-content"> <div class="img-wrp">
<svg width="30" height="30" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> <img src="{{ asset('assets/images/icons/upload-icon.svg') }}" alt="Brand" id="brand-img">
<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> </div>
<input type="file" name="icon" class="d-none" onchange="document.getElementById('brand-img').src = window.URL.createObjectURL(this.files[0])" accept="image/*">
<!-- Preview image --> </label>
<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>
</div> </div>
</div> </div>

View File

@@ -51,7 +51,7 @@ class="table-product-img">
<a href="#category-edit-modal" class="category-edit-btn" data-bs-toggle="modal" <a href="#category-edit-modal" class="category-edit-btn" data-bs-toggle="modal"
data-url="{{ route('business.categories.update', $category->id) }}" data-url="{{ route('business.categories.update', $category->id) }}"
data-category-name="{{ $category->categoryName }}" 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') }} <i class="fal fa-pencil-alt"></i>{{ __('Edit') }}
</a> </a>
@endusercan @endusercan

View File

@@ -18,21 +18,13 @@ class="ajaxform_instant_reload categoryEditForm">
</div> </div>
<div class="col-lg-12 mb-2"> <div class="col-lg-12 mb-2">
<label>{{ __("Icon") }}</label> <label>{{ __("Icon") }}</label>
<div class="custom-upload-wrapper"> <div class="border rounded upload-img-container">
<div class="custom-image-box"> <label class="upload-v4">
<div class="custom-image-content"> <div class="img-wrp">
<svg width="30" height="30" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> <img src="" alt="user" id="category_icon">
<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> </div>
<input type="file" name="icon" class="d-none" onchange="document.getElementById('category_icon').src = window.URL.createObjectURL(this.files[0])" accept="image/*">
<!-- Preview image --> </label>
<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>
</div> </div>
</div> </div>

View File

@@ -62,7 +62,7 @@ class="filter-form" table="#set-commission-data">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>

View File

@@ -4,29 +4,28 @@
{{-- Check only for Sale, Income & Due collect --}} {{-- Check only for Sale, Income & Due collect --}}
@if(!in_array($context ?? '', ['purchase', 'expense', 'due_pay'])) @if(!in_array($context ?? '', ['purchase', 'expense', 'due_pay']))
<option value="cheque">{{ __('Cheque') }}</option> <option value="cheque">{{ __('Cheque') }}</option>
@endif @endif
{{-- Wallet only for Sale, Purchase, Due (party exist) --}} {{-- Wallet only for Sale, Purchase, Due (party exist) --}}
@if(!in_array($context ?? '', ['income', 'expense', 'guest_due'])) @if(!in_array($context ?? '', ['income', 'expense', 'guest_due']))
<option value="wallet">{{ __('Wallet') }}</option> <option value="wallet">{{ __('Wallet') }}</option>
@endif @endif
@foreach ($payment_types as $type) @foreach ($payment_types as $type)
<option value="{{ $type->id }}">{{ $type->name }}</option> <option value="{{ $type->id }}">{{ $type->name }}</option>
@endforeach @endforeach
</select> </select>
{{-- hidden cheque input field --}} {{-- hidden cheque input field --}}
<div class="cheque-input mt-2 d-none" disabled> <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> </div>
{{-- Dynamic payments (optional data for edit) --}} {{-- Dynamic payments (optional data for edit) --}}
<div class="payment-main-container" <div class="payment-main-container" @if(!empty($transactions)) data-existing-transactions='@json($transactions)'
@if(!empty($transactions)) data-change-amount="{{ $sale->change_amount ?? 0 }}" @endif>
data-existing-transactions='@json($transactions)'
@endif>
{{-- Dynamic payments will appear here --}} {{-- Dynamic payments will appear here --}}
</div> </div>

View File

@@ -267,8 +267,8 @@
<div class=" tab-table-container"> <div class=" tab-table-container">
<div class="custom-tabs"> <div class="custom-tabs">
<button class="tab-item active" data-tab="sales">{{ __('Recent Sales') }}</button> <button class="tab-item active" onclick="showTab('sales')">{{ __('Recent Sales') }}</button>
<button class="tab-item" data-tab="purchase">{{ __('Recent Purchase') }}</button> <button class="tab-item" onclick="showTab('purchase')">{{ __('Recent Purchase') }}</button>
</div> </div>
<div id="sales" class="tab-content dashboard-tab active"> <div id="sales" class="tab-content dashboard-tab active">
<div class="table-container"> <div class="table-container">
@@ -305,7 +305,7 @@
<tr> <tr>
<th class="text-start" scope="col">{{ __("Date") }}</th> <th class="text-start" scope="col">{{ __("Date") }}</th>
<th class="text-center" scope="col">{{ __("Invoice") }}</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">{{ __("Total") }}</th>
<th class="text-center" scope="col">{{ __("Paid") }}</th> <th class="text-center" scope="col">{{ __("Paid") }}</th>
<th class="text-center pr-3" scope="col">{{ __("Due") }}</th> <th class="text-center pr-3" scope="col">{{ __("Due") }}</th>

View File

@@ -69,10 +69,11 @@
@endphp @endphp
<td class="text-start">{{ currency_format($total_amount, currency: business_currency()) }}</td> <td class="text-start">{{ currency_format($total_amount, currency: business_currency()) }}</td>
<td class="text-start {{ $day_book->type === 'credit' ? 'text-success' : '' }}"> <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>
<td class="text-start {{ $day_book->type === 'debit' ? 'text-danger' : '' }}"> <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>
<td class="text-start"> <td class="text-start">
{{ $day_book->payment_type_id ? $day_book->paymentType?->name : ucfirst(explode('_', $day_book->transaction_type)[0]) }} {{ $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_in = $day_books->getCollection()->where('type', 'credit')->sum('amount');
$page_money_out = $day_books->getCollection()->where('type', 'debit')->sum('amount'); $page_money_out = $day_books->getCollection()->where('type', 'debit')->sum('amount');
@endphp @endphp
@@ -127,6 +139,7 @@
<td class="d-print-none"></td> <td class="d-print-none"></td>
<td class="d-print-none text-end"></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_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_in, currency: business_currency()) }}</td>
<td class="text-start">{{ currency_format($page_money_out, currency: business_currency()) }}</td> <td class="text-start">{{ currency_format($page_money_out, currency: business_currency()) }}</td>
<td></td> <td></td>

View File

@@ -37,29 +37,52 @@
<td class="text-start">{{ ucwords(str_replace('_', ' ', $day_book->platform)) }}</td> <td class="text-start">{{ ucwords(str_replace('_', ' ', $day_book->platform)) }}</td>
@if ($day_book->platform == 'sale') @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') @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') @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') @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') @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 @else
<td class="text-start">{{ currency_format(0) }}</td> <td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
@endif @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') @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 @else
<td class="text-start">{{ currency_format(0) }}</td> <td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
@endif @endif
@if ($day_book->type === 'debit') @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 @else
<td class="text-start">{{ currency_format(0) }}</td> <td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
@endif @endif
@if ($day_book->payment_type_id) @if ($day_book->payment_type_id)
@@ -87,7 +110,18 @@
@php @php
$page_total_amount = $day_books->sum(function ($day_book) { $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' => $day_book->sale?->totalAmount ?? 0,
'sale_return' => $day_book->saleReturn?->sale?->totalAmount ?? 0, 'sale_return' => $day_book->saleReturn?->sale?->totalAmount ?? 0,
'purchase' => $day_book->purchase?->totalAmount ?? 0, 'purchase' => $day_book->purchase?->totalAmount ?? 0,

View File

@@ -23,19 +23,19 @@
<div class="col-lg-2 col-md-12 "> <div class="col-lg-2 col-md-12 ">
<div class="loss-card p-3 m-2 text-white"> <div class="loss-card p-3 m-2 text-white">
<p class="stat-title">{{ __('Total Transaction') }}</p> <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> </div>
<div class="col-lg-2 col-md-6 "> <div class="col-lg-2 col-md-6 ">
<div class="profit-card p-3 m-2 text-white"> <div class="profit-card p-3 m-2 text-white">
<p class="stat-title">{{ __('Money In') }}</p> <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> </div>
<div class="col-lg-2 col-md-6 "> <div class="col-lg-2 col-md-6 ">
<div class="sales-card p-3 m-2 text-white"> <div class="sales-card p-3 m-2 text-white">
<p class="stat-title">{{ __('Money Out') }}</p> <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> </div>
</div> </div>
@@ -114,17 +114,17 @@
<div class="table-top-btn-group d-print-none p-2"> <div class="table-top-btn-group d-print-none p-2">
<ul> <ul>
<li> <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=""> <img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>

View File

@@ -4,19 +4,7 @@
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center"> <div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
@include('business::print.header') @include('business::print.header')
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Day Book Report List') }}</h4> <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: 14-12-2025 to 24-12-2025') }}</p> --}}
<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>
@endsection @endsection
@@ -66,19 +54,31 @@
@elseif ($day_book->platform == 'due_collect' || $day_book->platform == 'due_pay') @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> <td style="border:1px solid gainsboro; text-align:center;">{{ currency_format($day_book->dueCollect?->totalDue ?? 0, currency: business_currency()) }}</td>
@else @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 @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') @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 @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 @endif
@if ($day_book->type === 'debit') @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> <td style="border:1px solid gainsboro; text-align:center; color:red;">{{ currency_format($day_book->amount, currency: business_currency()) }}</td>
@else @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 @endif
@if ($day_book->payment_type_id) @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_in = $day_books->where('type', 'credit')->sum('amount');
$page_money_out = $day_books->where('type', 'debit')->sum('amount'); $page_money_out = $day_books->where('type', 'debit')->sum('amount');
@endphp @endphp

View File

@@ -2,27 +2,26 @@
<table class="table" id="datatable"> <table class="table" id="datatable">
<thead> <thead>
<tr> <tr>
<th class="d-print-none">{{ __('SL') }}.</th> <th>{{ __('SL') }}.</th>
<th>{{ __('Name') }}</th> <th>{{ __('Name') }}</th>
<th>{{ __('Email') }}</th> <th>{{ __('Email') }}</th>
<th>{{ __('Phone') }}</th> <th>{{ __('Phone') }}</th>
<th>{{ __('Type') }}</th> <th>{{ __('Type') }}</th>
<th class="text-end">{{ __('Due Amount') }}</th> <th class="text-end">{{ __('Due Amount') }}</th>
<th class="d-print-none">{{ __('Action') }}</th> <th>{{ __('Action') }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach ($parties as $party) @foreach ($parties as $party)
<tr> <tr>
<td class="d-print-none">{{ ($parties->currentPage() - 1) * $parties->perPage() + $loop->iteration }} <td>{{ ($parties->currentPage() - 1) * $parties->perPage() + $loop->iteration }}</td>
</td>
<td>{{ $party->name }}</td> <td>{{ $party->name }}</td>
<td>{{ $party->email }}</td> <td>{{ $party->email }}</td>
<td>{{ $party->phone }}</td> <td>{{ $party->phone }}</td>
@if ($party->type == 'Retailer') @if ($party->type == 'Retailer')
<td>{{ __('Customer') }}</td> <td>{{ __('Customer') }}</td>
@else @else
<td>{{ $party->type }}</td> <td>{{ $party->type }}</td>
@endif @endif
<td class="text-danger text-end"> <td class="text-danger text-end">
{{ currency_format($party->due, currency: business_currency()) }} {{ currency_format($party->due, currency: business_currency()) }}
@@ -40,61 +39,32 @@
</a> </a>
</li> </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> <li>
<a href="#" data-url="{{ route('business.dues.view-payment', $party->id) }}" <a href="{{ route('business.collect.dues.invoice', $party->id) }}"
class="view-due-payment-btn" data-bs-toggle="modal" target="_blank">
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">
<img src="{{ asset('assets/images/icons/Invoic.svg') }}" alt=""> <img src="{{ asset('assets/images/icons/Invoic.svg') }}" alt="">
{{ __('Invoice') }} {{ __('Invoice') }}
</a> </a>
@@ -105,20 +75,8 @@ class="view-due-payment-btn" data-bs-toggle="modal"
</td> </td>
</tr> </tr>
@endforeach @endforeach
</tbody> </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> </table>
</div> </div>
<div class="mt-3"> <div class="mt-3">

View File

@@ -12,29 +12,23 @@
<div class="d-flex align-items-center justify-content-center gap-3"> <div class="d-flex align-items-center justify-content-center gap-3">
<div class="profit-card p-3 text-white"> <div class="profit-card p-3 text-white">
<p class="stat-title">{{ __('Supplier Due') }}</p> <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>
<div class="loss-card p-3 text-white"> <div class="loss-card p-3 text-white">
<p class="stat-title">{{ __('Customer Due') }}</p> <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>
</div> </div>
<div class="card"> <div class="card">
<div class="card-bodys"> <div class="card-bodys">
<div class="table-header p-16 d-print-none"> <div class="table-header p-16">
<h4>{{ __('Due List') }}</h4> <h4>{{ __('Due List') }}</h4>
</div> </div>
<div class="table-top-form p-16">
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center"> <form action="{{ route('business.dues.index') }}" method="GET" class="filter-form" table="#due-reports-data">
@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-left d-flex gap-3 "> <div class="table-top-left d-flex gap-3 ">
<div class="gpt-up-down-arrow position-relative"> <div class="gpt-up-down-arrow position-relative">
@@ -67,30 +61,6 @@
</div> </div>
</div> </div>
</form> </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>
</div> </div>

View File

@@ -5,7 +5,7 @@
@endsection @endsection
@section('main_content') @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') @include('thermalprinteraddon::due-collects.3_inch_80mm')
@else @else
@include('business::dues.invoices.a4-size') @include('business::dues.invoices.a4-size')

View File

@@ -1,37 +1,23 @@
@php
$isBusinessRoute = request()->routeIs('business.dues.*');
$business_id = $party->business_id;
@endphp
<div class="invoice-container"> <div class="invoice-container">
<div class="invoice-content p-4"> <div class="invoice-content p-4">
{{-- Print Header --}} {{-- Print Header --}}
<div <div class="row py-2 d-print-none d-flex align-items-start justify-content-between border-bottom print-container">
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> <span class="Money-Receipt white-text">{{ __('Money Receipt') }}</span>
</div> </div>
<div class="col-md-8 d-flex justify-content-start justify-content-md-end align-items-end"> <div class="col-md-6 d-flex justify-content-end align-items-end">
<div class="d-flex gap-3 flex-wrap"> <div class="d-flex gap-3">
<a href="javascript:void(0)" class="pdf-btn print-btn share-btn" data-bs-toggle="modal" data-bs-target="#shareModalDues">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.8303 3.75H6.96224C4.50701 3.75 3.27939 3.75 2.51665 4.48223C1.75391 5.21447 1.75391 6.39298 1.75391 8.75V12.0833C1.75391 14.4403 1.75391 15.6188 2.51665 16.3511C3.27939 17.0833 4.50701 17.0833 6.96224 17.0833H10.4678C12.923 17.0833 14.1506 17.0833 14.9133 16.3511C15.4075 15.8767 15.5815 15.2149 15.6428 14.1667" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
<path d="M13.4723 5.83073V3.20869C13.4723 3.04597 13.6097 2.91406 13.7792 2.91406C13.8605 2.91406 13.9386 2.9451 13.9962 3.00035L17.9396 6.7861C18.1362 6.97475 18.2465 7.23061 18.2465 7.4974C18.2465 7.76418 18.1362 8.02005 17.9396 8.20869L13.9962 11.9944C13.9386 12.0497 13.8605 12.0807 13.7792 12.0807C13.6097 12.0807 13.4723 11.9488 13.4723 11.7861V9.16406H10.9298C7.39583 9.16406 6.09375 12.0807 6.09375 12.0807V9.9974C6.09375 7.69621 8.03696 5.83073 10.434 5.83073H13.4723Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
</svg>
{{__('Share')}}
</a>
<form action="{{ route('business.collect.dues.mail', $party->id) }}" method="POST" <form action="{{ route('business.collect.dues.mail', $party->id) }}" method="POST"
class="ajaxform_instant_reload"> class="ajaxform_instant_reload">
@csrf @csrf
<button type="submit" class="btn custom-print-btn submit-btn"><img class="w-10 h-10" <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>
src="{{ asset('assets/img/email.svg') }}"><span class="pl-1">{{__('Email')}}</span>
</button> </button>
</form> </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"> class="pdf-btn print-btn">
<img class="w-10 h-10" src="{{ asset('assets/img/pdf.svg') }}"> <img class="w-10 h-10" src="{{ asset('assets/img/pdf.svg') }}">
{{__('PDF')}}</a> {{__('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"> <div class="d-flex justify-content-between align-items-center gap-3 print-logo-container">
<!-- Left Side: Logo and Content --> <!-- Left Side: Logo and Content -->
<div class="d-flex align-items-center gap-2 logo"> <div class="d-flex align-items-center gap-2 logo">
@if ((get_business_option('business-settings', $business_id)['show_a4_invoice_logo'] ?? 0) == 1) @if ((get_business_option('business-settings')['show_a4_invoice_logo'] ?? 0) == 1 )
<img class="invoice-logo" <img class="invoice-logo" src="{{ asset(get_business_option('business-settings')['a4_invoice_logo'] ?? 'assets/images/default.svg') ?? '' }}" alt="">
src="{{ Storage::url(get_business_option('business-settings', $business_id)['a4_invoice_logo'] ?? 'assets/images/default.svg') ?? '' }}"
alt="">
@endif @endif
</div> </div>
<!-- Right Side: Invoice --> <!-- Right Side: Invoice -->
<div class="address-container"> <div class="address-container">
@if (($due_collect->business->meta['show_address'] ?? 0) == 1) @if (($due_collect->business->meta['show_address'] ?? 0) == 1)
<p> {{__('Address')}} : {{ $due_collect->branch?->address ?? $due_collect->business?->address ?? '' }} <p> {{__('Address')}} : {{ $due_collect->branch?->address ?? $due_collect->business?->address ?? '' }}</p>
</p>
@endif @endif
@if (($due_collect->business->meta['show_phone_number'] ?? 0) == 1) @if (($due_collect->business->meta['show_phone_number'] ?? 0) == 1)
<p> {{__('Mobile')}} : {{ $due_collect->branch?->phone ?? $due_collect->business?->phoneNumber ?? '' }} <p> {{__('Mobile')}} : {{ $due_collect->branch?->phone ?? $due_collect->business?->phoneNumber ?? '' }}</p>
</p>
@endif @endif
@if (($due_collect->business->meta['show_email'] ?? 0) == 1) @if (($due_collect->business->meta['show_email'] ?? 0) == 1)
<p> {{__('Email')}} : {{ $due_collect->branch?->email ?? $due_collect->business?->email ?? '' }}</p> <p> {{__('Email')}} : {{ $due_collect->branch?->email ?? $due_collect->business?->email ?? '' }}</p>
@@ -77,8 +59,7 @@ class="pdf-btn print-btn">
</div> </div>
</div> </div>
<h3 class="right-invoice receipt-invoice-title mb-0 align-self-center white-text ">{{ __('MONEY RECEIPT') }} <h3 class="right-invoice receipt-invoice-title mb-0 align-self-center white-text ">{{ __('MONEY RECEIPT') }}</h3>
</h3>
<div class="d-flex align-items-start justify-content-between flex-wrap"> <div class="d-flex align-items-start justify-content-between flex-wrap">
<div> <div>
<table class="table"> <table class="table">
@@ -133,13 +114,12 @@ class="pdf-btn print-btn">
<tr class="in-table-body"> <tr class="in-table-body">
<td class="text-center">1</td> <td class="text-center">1</td>
<td class="text-start"> <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>
<td class="text-end"> <td class="text-end">
{{ currency_format($due_collect->payDueAmount ?? 0, currency: business_currency($business_id)) }} {{ currency_format($due_collect->dueAmountAfterPay ?? 0, currency: business_currency()) }}
</td>
<td class="text-end">
{{ currency_format($due_collect->dueAmountAfterPay ?? 0, currency: business_currency($business_id)) }}
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -152,54 +132,54 @@ class="pdf-btn print-btn">
<tr class="in-table-row"> <tr class="in-table-row">
<td class="text-start"></td> <td class="text-start"></td>
</tr> </tr>
@if ((get_business_option('business-settings', $business_id)['show_note'] ?? 0) == 1) @if ((get_business_option('business-settings')['show_note'] ?? 0) == 1)
<tr class="in-table-row"> <tr class="in-table-row">
<td class="text-start pb-2 pt-3"> <td class="text-start pb-2 pt-3">
{{ get_business_option('business-settings', $business_id)['note'] ?? '' }} {{ get_business_option('business-settings')['note'] ?? '' }}
</td> </td>
</tr> </tr>
@endif @endif
<tr class="in-table-row"> <tr class="in-table-row">
<td class="text-start paid-by">{{ __('Paid by') }} : <td class="text-start paid-by">{{ __('Paid by') }} :
{{ $transactionTypes ?? ($due_collect->payment_type_id ? ($due_collect->payment_type->name ?? '') : ($due_collect->paymentType ?? '')) }} {{ $transactionTypes ?? ($due_collect->payment_type_id ? ($due_collect->payment_type->name ?? '') : ($due_collect->paymentType ?? '')) }}
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@if ($bank_detail->show_in_invoice ?? 0 == 1) @if ($bank_detail->show_in_invoice ?? 0 == 1)
<div class="bank-details-container"> <div class="bank-details-container">
<div class="bank-details-title"> <div class="bank-details-title">
{{__('Bank Details')}} {{__('Bank Details')}}
</div> </div>
<div class="back-details-content"> <div class="back-details-content">
<table class="table mb-2"> <table class="table mb-2">
<tbody> <tbody>
<tr class="in-table-row"> <tr class="in-table-row">
<td class="text-start in-table-title">{{ __('Name') }}</td> <td class="text-start in-table-title">{{ __('Name') }}</td>
<td class="clone-width">:</td> <td class="clone-width">:</td>
<td class="text-start">{{ $bank_detail->name }}</td> <td class="text-start">{{ $bank_detail->name }}</td>
</tr> </tr>
<tr class="in-table-row"> <tr class="in-table-row">
<td class="text-start in-table-title">{{ __('Account No') }}</td> <td class="text-start in-table-title">{{ __('Account No') }}</td>
<td class="clone-width">:</td> <td class="clone-width">:</td>
<td class="text-start">{{ $bank_detail->meta['account_number'] ?? '' }}</td> <td class="text-start">{{ $bank_detail->meta['account_number'] ?? '' }}</td>
</tr> </tr>
<tr class="in-table-row"> <tr class="in-table-row">
<td class="text-start in-table-title">{{ __('UPI ID') }}</td> <td class="text-start in-table-title">{{ __('UPI ID') }}</td>
<td class="clone-width">:</td> <td class="clone-width">:</td>
<td class="text-start">{{ $bank_detail->meta['upi_id'] ?? '' }}</td> <td class="text-start">{{ $bank_detail->meta['upi_id'] ?? '' }}</td>
</tr> </tr>
<tr class="in-table-row"> <tr class="in-table-row">
<td class="text-start in-table-title">{{ __('Holders Nmae') }}</td> <td class="text-start in-table-title">{{ __('Holders Nmae') }}</td>
<td class="clone-width">:</td> <td class="clone-width">:</td>
<td class="text-start">{{ $bank_detail->meta['account_holder'] ?? '' }}</td> <td class="text-start">{{ $bank_detail->meta['account_holder'] ?? '' }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div> @endif
@endif
</div> </div>
<div> <div>
<table class="table"> <table class="table">
@@ -208,17 +188,15 @@ class="pdf-btn print-btn">
<td class="text-end">{{ __('Payable Amount') }}</td> <td class="text-end">{{ __('Payable Amount') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <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>
</td> </td>
</tr> </tr>
<tr class="in-table-row-bottom"> <tr class="in-table-row-bottom">
<td class="text-end"> <td class="text-end">{{ $party->type === 'Supplier' ? __('Paid Amount') : __('Received Amount') }}</td>
{{ $party->type === 'Supplier' ? __('Paid Amount') : __('Received Amount') }}
</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <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>
</td> </td>
</tr> </tr>
@@ -226,7 +204,7 @@ class="pdf-btn print-btn">
<td class="text-end">{{ __('Due Amount') }}</td> <td class="text-end">{{ __('Due Amount') }}</td>
<td class="text-end">:</td> <td class="text-end">:</td>
<td class="text-end"> <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> </td>
</tr> </tr>
</tbody> </tbody>
@@ -245,28 +223,15 @@ class="pdf-btn print-btn">
</div> </div>
</div> </div>
</div> </div>
@if ((get_business_option('business-settings', $business_id)['show_warranty'] ?? 0) == 1) @if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
<div class="warranty-container-2 mt-3"> <div class="warranty-container-2 mt-3">
<p> <p>
@if ((get_business_option('business-settings', $business_id)['show_warranty'] ?? 0) == 1) @if ((get_business_option('business-settings')['show_warranty'] ?? 0) == 1)
<span>{{ get_business_option('business-settings', $business_id)['warranty_void_label'] ?? '' }} - <span>{{ get_business_option('business-settings')['warranty_void_label'] ?? '' }} - </span>
</span>
@endif @endif
{{ get_business_option('business-settings', $business_id)['warranty_void'] ?? '' }} {{ get_business_option('business-settings')['warranty_void'] ?? '' }}
</p> </p>
</div> </div>
@endif @endif
<h4 class="tax-powered pt-3 pb-0">{{ get_option('general')['admin_footer_text'] ?? '' }}:
{{ get_option('general')['admin_footer_link_text'] ?? '' }}
</h4>
</div> </div>
</div> </div>
@php
$shareUrl = $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])

View File

@@ -2,19 +2,19 @@
<table class="table" id="datatable"> <table class="table" id="datatable">
<thead> <thead>
<tr> <tr>
<th class="d-print-none">{{ __('SL') }}.</th> <th>{{ __('SL') }}.</th>
<th>{{ __('Name') }}</th> <th>{{ __('Name') }}</th>
<th>{{ __('Email') }}</th> <th>{{ __('Email') }}</th>
<th>{{ __('Phone') }}</th> <th>{{ __('Phone') }}</th>
<th>{{ __('Type') }}</th> <th>{{ __('Type') }}</th>
<th class="text-end">{{ __('Due Amount') }}</th> <th class="text-end">{{ __('Due Amount') }}</th>
<th class="d-print-none">{{ __('Action') }}</th> <th>{{ __('Action') }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach ($parties as $party) @foreach ($parties as $party)
<tr> <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->name }}</td>
<td>{{ $party->email }}</td> <td>{{ $party->email }}</td>
<td>{{ $party->phone }}</td> <td>{{ $party->phone }}</td>
@@ -59,14 +59,10 @@ class="view-due-payment-btn" data-bs-toggle="modal"
{{ __('View Payment') }} {{ __('View Payment') }}
</a> </a>
</li> </li>
@if ($party->dueCollect)
@php
$due = $party->dueCollect()->latest()->first();
@endphp
@if ($due)
<li> <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=""> <img src="{{ asset('assets/images/icons/Invoic.svg') }}" alt="">
{{ __('Invoice') }} {{ __('Invoice') }}
</a> </a>
@@ -78,20 +74,6 @@ class="view-due-payment-btn" data-bs-toggle="modal"
</tr> </tr>
@endforeach @endforeach
</tbody> </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> </table>
</div> </div>
<div class="mt-3"> <div class="mt-3">

View File

@@ -1,7 +1,7 @@
@extends('layouts.business.master') @extends('layouts.business.master')
@section('title') @section('title')
{{ __(':type Due List', ['type' => request('type') === 'Retailer' ? __('Customer') : __(request('type'))]) }} {{ __('Due List') }}
@endsection @endsection
@section('main_content') @section('main_content')
@@ -10,17 +10,11 @@
<div class="card"> <div class="card">
<div class="card-bodys"> <div class="card-bodys">
<div class="table-header p-16 d-print-none"> <div class="table-header p-16">
<h4>{{ __(':type Due List', ['type' => request('type') === 'Retailer' ? __('Customer') : __(request('type'))]) }}</h4> <h4>{{ __('Due List') }}</h4>
</div> </div>
<div class="table-top-form p-16">
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center"> <form action="{{ route('business.party.dues') }}" method="GET" class="filter-form" table="#party-reports-data">
@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">
@if(request('type')) @if(request('type'))
<input type="hidden" name="type" value="{{ request('type') }}"> <input type="hidden" name="type" value="{{ request('type') }}">
@@ -47,30 +41,6 @@
</div> </div>
</div> </div>
</form> </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>
</div> </div>

View File

@@ -156,7 +156,7 @@
@endphp @endphp
@section('pdf_content') @section('pdf_content')
<div class="in-container" dir="{{ app()->getLocale() == 'ar' ? 'rtl' : 'ltr' }}"> <div class="in-container">
<div class="in-content"> <div class="in-content">
{{-- <table width="100%" class="invoice-top-header"> {{-- <table width="100%" class="invoice-top-header">
<tr> <tr>
@@ -247,7 +247,7 @@
<table width="100%" style="margin-bottom:10px;"> <table width="100%" style="margin-bottom:10px;">
<tr> <tr>
<td width="50%" valign="top" <td width="50%" valign="top"
style="text-align:{{ app()->getLocale() == 'ar' ? 'right' : 'left' }};"> style="text-align:{{ app()->getLocale() == 'ar' ? 'left' : 'left' }};">
<table> <table>
<tr> <tr>
<td>{{ __('Invoice') }}</td> <td>{{ __('Invoice') }}</td>
@@ -265,7 +265,7 @@
</td> </td>
<td width="50%" valign="top" <td width="50%" valign="top"
style="text-align:{{ app()->getLocale() == 'ar' ? 'left' : 'right' }};"> style="text-align:{{ app()->getLocale() == 'ar' ? 'right' : 'right' }};">
<table> <table>
<tr> <tr>
<td>{{ __('Date') }}</td> <td>{{ __('Date') }}</td>

View File

@@ -6,7 +6,6 @@
<th class="d-print-none">{{ __('Image') }}</th> <th class="d-print-none">{{ __('Image') }}</th>
<th>{{ __('Product Name') }}</th> <th>{{ __('Product Name') }}</th>
<th class="d-print-none">{{ __('Code') }}</th> <th class="d-print-none">{{ __('Code') }}</th>
<th class="d-print-none">{{ __('HSN Code') }}</th>
<th class="d-print-none">{{ __('Brand') }}</th> <th class="d-print-none">{{ __('Brand') }}</th>
<th>{{ __('Category') }}</th> <th>{{ __('Category') }}</th>
<th class="d-print-none">{{ __('Unit') }}</th> <th class="d-print-none">{{ __('Unit') }}</th>
@@ -48,7 +47,6 @@
<td>{{ $product->productName }}</td> <td>{{ $product->productName }}</td>
<td class="d-print-none">{{ $product->productCode }}</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> <td class="d-print-none">{{ $product->brand->brandName ?? '' }}</td>

View File

@@ -2,9 +2,9 @@
<thead> <thead>
<tr> <tr>
<th>{{ __('SL') }}. </th> <th>{{ __('SL') }}. </th>
<th>{{ __('Image') }} </th>
<th>{{ __('Product Name') }} </th> <th>{{ __('Product Name') }} </th>
<th>{{ __('Code') }} </th> <th>{{ __('Code') }} </th>
<th>{{ __('HSN Code') }} </th>
<th>{{ __('Brand') }} </th> <th>{{ __('Brand') }} </th>
<th>{{ __('Category') }} </th> <th>{{ __('Category') }} </th>
<th>{{ __('Unit') }} </th> <th>{{ __('Unit') }} </th>
@@ -17,6 +17,7 @@
<tbody> <tbody>
@foreach ($expired_products as $product) @foreach ($expired_products as $product)
@php @php
$nonEmptyStock = $product->stocks->firstWhere('productStock', '>', 0); $nonEmptyStock = $product->stocks->firstWhere('productStock', '>', 0);
$fallbackStock = $product->stocks->first(); // fallback if no stock > 0 $fallbackStock = $product->stocks->first(); // fallback if no stock > 0
@@ -24,11 +25,12 @@
$latestPurchasePrice = $stock?->productPurchasePrice ?? 0; $latestPurchasePrice = $stock?->productPurchasePrice ?? 0;
$latestSalePrice = $stock?->productSalePrice ?? 0; $latestSalePrice = $stock?->productSalePrice ?? 0;
@endphp @endphp
<tr> <tr>
<td>{{ $loop->index + 1 }}</td> <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->productName }}</td>
<td>{{ $product->productCode }}</td> <td>{{ $product->productCode }}</td>
<td>{{ $product->hsn_code }}</td>
<td>{{ $product->brand->brandName ?? '' }}</td> <td>{{ $product->brand->brandName ?? '' }}</td>
<td>{{ $product->category->categoryName ?? '' }}</td> <td>{{ $product->category->categoryName ?? '' }}</td>
<td>{{ $product->unit->unitName ?? '' }}</td> <td>{{ $product->unit->unitName ?? '' }}</td>

View File

@@ -47,17 +47,17 @@
<div class="table-top-btn-group d-print-none"> <div class="table-top-btn-group d-print-none">
<ul> <ul>
<li> <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=""> <img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>

View File

@@ -1,91 +1,62 @@
@if ($filter_from_date && $filter_to_date) @php
<div class="mb-2 text-center fw-bold duration-display"> $maxRowCount = max($mergedIncomeSaleData->count(), $mergedExpenseData->count());
<strong>{{ __('Duration:') }}</strong> @endphp
@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
@for ($i = 0; $i < $maxRowCount; $i++) @for ($i = 0; $i < $maxRowCount; $i++)
@php @php
$incomeSaleRow = $mergedIncomeSaleData[$i] ?? null; $incomeSaleRow = $mergedIncomeSaleData[$i] ?? null;
$expenseRow = $mergedExpenseData[$i] ?? null; $expenseRow = $mergedExpenseData[$i] ?? null;
@endphp @endphp
<tr> <tr>
{{-- Sale / Income Column --}} {{-- Sale / Income Column --}}
<td class="text-start loss-profit-tbody"> <td class="text-start loss-profit-tbody">
{{ $incomeSaleRow ? $incomeSaleRow->type : '' }} {{ $incomeSaleRow ? $incomeSaleRow->type : '' }}
</td> </td>
<td class="text-start loss-profit-tbody d-print-none"> <td class="text-start loss-profit-tbody d-print-none">
{{ $incomeSaleRow ? formatted_date($incomeSaleRow->date) : '' }} {{ $incomeSaleRow ? formatted_date($incomeSaleRow->date) : '' }}
</td> </td>
<td class="text-start loss-profit-tbody "> <td class="text-start loss-profit-tbody ">
{{ $incomeSaleRow && isset($incomeSaleRow->total_sales) ? currency_format($incomeSaleRow->total_sales, 'icon', 2, business_currency()) : '' }} {{ $incomeSaleRow && isset($incomeSaleRow->total_sales) ? currency_format($incomeSaleRow->total_sales, 'icon', 2, business_currency()) : '' }}
</td> </td>
<td class="text-end loss-profit-tbody "> <td class="text-end loss-profit-tbody ">
{{ $incomeSaleRow && isset($incomeSaleRow->total_incomes) ? currency_format($incomeSaleRow->total_incomes, 'icon', 2, business_currency()) : '' }} {{ $incomeSaleRow && isset($incomeSaleRow->total_incomes) ? currency_format($incomeSaleRow->total_incomes, 'icon', 2, business_currency()) : '' }}
</td> </td>
{{-- Expense Column --}} {{-- Expense Column --}}
<td class="text-start loss-profit-tbody expense-type"> <td class="text-start loss-profit-tbody expense-type">
{{ $expenseRow ? $expenseRow->type : '' }} {{ $expenseRow ? $expenseRow->type : '' }}
</td> </td>
<td class="text-start loss-profit-tbody d-print-none"> <td class="text-start loss-profit-tbody d-print-none">
{{ $expenseRow ? formatted_date($expenseRow->date) : '' }} {{ $expenseRow ? formatted_date($expenseRow->date) : '' }}
</td> </td>
<td class="text-end loss-profit-tbody"> <td class="text-end loss-profit-tbody">
{{ $expenseRow ? currency_format($expenseRow->total_expenses ?? 0, 'icon', 2, business_currency()) : '' }} {{ $expenseRow ? currency_format($expenseRow->total_expenses ?? 0, 'icon', 2, business_currency()) : '' }}
</td> </td>
</tr> </tr>
@endfor @endfor
{{-- Summary Rows --}} {{-- Summary Rows --}}
<tr class="fw-bold"> <tr class="fw-bold">
<td class="text-start bottom-profit-expense">{{ __('Gross Profit') }}</td> <td class="text-start bottom-profit-expense">{{ __('Gross Profit') }}</td>
<td class="d-print-none bottom-profit-expense"></td> <td class="d-print-none bottom-profit-expense"></td>
<td class="text-start bottom-profit-expense"> <td class="text-start bottom-profit-expense">
{{ currency_format($grossSaleProfit, 'icon', 2, business_currency()) }} {{ currency_format($grossSaleProfit, 'icon', 2, business_currency()) }}
</td> </td>
<td class="text-end bottom-profit-expense"> <td class="text-end bottom-profit-expense">
{{ currency_format($grossIncomeProfit, 'icon', 2, business_currency()) }} {{ currency_format($grossIncomeProfit, 'icon', 2, business_currency()) }}
</td> </td>
<td class="text-start bottom-profit-expense expense-type">{{ __('Total Expenses') }}</td> <td class="text-start bottom-profit-expense expense-type">{{ __('Total Expenses') }}</td>
<td class="d-print-none bottom-profit-expense"></td> <td class="d-print-none bottom-profit-expense"></td>
<td class="text-end bottom-profit-expense"> <td class="text-end bottom-profit-expense">
{{ currency_format($totalExpenses, 'icon', 2, business_currency()) }} {{ currency_format($totalExpenses, 'icon', 2, business_currency()) }}
</td> </td>
</tr> </tr>
<tr class="fw-bold text-center bg-light"> <tr class="fw-bold text-center bg-light">
<td class="bottom-net-profit" colspan="7"> <td class="bottom-net-profit" colspan="7">
{{ __('Net Profit (Income - Expense) =') }} {{ __('Net Profit (Income - Expense) =') }}
<span class="{{ $netProfit >= 0 ? 'profit-ammount' : 'expense-ammount' }}"> <span class="{{ $netProfit >= 0 ? 'profit-ammount' : 'expense-ammount' }}">
{{ currency_format($netProfit, 'icon', 2, business_currency()) }} {{ currency_format($netProfit, 'icon', 2, business_currency()) }}
</span> </span>
</td> </td>
</tr> </tr>
</tbody>
</table>

View File

@@ -9,22 +9,22 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="card"> <div class="card">
<div class="card-bodys"> <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="col-lg-2 col-md-12">
<div class="loss-card p-3 m-2 text-white"> <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> <p class="stat-title">{{ __('Gross Profit') }}</p>
</div> </div>
</div> </div>
<div class="col-lg-2 col-md-6"> <div class="col-lg-2 col-md-6">
<div class="profit-card p-3 m-2 text-white"> <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> <p class="stat-title">{{ __('Expenses') }}</p>
</div> </div>
</div> </div>
<div class="col-lg-2 col-md-6"> <div class="col-lg-2 col-md-6">
<div class="sales-card p-3 m-2 text-white"> <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> <p class="stat-title">{{ __('Net Profit') }}</p>
</div> </div>
</div> </div>
@@ -45,16 +45,6 @@
<div class="d-flex align-items-center gap-3 flex-wrap table-top-left"> <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="m-0 p-0 d-print-none">
<div class="date-filters-container"> <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"> <div class="input-wrapper align-items-center date-filters d-none">
<label class="header-label">{{ __('From Date') }}</label> <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"> <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"> <div class="table-top-btn-group d-print-none p-2">
<ul> <ul>
<li> <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=""> <img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>
@@ -116,9 +106,22 @@
</div> </div>
</div> </div>
<div class="responsive-table m-0"> <div class="responsive-table m-0">
<div id="loss-profit-history-data"> <table class="table table-bordered">
@include('business::loss-profit-histories.datas') <thead>
</div> <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>
</div> </div>

View File

@@ -4,19 +4,6 @@
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center"> <div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
@include('business::print.header') @include('business::print.header')
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;">{{ __('Loss Profit History List') }}</h4> <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> </div>
@endsection @endsection

View File

@@ -58,28 +58,12 @@
</li> </li>
@if (moduleCheck('MarketingAddon')) @if (moduleCheck('MarketingAddon'))
<li class="nav-item settings-item" role="presentation"> <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"> data-bs-target="#sms" type="button" role="tab">
{{__('SMS Gateways')}} {{__('SMS Settings')}}
</button> </button>
</li> </li>
@endif @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> </ul>
<div class="tab-content mt-3" id="settingsTabContent"> <div class="tab-content mt-3" id="settingsTabContent">
@@ -95,10 +79,10 @@
xmlns="http://www.w3.org/2000/svg"> xmlns="http://www.w3.org/2000/svg">
<path <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" 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 <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" 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> </svg>
</div> </div>
<div> <div>
@@ -120,14 +104,14 @@ class="text-decoration-none text-dark">
xmlns="http://www.w3.org/2000/svg"> xmlns="http://www.w3.org/2000/svg">
<path <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" 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" /> stroke-linejoin="round" />
<path <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" 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 <path
d="M15.334 19C15.334 20.6569 13.9909 22 12.334 22C10.6771 22 9.33398 20.6569 9.33398 19" 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" /> stroke-linejoin="round" />
</svg> </svg>
</div> </div>
@@ -150,10 +134,10 @@ class="text-decoration-none text-dark">
xmlns="http://www.w3.org/2000/svg"> xmlns="http://www.w3.org/2000/svg">
<path <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" 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 <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" 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> </svg>
</div> </div>
<div> <div>
@@ -174,14 +158,14 @@ class="text-decoration-none text-dark">
fill="none" xmlns="http://www.w3.org/2000/svg"> fill="none" xmlns="http://www.w3.org/2000/svg">
<path <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" 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" /> stroke-linejoin="round" />
<path <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" 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 <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" 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> </svg>
</div> </div>
<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="d-flex align-items-center jusitfy-content-center gap-3">
<div class="settings-icon"> <div class="settings-icon">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> <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="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="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="#C52127" 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="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="var(--clr-primary)" 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> </svg>
</div> </div>
<div> <div>
@@ -216,28 +200,30 @@ class="text-decoration-none text-dark">
</div> </div>
@endif @endif
@if (moduleCheck('MarketingAddon'))
<div> <div>
<a href="{{ route('business.email-settings.index') }}" class="text-decoration-none text-dark"> {{-- <a href="{{ route('business.language-settings.index') }}" class="text-decoration-none text-dark">
<div class="setting-box"> <div class=" setting-box">
<div class="d-flex align-items-center jusitfy-content-center gap-3"> <div class="d-flex align-items-center jusitfy-content-center gap-3">
<div class="settings-icon"> <div class="settings-icon">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none"
<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"/> xmlns="http://www.w3.org/2000/svg">
<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
<path d="M5 10L6.66667 10.8333" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 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"
<path d="M14.1673 3.33594L5.83398 7.5026" stroke="var(--clr-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 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> </svg>
</div> </div>
<div> <div>
<h6>{{__('Email Settings')}}</h6> <h6>{{__('Languages Settings')}}</h6>
<small class="text-muted d-block">{{__('View and update email settings.')}}</small> <small class="text-muted d-block">{{__('Add, Edit, Update, Delete Languages.')}}</small>
</div> </div>
</div> </div>
</div> </div>
</a> </a> --}}
</div> </div>
@endif
</div> </div>
</div> </div>
@@ -253,10 +239,10 @@ class="text-decoration-none text-dark">
fill="none" xmlns="http://www.w3.org/2000/svg"> fill="none" xmlns="http://www.w3.org/2000/svg">
<path <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" 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 <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" 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> </svg>
</div> </div>
<div> <div>
@@ -279,10 +265,8 @@ class="invoice_form">
@csrf @csrf
<div class="row justify-content-center"> <div class="row justify-content-center">
{{-- A4 Option --}} {{-- 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"> <label class="invoice-option position-relative d-inline-block">
<div class="invoice-size-radio"> <div class="invoice-size-radio">
<div class="custom-radio"> <div class="custom-radio">
@@ -291,27 +275,11 @@ class="invoice_form">
</div> </div>
</div> </div>
<div class="mb-2">{{ __('Printer A4') }}</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 "> alt="A4 Invoice" class="img-fluid border rounded invoice-image ">
</label> </label>
</div> </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')) @if (moduleCheck('ThermalPrinterAddon'))
<div class="col-lg-3 mb-4 text-center"> <div class="col-lg-3 mb-4 text-center">
<label class="invoice-option position-relative d-inline-block"> <label class="invoice-option position-relative d-inline-block">
@@ -322,15 +290,15 @@ class="invoice_form">
</div> </div>
</div> </div>
<div class="mb-2">{{ __('Thermal: 3 inch 80mm') }}</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> </label>
</div> </div>
<div class="col-lg-4 mb-4"></div>
@endif @endif
</div> </div>
</form> </form>
</div> </div>
</div> </div>
<div class="tab-pane fade" id="role" role="tabpanel" aria-labelledby="invoice-tab"> <div class="tab-pane fade" id="role" role="tabpanel" aria-labelledby="invoice-tab">
<div> <div>
<div class="settings-box-container"> <div class="settings-box-container">
@@ -342,14 +310,14 @@ class="invoice_form">
fill="none" xmlns="http://www.w3.org/2000/svg"> fill="none" xmlns="http://www.w3.org/2000/svg">
<path <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" 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" /> stroke-linejoin="round" />
<path <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" 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 <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" 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> </svg>
</div> </div>
<div> <div>
@@ -362,7 +330,6 @@ class="invoice_form">
</div> </div>
</div> </div>
</div> </div>
<div class="tab-pane fade" id="Currencies" role="tabpanel" aria-labelledby="invoice-tab"> <div class="tab-pane fade" id="Currencies" role="tabpanel" aria-labelledby="invoice-tab">
<div> <div>
<div class="settings-box-container"> <div class="settings-box-container">
@@ -375,10 +342,10 @@ class="text-decoration-none text-dark">
xmlns="http://www.w3.org/2000/svg"> xmlns="http://www.w3.org/2000/svg">
<path <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" 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 <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" 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> </svg>
</div> </div>
<div> <div>
@@ -393,7 +360,7 @@ class="text-decoration-none text-dark">
</div> </div>
@if (moduleCheck('MarketingAddon')) @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>
<div class="settings-box-container"> <div class="settings-box-container">
<a href="{{ route('business.sms-gateway-settings.index') }}" class="text-decoration-none text-dark"> <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="d-flex align-items-center jusitfy-content-center gap-3">
<div class="settings-icon"> <div class="settings-icon">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> <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="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="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="#C52127" 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="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="var(--clr-primary)" 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> </svg>
</div> </div>
<div> <div>
@@ -418,111 +385,6 @@ class="text-decoration-none text-dark">
</div> </div>
</div> </div>
@endif @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> </div>
</div> </div>

View File

@@ -27,6 +27,16 @@
</svg> </svg>
</h3> </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"> <div class="d-flex align-items-center mb-3">
<input type="hidden" name="show_product_code" value="0"> <input type="hidden" name="show_product_code" value="0">
<input id="product_code" class="delete-checkbox-item multi-delete" type="checkbox" <input id="product_code" class="delete-checkbox-item multi-delete" type="checkbox"
@@ -35,13 +45,6 @@
<label for="product_code">{{__('Product Code')}}</label> <label for="product_code">{{__('Product Code')}}</label>
</div> </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"> <div class="d-flex align-items-center mb-3">
<input type="hidden" name="show_product_stock" value="0"> <input type="hidden" name="show_product_stock" value="0">
<input id="stock" class="delete-checkbox-item multi-delete" type="checkbox" <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 type="hidden" name="show_product_unit" value="0">
<input id="unit" class="delete-checkbox-item multi-delete" type="checkbox" <input id="unit" class="delete-checkbox-item multi-delete" type="checkbox"
name="show_product_unit" value="1" 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> <label for="unit">{{__('Product Unit')}}</label>
</div> </div>
@@ -102,7 +105,7 @@
<input type="hidden" name="show_alert_qty" value="0"> <input type="hidden" name="show_alert_qty" value="0">
<input id="quantity" class="delete-checkbox-item multi-delete" type="checkbox" <input id="quantity" class="delete-checkbox-item multi-delete" type="checkbox"
name="show_alert_qty" value="1" 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> <label for="quantity">{{__('Low Stock Alert')}}</label>
</div> </div>
@@ -454,8 +457,6 @@ class="form-control mfg-my"
{{ optional($product_setting?->modules)['allow_product_discount'] === '1' ? 'checked' : '' }}> {{ optional($product_setting?->modules)['allow_product_discount'] === '1' ? 'checked' : '' }}>
<label for="allow_product_discount">{{ __('Product Discount') }}</label> <label for="allow_product_discount">{{ __('Product Discount') }}</label>
</div> </div>
</div> </div>
<div class="col-lg-12"> <div class="col-lg-12">

View File

@@ -5,6 +5,13 @@
@endsection @endsection
@php @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'; $type = request('type') !== 'Supplier' ? 'Customer' : 'Supplier';
@endphp @endphp
@@ -20,18 +27,12 @@
<h4>{{ __('Add new :type', ['type' => __($type)]) }}</h4> <h4>{{ __('Add new :type', ['type' => __($type)]) }}</h4>
<div class="d-flex align-items-center gap-3"> @usercan('parties.read')
<a data-bs-toggle="modal" data-bs-target="#parties-import-modal" class="save-publish-btn" href="#"> <a href="{{ route('business.parties.index', ['type' => request('type')]) }}"
{{__('Bulk Upload')}} class="add-order-btn rounded-2 {{ Route::is('business.parties.create') ? 'active' : '' }}">
</a> <i class="far fa-list" aria-hidden="true"></i>{{ __(':type List', ['type' => __($type)]) }}
</a>
@usercan('parties.read') @endusercan
<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> </div>
<div class="order-form-section p-16"> <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="row col-lg-9">
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
<label>{{ __($type . ' Name') }}</label> <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>
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
<label>{{ __('Phone Number') }}</label> <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> </div>
@if (request('type') !== 'Supplier') @if (request('type') !== 'Supplier')
<div class="col-lg-6 mb-2"> <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> <label>{{ __('Address') }}</label>
<input type="text" name="address" class="form-control" placeholder="{{ __('Enter Address') }}"> <input type="text" name="address" class="form-control" placeholder="{{ __('Enter Address') }}">
</div> </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" id="customAccordion">
<div class="accordion-item border-0"> <div class="accordion-item border-0">
<h2 class="accordion-header"> <h2 class="accordion-header">
@@ -111,39 +106,31 @@ class="add-order-btn rounded-2 {{ Route::is('business.parties.create') ? 'active
data-bs-parent="#customAccordion"> data-bs-parent="#customAccordion">
<div class="accordion-body fst-italic text-secondary p-0"> <div class="accordion-body fst-italic text-secondary p-0">
<div class="row"> <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"> <div class="col-lg-6 mb-2">
<label>{{ __('Address line 1') }}</label> <label>{{ __('Address line 1') }}</label>
<input type="text" name="billing_address[address]" class="form-control" placeholder="{{ __('Enter address') }}"> <input type="text" name="billing_address[address]" class="form-control" placeholder="{{ __('Enter address') }}">
</div> </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> </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" /> <img src="{{ asset('assets/images/icons/img.png') }}" alt="icon" />
</div> </div>
<p>{{__('Drag & drop your Image')}}</p> <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>
</div> </div>
<input type="file" name="image" id="fileInput" accept="image/*"> <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> </div>
</div> </div>
<input type="hidden" value="{{ route('business.get-states.index') }}" id="get-state">
@endsection @endsection
@push('modal')
@include('business::parties.bulk-upload.parties-import')
@endpush

View File

@@ -65,21 +65,9 @@ class="table-product-img">
@endusercan @endusercan
</li> </li>
<li> <li>
<a href="{{ route('business.parties.advance-payments', [$party->id, 'type' => request('type')]) }}"> <a
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" class="pt-1 me-0" xmlns="http://www.w3.org/2000/svg"> href="{{ route('business.parties.edit', [$party->id, 'type' => request('type')]) }}"><i
<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"/> class="fal fa-edit"></i>{{ __('Edit') }}</a>
<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>
</li> </li>
<li> <li>
@usercan('parties.delete') @usercan('parties.delete')

View File

@@ -5,6 +5,13 @@
@endsection @endsection
@php @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'; $type = request('type') !== 'Supplier' ? 'Customer' : 'Supplier';
@endphp @endphp
@@ -42,7 +49,7 @@ class="ajaxform_instant_reload">
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
<label>{{ __('Phone') }}</label> <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') }}"> class="form-control" placeholder="{{ __('Enter phone number') }}">
</div> </div>
@@ -70,8 +77,7 @@ class="form-control" placeholder="{{ __('Enter phone number') }}">
@endif @endif
@php @php
$branch_id = auth()->user()->branch_id ?? auth()->user()->active_branch_id ?? null; $branch_logic = $party->branch_id != (auth()->user()->active_branch?->id);
$branch_logic = $party->branch_id != $branch_id;
@endphp @endphp
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
@@ -110,11 +116,6 @@ class="form-control" placeholder="{{ __('Enter Email') }}">
class="form-control" placeholder="{{ __('Enter Address') }}"> class="form-control" placeholder="{{ __('Enter Address') }}">
</div> </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" id="customAccordion">
<div class="accordion-item border-0"> <div class="accordion-item border-0">
<h2 class="accordion-header"> <h2 class="accordion-header">
@@ -130,22 +131,12 @@ class="accordion-button address-accordion collapsed fw-medium text-primary bg-t
data-bs-parent="#customAccordion"> data-bs-parent="#customAccordion">
<div class="accordion-body fst-italic text-secondary p-0"> <div class="accordion-body fst-italic text-secondary p-0">
<div class="row"> <div class="row">
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
<label>{{ __('Country') }}</label> <label>{{ __('Address') }}</label>
<select name="country_id" id="country_id" class="form-control"> <input type="text" name="billing_address[address]"
<option value="">{{ __('Select a country') }}</option> value="{{ $party->billing_address['address'] ?? '' }}"
@foreach ($countries as $country) class="form-control"
<option value="{{ $country->id }}" @selected(($party->country_id ?? '') == $country->id)>{{ __($country->name) }}</option> placeholder="{{ __('Enter address') }}">
@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>
</div> </div>
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
@@ -156,6 +147,14 @@ class="form-control"
placeholder="{{ __('Enter city') }}"> placeholder="{{ __('Enter city') }}">
</div> </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"> <div class="col-lg-6 mb-2">
<label>{{ __('Zip Code') }}</label> <label>{{ __('Zip Code') }}</label>
<input type="text" name="billing_address[zip_code]" <input type="text" name="billing_address[zip_code]"
@@ -164,18 +163,24 @@ class="form-control"
placeholder="{{ __('Enter zip code') }}"> placeholder="{{ __('Enter zip code') }}">
</div> </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 @php
$billing = is_array($party->billing_address) ? $party->billing_address : json_decode($party->billing_address, true) ?? []; $billing = is_array($party->billing_address) ? $party->billing_address : json_decode($party->billing_address, true) ?? [];
@endphp @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> </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"> <div class="col-lg-6 mb-2">
<label>{{ __('Address') }}</label> <label>{{ __('Address') }}</label>
<input type="text" name="shipping_address[address]" <input type="text" name="shipping_address[address]"
value="{{ $party->shipping_address['address'] ?? '' }}" value="{{ $party->billing_address['address'] ?? '' }}"
class="form-control" class="form-control"
placeholder="{{ __('Enter address') }}"> placeholder="{{ __('Enter address') }}">
</div> </div>
@@ -207,7 +212,7 @@ class="form-control"
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
<label>{{ __('City') }}</label> <label>{{ __('City') }}</label>
<input type="text" name="shipping_address[city]" <input type="text" name="shipping_address[city]"
value="{{ $party->shipping_address['city'] ?? '' }}" value="{{ $party->billing_address['city'] ?? '' }}"
class="form-control" class="form-control"
placeholder="{{ __('Enter city') }}"> placeholder="{{ __('Enter city') }}">
</div> </div>
@@ -215,7 +220,7 @@ class="form-control"
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
<label>{{ __('State') }}</label> <label>{{ __('State') }}</label>
<input type="text" name="shipping_address[state]" <input type="text" name="shipping_address[state]"
value="{{ $party->shipping_address['state'] ?? '' }}" value="{{ $party->billing_address['state'] ?? '' }}"
class="form-control" class="form-control"
placeholder="{{ __('Enter state') }}"> placeholder="{{ __('Enter state') }}">
</div> </div>
@@ -223,7 +228,7 @@ class="form-control"
<div class="col-lg-6 mb-2"> <div class="col-lg-6 mb-2">
<label>{{ __('Zip Code') }}</label> <label>{{ __('Zip Code') }}</label>
<input type="text" name="shipping_address[zip_code]" <input type="text" name="shipping_address[zip_code]"
value="{{ $party->shipping_address['zip_code'] ?? '' }}" value="{{ $party->billing_address['zip_code'] ?? '' }}"
class="form-control" class="form-control"
placeholder="{{ __('Enter zip code') }}"> placeholder="{{ __('Enter zip code') }}">
</div> </div>
@@ -260,7 +265,7 @@ class="form-control">
<img src="{{ asset( $party->image ?? 'assets/images/icons/img.png') }}" alt="icon" /> <img src="{{ asset( $party->image ?? 'assets/images/icons/img.png') }}" alt="icon" />
</div> </div>
<p>{{__('Drag & drop your Image')}}</p> <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>
</div> </div>
@@ -285,6 +290,5 @@ class="theme-btn border-btn m-2">{{ __('Cancel') }}</a>
</div> </div>
</div> </div>
</div> </div>
</div>
<input type="hidden" value="{{ route('business.get-states.index') }}" id="get-state">
@endsection @endsection

View File

@@ -55,16 +55,16 @@
<div class="table-top-btn-group d-print-none"> <div class="table-top-btn-group d-print-none">
<ul> <ul>
<li> <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=""> <img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
</a> </a>
</li> </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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>

View File

@@ -4,6 +4,7 @@
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center"> <div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
@include('business::print.header') @include('business::print.header')
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Customer Ledger List') }}</h4> <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> </div>
@endsection @endsection

View File

@@ -25,41 +25,13 @@
<td class="text-start d-print-none">{{ $index + 1 }}</td> <td class="text-start d-print-none">{{ $index + 1 }}</td>
<td class="text-start">{{ formatted_date($row['date']) }}</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"> <td class="text-start">
@if($invoice_route) <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">
<a target="_blank" href="{{ $invoice_route }}" class="stock-view-data text-primary"> {{ $row['invoice_no'] ?? '-' }}
{{ $invoice_no }} </a>
</a>
@else
{{ $invoice_no ?? '-' }}
@endif
</td> </td>
<td class="text-start"> <td class="text-start">{{ $row['platform'] }}</td>
@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">{{ currency_format($row['credit_amount'], currency: business_currency() ) }}</td> <td class="text-start">{{ currency_format($row['credit_amount'], currency: business_currency() ) }}</td>

View File

@@ -25,24 +25,12 @@
<td class="text-start">{{ formatted_date($row['date']) }}</td> <td class="text-start">{{ formatted_date($row['date']) }}</td>
<td class="text-start"> <td class="text-start">
@if($row['invoice_no'] && $row['platform'] === 'Sales') <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">
<a target="_blank" href="{{ route('business.sales.invoice', $row['id'] ?? '') }}" class="stock-view-data text-primary"> {{ $row['invoice_no'] ?? '-' }}
{{ $row['invoice_no'] }} </a>
</a>
@elseif($row['invoice_no'])
{{ $row['invoice_no'] }}
@else
-
@endif
</td> </td>
<td class="d-print-none text-start"> <td class="d-print-none text-start">{{ $row['platform'] }}</td>
@if(in_array($row['platform'], ['Opening Collection', 'Opening Payment']))
{{ $row['platform'] }}: {{ currency_format($row['amount'] ?? 0) }}
@else
{{ $row['platform'] }}
@endif
</td>
<td class="text-start">{{ currency_format($row['credit_amount']) }}</td> <td class="text-start">{{ currency_format($row['credit_amount']) }}</td>

View File

@@ -31,7 +31,7 @@
</div> </div>
<div class="gpt-up-down-arrow position-relative d-print-none custom-date-filter"> <div class="gpt-up-down-arrow position-relative d-print-none custom-date-filter">
<select name="duration" class="form-control custom-days"> <select name="duration" class="form-control custom-days">
<option value="">{{ __('All Time') }}</option> <option value="">{{ __('All') }}</option>
<option value="today"> {{ __('Today') }}</option> <option value="today"> {{ __('Today') }}</option>
<option value="yesterday"> {{ __('Yesterday') }}</option> <option value="yesterday"> {{ __('Yesterday') }}</option>
<option value="last_seven_days"> {{ __('Last 7 Days') }}</option> <option value="last_seven_days"> {{ __('Last 7 Days') }}</option>
@@ -64,17 +64,17 @@
<div class="table-top-btn-group d-print-none"> <div class="table-top-btn-group d-print-none">
<ul> <ul>
<li> <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=""> <img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>

View File

@@ -5,19 +5,6 @@
@include('business::print.header') @include('business::print.header')
<p style="text-align: center; margin: 0; padding: 0; margin-bottom:5px; font-size: 16px;"> <p style="text-align: center; margin: 0; padding: 0; margin-bottom:5px; font-size: 16px;">
{{ $party->name }} ({{ __('Ledger')}}) {{ $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> </p>
@endsection @endsection
@@ -60,11 +47,7 @@
</td> </td>
<td style="border:1px solid gainsboro; text-align:center;"> <td style="border:1px solid gainsboro; text-align:center;">
@if(in_array($row['platform'], ['Opening Collection', 'Opening Payment'])) {{ $row['platform'] }}
{{ $row['platform'] }}: {{ currency_format($row['amount'] ?? 0, currency: business_currency()) }}
@else
{{ $row['platform'] }}
@endif
</td> </td>
<td style="border:1px solid gainsboro; text-align:center;"> <td style="border:1px solid gainsboro; text-align:center;">

View File

@@ -48,12 +48,12 @@
<tr> <tr>
<td class="text-start fw-bold">{{__('Total')}}</td> <td class="text-start fw-bold">{{__('Total')}}</td>
<td></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"> <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>
<td class="text-start fw-bold text-danger"> <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></td> <td></td>
</tr> </tr>

View File

@@ -18,19 +18,19 @@
<div class="col-lg-2 col-md-6"> <div class="col-lg-2 col-md-6">
<div class="sales-card p-3 m-2 text-white"> <div class="sales-card p-3 m-2 text-white">
<p class="stat-title">{{ __('Sales Amount') }}</p> <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> </div>
<div class="col-lg-2 col-md-6"> <div class="col-lg-2 col-md-6">
<div class="profit-card p-3 m-2 text-white"> <div class="profit-card p-3 m-2 text-white">
<p class="stat-title">{{ __('Profit') }}</p> <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> </div>
<div class="col-lg-2 col-md-12 "> <div class="col-lg-2 col-md-12 ">
<div class="loss-card p-3 m-2 text-white"> <div class="loss-card p-3 m-2 text-white">
<p class="stat-title">{{ __('Loss') }}</p> <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> </div>
</div> </div>
@@ -70,17 +70,17 @@
<div class="table-top-btn-group d-print-none"> <div class="table-top-btn-group d-print-none">
<ul> <ul>
<li> <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=""> <img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>

View File

@@ -4,6 +4,7 @@
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center"> <div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
@include('business::print.header') @include('business::print.header')
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Party Loss Profit Report') }}</h4> <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> </div>
@endsection @endsection

View File

@@ -16,7 +16,7 @@
@foreach ($suppliers as $supplier) @foreach ($suppliers as $supplier)
<tr> <tr>
<td class="d-print-none">{{ $suppliers->firstItem() + $loop->index }}</td> <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"> <a href="{{ route('business.supplier-ledger.show', $supplier->id) }}" class="stock-view-data text-primary">
{{ $supplier->name }} {{ $supplier->name }}
</a> </a>

View File

@@ -46,17 +46,17 @@
<div class="table-top-btn-group d-print-none"> <div class="table-top-btn-group d-print-none">
<ul> <ul>
<li> <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=""> <img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>

View File

@@ -4,6 +4,7 @@
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center"> <div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
@include('business::print.header') @include('business::print.header')
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Supplier Ledger List') }}</h4> <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> </div>
@endsection @endsection

View File

@@ -25,41 +25,12 @@
<td class="text-start">{{ $index + 1 }}</td> <td class="text-start">{{ $index + 1 }}</td>
<td class="text-start">{{ formatted_date($row['date']) }}</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"> <td class="text-start">
@if($invoice_route) <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">
<a target="_blank" href="{{ $invoice_route }}" class="stock-view-data text-primary"> {{ $row['invoice_no'] ?? '-' }} - {{ $row['id'] }}
{{ $invoice_no }} </a>
</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
</td> </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['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['debit_amount'], currency: business_currency()) }}</td>
<td class="text-start">{{ currency_format($row['balance'], currency: business_currency()) }}</td> <td class="text-start">{{ currency_format($row['balance'], currency: business_currency()) }}</td>

View File

@@ -24,21 +24,9 @@
<td class="text-start">{{ $index + 1 }}</td> <td class="text-start">{{ $index + 1 }}</td>
<td class="text-start">{{ formatted_date($row['date']) }}</td> <td class="text-start">{{ formatted_date($row['date']) }}</td>
<td class="text-start"> <td class="text-start">
@if($row['invoice_no'] && $row['platform'] === 'Purchase') {{ $row['invoice_no'] ?? '-' }} - {{ $row['id'] }}
{{ $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
</td> </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['credit_amount']) }}</td>
<td class="text-start">{{ currency_format($row['debit_amount']) }}</td> <td class="text-start">{{ currency_format($row['debit_amount']) }}</td>
<td class="text-start">{{ currency_format($row['balance']) }}</td> <td class="text-start">{{ currency_format($row['balance']) }}</td>

View File

@@ -31,7 +31,7 @@
</div> </div>
<div class="gpt-up-down-arrow position-relative d-print-none custom-date-filter"> <div class="gpt-up-down-arrow position-relative d-print-none custom-date-filter">
<select name="duration" class="form-control custom-days"> <select name="duration" class="form-control custom-days">
<option value="">{{ __('All Time') }}</option> <option value="">{{ __('All') }}</option>
<option value="today"> {{ __('Today') }}</option> <option value="today"> {{ __('Today') }}</option>
<option value="yesterday"> {{ __('Yesterday') }}</option> <option value="yesterday"> {{ __('Yesterday') }}</option>
<option value="last_seven_days"> {{ __('Last 7 Days') }}</option> <option value="last_seven_days"> {{ __('Last 7 Days') }}</option>
@@ -64,17 +64,17 @@
<div class="table-top-btn-group d-print-none"> <div class="table-top-btn-group d-print-none">
<ul> <ul>
<li> <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=""> <img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>

View File

@@ -5,19 +5,6 @@
@include('business::print.header') @include('business::print.header')
<p style="text-align: center; margin: 0; padding: 0; margin-bottom:5px; font-size: 16px;"> <p style="text-align: center; margin: 0; padding: 0; margin-bottom:5px; font-size: 16px;">
{{ $party->name }} ({{ __('Ledger')}}) {{ $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> </p>
@endsection @endsection
@@ -54,18 +41,10 @@
{{ formatted_date($row['date']) }} {{ formatted_date($row['date']) }}
</td> </td>
<td style="border:1px solid gainsboro; text-align:center;"> <td style="border:1px solid gainsboro; text-align:center;">
@if($row['invoice_no']) {{ $row['invoice_no'] ?? '-' }} - {{ $row['id'] }}
{{ $row['invoice_no'] }} - {{ $row['id'] }}
@else
-
@endif
</td> </td>
<td style="border:1px solid gainsboro; text-align:center;"> <td style="border:1px solid gainsboro; text-align:center;">
@if(in_array($row['platform'], ['Opening Collection', 'Opening Payment'])) {{ $row['platform'] }}
{{ $row['platform'] }}: {{ currency_format($row['amount'] ?? 0, currency: business_currency()) }}
@else
{{ $row['platform'] }}
@endif
</td> </td>
<td style="border:1px solid gainsboro; text-align:center;"> <td style="border:1px solid gainsboro; text-align:center;">
{{ currency_format($row['credit_amount'], currency: business_currency()) }} {{ currency_format($row['credit_amount'], currency: business_currency()) }}

View File

@@ -19,7 +19,7 @@
</div> </div>
<div class="table-top-form p-16"> <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-top-left d-flex gap-3 ">
<div class="table-search position-relative d-print-none"> <div class="table-search position-relative d-print-none">
@@ -46,17 +46,17 @@
<div class="table-top-btn-group d-print-none"> <div class="table-top-btn-group d-print-none">
<ul> <ul>
<li> <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=""> <img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>

View File

@@ -4,6 +4,7 @@
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center"> <div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
@include('business::print.header') @include('business::print.header')
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Top 5 Customer Report List') }}</h4> <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> </div>
@endsection @endsection

View File

@@ -37,17 +37,17 @@
<div class="table-top-btn-group d-print-none"> <div class="table-top-btn-group d-print-none">
<ul> <ul>
<li> <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=""> <img src="{{ asset('assets/images/logo/csv.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/excel.svg') }}" alt="">
</a> </a>
</li> </li>
<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=""> <img src="{{ asset('assets/images/logo/pdf.svg') }}" alt="">
</a> </a>
</li> </li>

View File

@@ -4,6 +4,7 @@
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center"> <div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
@include('business::print.header') @include('business::print.header')
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">{{ __('Top 5 Supplier Report List') }}</h4> <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> </div>
@endsection @endsection

Some files were not shown because too many files have changed in this diff Show More