|
- <?php
-
- namespace App\Email\Members;
-
- use App\Kintone\Models\PaymentPlan;
- use App\Kintone\Models\SeasonTicketContractEntry;
- use App\Kintone\Models\SeasonTicketContractPlan;
-
- abstract class EntryMessageBuilder
- {
- public static function getPaymentExplainStr(PaymentPlan $firstMonth, ?PaymentPlan $partitial, ?PaymentPlan $deposit): string
- {
-
- $hiwariStr = !!$partitial ? sprintf(
- "%d月分日割分%s円と",
- $partitial->targetMonth,
- number_format($partitial->paymentPlanAmount)
- ) : "";
-
- $totalAmount = $firstMonth->paymentPlanAmount;
- if ($partitial) {
- $totalAmount += $partitial->paymentPlanAmount;
- }
-
- return sprintf(
- "※料金は利用日までの前払いのため、%s%d月分%s円 (合計%s円)を%sまでにお振込下さい。(手数料は振込者負担でお願い致します。)",
- $hiwariStr,
- $firstMonth->targetMonth,
- number_format($firstMonth->paymentPlanAmount),
- number_format($totalAmount),
- $firstMonth->paymentPlanDate->format("Y年m月d日")
- );
- }
-
- public static function getTaxExplain(SeasonTicketContractPlan $plan): string
- {
- return sprintf(
- "(消費税等含む,適用税率%d%% 消費税額 %s円)",
- $plan->taxRate ?? 0,
- number_format($plan->taxAmount ?? 0),
- );
- }
-
- public static function getDepositExplain(?PaymentPlan $deposit): string
- {
- if (!$deposit) return "";
-
- $lines = collect();
-
- foreach ($deposit->depositList as $row) {
- $lines->push(sprintf("%s:%s円", $row->name, number_format($row->amount)));
- }
-
-
- if ($lines->isNotEmpty()) {
- $lines->prepend("---保証金------");
- $lines->push(sprintf("保証金合計:%s円", number_format($deposit->paymentPlanAmount)));
- $lines->push("---------------");
- }
-
- return $lines->join("\n");
- }
- }
|