Log 2375
20/12/2023 2023-12-20 14:14$paymentDate = ”;
$contractSigningDate = ”;
$daysToPayment = ”;
// Set values for placeholders
// #מועד התשלום:# placeholder value: “במעמד החוזה”
$paymentPlaceholderValue = ‘במעמד החוזה’;
// #תאריך חתימת החוזה# placeholder value: “10/12/2022”
$contractSigningDateValue = ’10/12/2022′;
// #תאריך לתשלום:# placeholder value: “בחר תאריך”
$choosePaymentDateValue = ‘בחר תאריך’;
// #מספר ימים לתשלום:# placeholder value: 5
$daysToPaymentValue = 5;
if ($paymentPlaceholderValue === $choosePaymentDateValue) {
// If payment date is set to #תאריך לתשלום:#, use contract signing date
$paymentDate = $contractSigningDate;
} elseif ($paymentPlaceholderValue === ‘ימים מהחוזה’) {
// If payment date is set to “ימים מהחוזה”, calculate the date by adding days to contract signing date
$contractSigningTimestamp = strtotime($contractSigningDate);
$additionalDaysTimestamps = $daysToPayment * 24 * 60 * 60; // Convert days to seconds
$paymentTimestamp = $contractSigningTimestamp + (int)$additionalDaysTimestamps;
$paymentDate = date(‘d/m/Y’, $paymentTimestamp);
} else {
// Otherwise, use the contract signing date as payment date
$paymentDate = $contractSigningDate;
}
return $paymentDate;