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.

71 line
2.2KB

  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. public static function getDepositExplain(SeasonTicketContractPlan $plan): string
  41. {
  42. $lines = collect();
  43. if ($plan->deposit) {
  44. $lines->push(sprintf("保証金:%s円", number_format($plan->deposit)));
  45. }
  46. if ($plan->chainGateDeposit) {
  47. $lines->push(sprintf("チェーンゲート保証金:%s円", number_format($plan->chainGateDeposit)));
  48. }
  49. if ($plan->cardDeposit) {
  50. $lines->push(sprintf("パスカード保証金:%s円", number_format($plan->cardDeposit)));
  51. }
  52. if ($lines->isNotEmpty()) {
  53. $lines->prepend("---保証金------");
  54. $lines->push(sprintf("保証金合計:%s円", number_format($plan->totalDeposit)));
  55. $lines->push("---------------");
  56. }
  57. return $lines->join("\n");
  58. }
  59. }