close #434 Fixed: Cannot Import Data

This commit is contained in:
cuneytsenturk 2018-08-07 16:39:54 +03:00
parent 9d8029893f
commit 36df336578
3 changed files with 11 additions and 12 deletions

View File

@ -234,8 +234,8 @@ class Items extends Controller
*/
public function export()
{
\Excel::create('items', function($excel) {
$excel->sheet('items', function($sheet) {
\Excel::create('items', function ($excel) {
$excel->sheet('items', function ($sheet) {
$sheet->fromModel(Item::filter(request()->input())->get()->makeHidden([
'id', 'company_id', 'item_id', 'created_at', 'updated_at', 'deleted_at'
]));
@ -315,7 +315,7 @@ class Items extends Controller
if ($input_items) {
foreach ($input_items as $key => $item) {
$price = (double) $item['price'];
$price = money($item['price'], $currency_code)->getAmount();
$quantity = (double) $item['quantity'];
$item_tax_total= 0;

View File

@ -142,7 +142,6 @@ class Bills extends Controller
$bill_item = [];
$bill_item['company_id'] = $request['company_id'];
$bill_item['bill_id'] = $bill->id;
$bill_item['currency_code'] = $request['currency_code'];
if ($request['item']) {
foreach ($request['item'] as $item) {
@ -357,7 +356,6 @@ class Bills extends Controller
$bill_item = [];
$bill_item['company_id'] = $request['company_id'];
$bill_item['bill_id'] = $bill->id;
$bill_item['currency_code'] = $request['currency_code'];
if ($request['item']) {
BillItem::where('bill_id', $bill->id)->delete();
@ -757,7 +755,6 @@ class Bills extends Controller
'code' => 'sub_total',
'name' => 'bills.sub_total',
'amount' => $sub_total,
'currency_code' => $bill->currency_code,
'sort_order' => $sort_order,
]);
@ -771,7 +768,6 @@ class Bills extends Controller
'code' => 'discount',
'name' => 'bills.discount',
'amount' => $discount_total,
'currency_code' => $bill->currency_code,
'sort_order' => $sort_order,
]);
@ -790,7 +786,6 @@ class Bills extends Controller
'code' => 'tax',
'name' => $tax['name'],
'amount' => $tax['amount'],
'currency_code' => $bill->currency_code,
'sort_order' => $sort_order,
]);
@ -805,7 +800,6 @@ class Bills extends Controller
'code' => 'total',
'name' => 'bills.total',
'amount' => $sub_total + $tax_total,
'currency_code' => $bill->currency_code,
'sort_order' => $sort_order,
]);
}

View File

@ -229,7 +229,9 @@ class Invoices extends Controller
$s_total = $s_total - $s_discount;
}
$request['amount'] = $s_total + $tax_total;
$amount = $s_total + $tax_total;
$request['amount'] = money($amount, $request['currency_code'])->getAmount();
$invoice->update($request->input());
@ -441,7 +443,9 @@ class Invoices extends Controller
$s_total = $s_total - $s_discount;
}
$request['amount'] = $s_total + $tax_total;
$amount = $s_total + $tax_total;
$request['amount'] = money($amount, $request['currency_code'])->getAmount();
$invoice->update($request->input());
@ -524,6 +528,7 @@ class Invoices extends Controller
$hidden_fields = ['id', 'company_id', 'created_at', 'updated_at', 'deleted_at', 'title'];
$i = 1;
foreach ($invoices as $invoice) {
$model = $invoice->$table->makeHidden($hidden_fields);
@ -750,7 +755,7 @@ class Invoices extends Controller
for ($i = 0; $i < $currency->precision; $i++) {
$multiplier *= 10;
}
$amount *= $multiplier;
$total_amount *= $multiplier;