-2
我要求用戶輸入開始日期和結束日期以生成付款時間表,並在兩個日期內循環以生成每週,每日和每月的時間表基於用戶選擇。跳過使用php循環的幾天,幾個月和幾周之間的週末
$f_repayment_date = "2015-01-01";
$mat_date = "2015-10-01";
while (strtotime($f_repayment_date) < strtotime($mat_date)) {
$f_repayment_date = date ("Y-m-d", strtotime("+1 month", strtotime($f_repayment_date)));
$count++;
//calculate interest on outstanding balance
if ($balance < $payment) {
$payment = $balance;
$interest_amount = $interest_amount ;
$principal = $payment - $interest_amount;
$due = $payment + $interest_amount;
}
$balance = $balance - $payment;
if ($balance < 0) {
$principal = $principal + $balance;
$interest_amount = $interest_amount;
$balance = 0;
}
$sql = mysql_query("insert into loan_schedule values (NULL,'$f_repayment_date','$account_number','$contract_code','$loan_product',
'$loan_amount','$frequency','$loan_term','$interest','$payment','$principal','$interest_amount','$balance','$due','$count','','$due','$active_loan')");
}
} while ($balance > 0);
你在哪裏卡住,你有什麼嘗試?您收到了哪些錯誤以及要達到什麼目標,請使用此信息更新您的文章。也許也加一個例子。 – TeeDeJee
@ TeeDeJee想要在日期之間跳過週末。謝謝 – ASM
你試過谷歌?這個問題已經有很多答案。 – Burki