barryvdh/laravel-dompdf not downloading for large amount of records. its just loading

Posted 4 months ago by AbdulBazith

Guys i have a small correction in my old project "milkfarm"

i used barryvdh/laravel-dompdf to take report of my purchase, sales tables.

whats the proble is i have a nav bar daybook when i click that it asks user to enter the date. andafter thedate is entered the whole transaction of that date will be downloaded as pdf report

here whats the problem is if there is large record then the page is loading loading, but not downloading..

i checked for another date also. if i give today date it is downloaded, because today there are less records.

ig i give yesterday date it also downloaded, but on 3rd of february i have lots of records so its not downloading

whats the problem.

this is my daybook controller

 $purchase_details = Purchase_details::whereDate('date',$request->search_date)->get();

    $sales = Sales_details::whereDate('date', $request->search_date)->get();

    $selss = Self_stock::whereDate('date',$request->search_date)->get();

    $exs = Excess_milk::whereDate('date', $request->search_date)->get();

    $pays = Pay::whereDate('date', $request->search_date)->get();

    $overallstock = Overallstock::whereDate('date',$request->search_date)->get();

    $receives = Receive::whereDate('date', $request->search_date)->get();

    $paid_details = Paid_details::whereDate('updated_at', today())->get();

    $received_details = Received_details::whereDate('updated_at', today())->get();

    $p_accounts = Personal_account::whereDate('date', $request->search_date)->get();

 $pdf=PDF::loadView('DayBook.daybookpdf', [
        'purs' => $purchase_details,
        'total_amount1'=>$purchase_details->sum('total'),
        'total_litre'=>$purchase_details->sum('no_of_litre'),

        'sales' => $sales,
        'total1' => $sales->sum('total'),
        'no_of_litre1' => $sales->sum('no_of_litre'),

        'sels' => $selss,
        'no_of_litre_tot'=>$selss->sum('no_of_litre'),

        'exs' => $exs,
        'no_of_litre_tot' => $exs->sum('no_of_litre'),

        'pays' => $pays,
        'total_amount2'=>$pays->sum('amount'),

        'overalls' => $overallstock,
        'total_purchase'=>$overallstock->sum('purchased_milk'),
        'total_self'=>$overallstock->sum('self_milk'),
        'total_milk'=>$overallstock->sum('total_milk'),
        'total_sold'=>$overallstock->sum('sold_milk'),
        'total_excess'=>$overallstock->sum('excess_milk'),
        'total_balance_milk'=>$overallstock->sum('balance_milk'),

        'receives' => $receives,
        'total_amount3'=>$receives->sum('amount'),

        'paids' => $paid_details,
        'total_total_amount_amount'=>$paid_details->sum('total_amount'),
        'total_paid_amount'=>$paid_details->sum('paid'),
        'total_balance_amount'=>$paid_details->sum('balance_amount'),
        'total_personal'=>$paid_details->sum('personal_amount'),

        'received_details' => $received_details,
        'total_total_amount'=>$received_details->sum('total_amount'),
        'total_paid'=>$received_details->sum('paid'),
        'total_balance'=>$received_details->sum('balance_amount'),

        'p_accounts' => $p_accounts,
        'total_amount4'=>$p_accounts->sum('amount'),
        'date'=>$request->search_date

    ]);
  
    $pdf->setPaper('A4','landscape');
    return $pdf->download('Day Book.pdf');


what i did in the above coding isjust retrieved records from all tables and send it to the pdf file.

Kindly some one help please to rectify my problem.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.