Eric Cho
2010-05-29 19:08:53 UTC
Hi. Folks-
Today I found weird date problem.
July 2010 and Aug 2010 has same 31 days.
So, citrusDB's billing date will be mixed horribly.
(also, I thought from_date should be set as to_date when we roll up to next month)
Basically, I found that prev_billing_date column in billing table didn't be use from anywhere.
So, I'm use this column as original date that is same with from_date when user edited billing info.
Here are some codes-
[include/billing.inc.php]
line 767 -
$myOrigdate = $billingresult['b_prev_date'];
// double frequency to add to the to_date
$doublefreq = $mybillingfreq * 2;
// insert the new next_billing_date, from_date,
// to_date, and payment_due_date to next from_date
$query = "UPDATE billing ".
"SET next_billing_date = to_date, from_date = to_date, ".
"payment_due_date = to_date, ".
"to_date = DATE_ADD('$myOrigdate', ".
"INTERVAL PERIOD_DIFF(DATE_FORMAT(to_date, '%Y%m'), ". date('Ym', strtotime($billingresult['b_prev_date'])). ")+1 MONTH) ".
"WHERE id = '$mybilling_id'";
$updateresult = $DB->Execute($query) or die ("Query Failed");
(add above selection query - line 740) b.prev_billing_date b_prev_date,
[module/billing/edit.php]
line 187, line 239 - (not be exact)
"prev_billing_date = '$next_billing_date',". // 2010-05-29 for month adding, original column
finished.
take a look these codes, and please let me know if you find any wrong part.
Today I found weird date problem.
July 2010 and Aug 2010 has same 31 days.
So, citrusDB's billing date will be mixed horribly.
(also, I thought from_date should be set as to_date when we roll up to next month)
Basically, I found that prev_billing_date column in billing table didn't be use from anywhere.
So, I'm use this column as original date that is same with from_date when user edited billing info.
Here are some codes-
[include/billing.inc.php]
line 767 -
$myOrigdate = $billingresult['b_prev_date'];
// double frequency to add to the to_date
$doublefreq = $mybillingfreq * 2;
// insert the new next_billing_date, from_date,
// to_date, and payment_due_date to next from_date
$query = "UPDATE billing ".
"SET next_billing_date = to_date, from_date = to_date, ".
"payment_due_date = to_date, ".
"to_date = DATE_ADD('$myOrigdate', ".
"INTERVAL PERIOD_DIFF(DATE_FORMAT(to_date, '%Y%m'), ". date('Ym', strtotime($billingresult['b_prev_date'])). ")+1 MONTH) ".
"WHERE id = '$mybilling_id'";
$updateresult = $DB->Execute($query) or die ("Query Failed");
(add above selection query - line 740) b.prev_billing_date b_prev_date,
[module/billing/edit.php]
line 187, line 239 - (not be exact)
"prev_billing_date = '$next_billing_date',". // 2010-05-29 for month adding, original column
finished.
take a look these codes, and please let me know if you find any wrong part.