Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

64 lines
2.0KB

  1. <?php
  2. namespace App\Email\Members;
  3. use App\Kintone\Models\PaymentPlan;
  4. use App\Kintone\Models\SeasonTicketContractEntry;
  5. use App\Kintone\Models\SeasonTicketContractPlan;
  6. abstract class EntryMessageBuilder
  7. {
  8. public static function getPaymentExplainStr(PaymentPlan $firstMonth, ?PaymentPlan $partitial, ?PaymentPlan $deposit): string
  9. {
  10. $hiwariStr = !!$partitial ? sprintf(
  11. "%d月分日割分%s円と",
  12. $partitial->targetMonth,
  13. number_format($partitial->paymentPlanAmount)
  14. ) : "";
  15. $totalAmount = $firstMonth->paymentPlanAmount;
  16. if ($partitial) {
  17. $totalAmount += $partitial->paymentPlanAmount;
  18. }
  19. return sprintf(
  20. "※料金は利用日までの前払いのため、%s%d月分%s円 (合計%s円)を%sまでにお振込下さい。(手数料は振込者負担でお願い致します。)",
  21. $hiwariStr,
  22. $firstMonth->targetMonth,
  23. number_format($firstMonth->paymentPlanAmount),
  24. number_format($totalAmount),
  25. $firstMonth->paymentPlanDate->format("Y年m月d日")
  26. );
  27. }
  28. public static function getTaxExplain(SeasonTicketContractPlan $plan): string
  29. {
  30. return sprintf(
  31. "(消費税等含む,適用税率%d%%  消費税額 %s円)",
  32. $plan->taxRate ?? 0,
  33. number_format($plan->taxAmount ?? 0),
  34. );
  35. }
  36. public static function getDepositExplain(?PaymentPlan $deposit): string
  37. {
  38. if (!$deposit) return "";
  39. $lines = collect();
  40. foreach ($deposit->depositList as $row) {
  41. $lines->push(sprintf("%s:%s円", $row->name, number_format($row->amount)));
  42. }
  43. if ($lines->isNotEmpty()) {
  44. $lines->prepend("---保証金------");
  45. $lines->push(sprintf("保証金合計:%s円", number_format($deposit->paymentPlanAmount)));
  46. $lines->push("---------------");
  47. }
  48. return $lines->join("\n");
  49. }
  50. }