You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.4KB

  1. <?php
  2. namespace App\Email\Members;
  3. use App\Kintone\Models\SeasonTicketContractEntry;
  4. use App\Kintone\Models\SeasonTicketContractPlan;
  5. abstract class EntryMessageBuilder
  6. {
  7. public static function getPaymentExplainStr(SeasonTicketContractEntry $entry): string
  8. {
  9. if (!$entry->paymentLimitDate) {
  10. return "";
  11. }
  12. if (!$entry->firstAmount) {
  13. return "";
  14. }
  15. $hiwariStr = !!$entry->hiwariAmount ? sprintf(
  16. "%d月分日割分%s円と",
  17. $entry->hiwariMonth,
  18. number_format($entry->hiwariAmount)
  19. ) : "";
  20. return sprintf(
  21. "※料金は利用日までの前払いのため、%s%d月分%s円 (合計%s円)を%sまでにお振込下さい。(手数料は振込者負担でお願い致します。)",
  22. $hiwariStr,
  23. $entry->targetMonth,
  24. number_format($entry->targetAmount),
  25. number_format($entry->firstAmount),
  26. $entry->paymentLimitDate->format("Y年m月d日")
  27. );
  28. }
  29. public static function getTaxExplain(SeasonTicketContractPlan $plan): string
  30. {
  31. // if (!$plan->taxRate || !$plan->taxAmount) {
  32. // return "";
  33. // }
  34. return sprintf(
  35. "(消費税等含む,適用税率%d%%  消費税額 %s円)",
  36. $plan->taxRate ?? 0,
  37. number_format($plan->taxAmount ?? 0),
  38. );
  39. }
  40. }