mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
update invoice, estimate & payment vars
This commit is contained in:
@ -60,9 +60,10 @@ class EstimatesController extends Controller
|
||||
$estimate_num_auto_generate = CompanySetting::getSetting('estimate_auto_generate', $request->header('company'));
|
||||
|
||||
$nextEstimateNumberAttribute = null;
|
||||
$nextEstimateNumber = Estimate::getNextEstimateNumber($estimate_prefix);
|
||||
|
||||
if ($estimate_num_auto_generate == "YES") {
|
||||
$nextEstimateNumberAttribute = Estimate::getNextEstimateNumber($estimate_prefix);
|
||||
$nextEstimateNumberAttribute = $nextEstimateNumber;
|
||||
}
|
||||
|
||||
$tax_per_item = CompanySetting::getSetting('tax_per_item', $request->header('company'));
|
||||
@ -71,7 +72,8 @@ class EstimatesController extends Controller
|
||||
|
||||
return response()->json([
|
||||
'customers' => $customers,
|
||||
'nextEstimateNumber' => $nextEstimateNumberAttribute,
|
||||
'nextEstimateNumberAttribute' => $nextEstimateNumberAttribute,
|
||||
'nextEstimateNumber' => $estimate_prefix.'-'.$nextEstimateNumber,
|
||||
'taxes' => Tax::whereCompany($request->header('company'))->latest()->get(),
|
||||
'items' => Item::whereCompany($request->header('company'))->get(),
|
||||
'tax_per_item' => $tax_per_item,
|
||||
|
||||
@ -70,13 +70,15 @@ class InvoicesController extends Controller
|
||||
$invoice_num_auto_generate = CompanySetting::getSetting('invoice_auto_generate', $request->header('company'));
|
||||
|
||||
$nextInvoiceNumberAttribute = null;
|
||||
$nextInvoiceNumber = Invoice::getNextInvoiceNumber($invoice_prefix);
|
||||
|
||||
if ($invoice_num_auto_generate == "YES") {
|
||||
$nextInvoiceNumberAttribute = Invoice::getNextInvoiceNumber($invoice_prefix);
|
||||
$nextInvoiceNumberAttribute = $nextInvoiceNumber;
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'nextInvoiceNumber' => $nextInvoiceNumberAttribute,
|
||||
'nextInvoiceNumberAttribute' => $nextInvoiceNumberAttribute,
|
||||
'nextInvoiceNumber' => $invoice_prefix.'-'.$nextInvoiceNumber,
|
||||
'items' => Item::with('taxes')->whereCompany($request->header('company'))->get(),
|
||||
'invoiceTemplates' => InvoiceTemplate::all(),
|
||||
'tax_per_item' => $tax_per_item,
|
||||
|
||||
@ -56,16 +56,18 @@ class PaymentController extends Controller
|
||||
|
||||
|
||||
$nextPaymentNumberAttribute = null;
|
||||
$nextPaymentNumber = Payment::getNextPaymentNumber($payment_prefix);
|
||||
|
||||
if ($payment_num_auto_generate == "YES") {
|
||||
$nextPaymentNumberAttribute = Payment::getNextPaymentNumber($payment_prefix);
|
||||
$nextPaymentNumberAttribute = $nextPaymentNumber;
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'customers' => User::where('role', 'customer')
|
||||
->whereCompany($request->header('company'))
|
||||
->get(),
|
||||
'nextPaymentNumber' => $nextPaymentNumberAttribute,
|
||||
'nextPaymentNumberAttribute' => $nextPaymentNumberAttribute,
|
||||
'nextPaymentNumber' => $payment_prefix.'-'.$nextPaymentNumber,
|
||||
'payment_prefix' => $payment_prefix
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user