@@ -493,41 +493,34 @@ public function restock()
493
493
};
494
494
}
495
495
496
- public function posPdf ()
496
+ private function toPdfArray (): array
497
497
{
498
- return Pdf:: loadView ( ' coderstm::pdfs.order-pos ' , [
498
+ return [
499
499
'id ' => $ this ->formated_id ,
500
+ 'currency ' => $ this ->currency ,
500
501
'phone_number ' => optional ($ this ->contact )->phone_number ,
501
502
'customer_name ' => optional ($ this ->customer )->name ?? 'NA ' ,
503
+ 'billing_address ' => optional ($ this ->billing_address )->label ,
502
504
'line_items ' => $ this ->line_items ,
503
505
'location ' => optional ($ this ->location )->address_label ,
504
- 'sub_total ' => format_amount ($ this ->sub_total * 100 ),
505
- 'tax_total ' => format_amount ($ this ->tax_total * 100 ),
506
- 'discount_total ' => format_amount ($ this ->discount_total * 100 ),
507
- 'grand_total ' => format_amount ($ this ->grand_total * 100 ),
508
- 'paid_total ' => format_amount ($ this ->paid_total * 100 ),
509
- 'due_amount ' => format_amount ($ this ->due_amount * 100 ),
506
+ 'sub_total ' => format_amount ($ this ->sub_total ),
507
+ 'tax_total ' => format_amount ($ this ->tax_total ),
508
+ 'discount_total ' => format_amount ($ this ->discount_total ),
509
+ 'grand_total ' => format_amount ($ this ->grand_total ),
510
+ 'paid_total ' => format_amount ($ this ->paid_total ),
511
+ 'due_amount ' => format_amount ($ this ->due_amount ),
510
512
'created_at ' => $ this ->created_at ->format ('d-m-Y h:i a ' ),
511
- ])->setPaper ([0 , 0 , 260.00 , 600.80 ]);
513
+ ];
514
+ }
515
+
516
+ public function posPdf ()
517
+ {
518
+ return Pdf::loadView ('coderstm::pdfs.order-pos ' , $ this ->toPdfArray ())->setPaper ([0 , 0 , 260.00 , 600.80 ]);
512
519
}
513
520
514
521
public function receiptPdf ()
515
522
{
516
- return Pdf::loadView ('coderstm::pdfs.order-receipt ' , [
517
- 'id ' => $ this ->formated_id ,
518
- 'phone_number ' => optional ($ this ->contact )->phone_number ,
519
- 'customer_name ' => optional ($ this ->customer )->name ?? 'NA ' ,
520
- 'billing_address ' => optional ($ this ->billing_address )->label ,
521
- 'line_items ' => $ this ->line_items ,
522
- 'location ' => optional ($ this ->location )->address_label ,
523
- 'sub_total ' => format_amount ($ this ->sub_total * 100 ),
524
- 'tax_total ' => format_amount ($ this ->tax_total * 100 ),
525
- 'discount_total ' => format_amount ($ this ->discount_total * 100 ),
526
- 'grand_total ' => format_amount ($ this ->grand_total * 100 ),
527
- 'paid_total ' => format_amount ($ this ->paid_total * 100 ),
528
- 'due_amount ' => format_amount ($ this ->due_amount * 100 ),
529
- 'created_at ' => $ this ->created_at ->format ('d-m-Y h:i a ' ),
530
- ]);
523
+ return Pdf::loadView ('coderstm::pdfs.order-receipt ' , $ this ->toPdfArray ());
531
524
}
532
525
533
526
public function total ()
0 commit comments