mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
Merge branch 'build210' into 'master'
fix estimate & invoice tax issue See merge request mohit.panjvani/crater-web!142
This commit is contained in:
@ -49,9 +49,11 @@ class Estimate extends Model
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'total' => 'float',
|
||||
'tax' => 'float',
|
||||
'sub_total' => 'float'
|
||||
'total' => 'integer',
|
||||
'tax' => 'integer',
|
||||
'sub_total' => 'integer',
|
||||
'discount' => 'float',
|
||||
'discount_val' => 'integer',
|
||||
];
|
||||
|
||||
public static function getNextEstimateNumber($value)
|
||||
|
||||
@ -145,7 +145,7 @@ class EstimatesController extends Controller
|
||||
|
||||
if (array_key_exists('taxes', $estimateItem) && $estimateItem['taxes']) {
|
||||
foreach ($estimateItem['taxes'] as $tax) {
|
||||
if ($tax['amount']) {
|
||||
if (gettype($tax['amount']) !== "NULL") {
|
||||
$tax['company_id'] = $request->header('company');
|
||||
$item->taxes()->create($tax);
|
||||
}
|
||||
@ -155,7 +155,7 @@ class EstimatesController extends Controller
|
||||
|
||||
if ($request->has('taxes')) {
|
||||
foreach ($request->taxes as $tax) {
|
||||
if ($tax['amount']) {
|
||||
if (gettype($tax['amount']) !== "NULL") {
|
||||
$tax['company_id'] = $request->header('company');
|
||||
$estimate->taxes()->create($tax);
|
||||
}
|
||||
@ -291,7 +291,7 @@ class EstimatesController extends Controller
|
||||
|
||||
if (array_key_exists('taxes', $estimateItem) && $estimateItem['taxes']) {
|
||||
foreach ($estimateItem['taxes'] as $tax) {
|
||||
if ($tax['amount']) {
|
||||
if (gettype($tax['amount']) !== "NULL") {
|
||||
$tax['company_id'] = $request->header('company');
|
||||
$item->taxes()->create($tax);
|
||||
}
|
||||
@ -301,7 +301,7 @@ class EstimatesController extends Controller
|
||||
|
||||
if ($request->has('taxes')) {
|
||||
foreach ($request->taxes as $tax) {
|
||||
if ($tax['amount']) {
|
||||
if (gettype($tax['amount']) !== "NULL") {
|
||||
$tax['company_id'] = $request->header('company');
|
||||
$estimate->taxes()->create($tax);
|
||||
}
|
||||
|
||||
@ -145,8 +145,7 @@ class InvoicesController extends Controller
|
||||
if (array_key_exists('taxes', $invoiceItem) && $invoiceItem['taxes']) {
|
||||
foreach ($invoiceItem['taxes'] as $tax) {
|
||||
$tax['company_id'] = $request->header('company');
|
||||
|
||||
if ($tax['amount']) {
|
||||
if (gettype($tax['amount']) !== "NULL") {
|
||||
$item->taxes()->create($tax);
|
||||
}
|
||||
}
|
||||
@ -157,7 +156,7 @@ class InvoicesController extends Controller
|
||||
foreach ($request->taxes as $tax) {
|
||||
$tax['company_id'] = $request->header('company');
|
||||
|
||||
if ($tax['amount']) {
|
||||
if (gettype($tax['amount']) !== "NULL") {
|
||||
$invoice->taxes()->create($tax);
|
||||
}
|
||||
}
|
||||
@ -317,7 +316,6 @@ class InvoicesController extends Controller
|
||||
foreach ($oldTaxes as $oldTax) {
|
||||
Tax::destroy($oldTax['id']);
|
||||
}
|
||||
|
||||
foreach ($invoiceItems as $invoiceItem) {
|
||||
$invoiceItem['company_id'] = $request->header('company');
|
||||
$item = $invoice->items()->create($invoiceItem);
|
||||
@ -325,8 +323,7 @@ class InvoicesController extends Controller
|
||||
if (array_key_exists('taxes', $invoiceItem) && $invoiceItem['taxes']) {
|
||||
foreach ($invoiceItem['taxes'] as $tax) {
|
||||
$tax['company_id'] = $request->header('company');
|
||||
|
||||
if ($tax['amount']) {
|
||||
if (gettype($tax['amount']) !== "NULL") {
|
||||
$item->taxes()->create($tax);
|
||||
}
|
||||
}
|
||||
@ -337,7 +334,7 @@ class InvoicesController extends Controller
|
||||
foreach ($request->taxes as $tax) {
|
||||
$tax['company_id'] = $request->header('company');
|
||||
|
||||
if ($tax['amount']) {
|
||||
if (gettype($tax['amount']) !== "NULL") {
|
||||
$invoice->taxes()->create($tax);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user