fuzzy1
11-14-2006, 03:36 PM
Hey All,
I need a little help. Total noob so please be patient.
The idea is to establish thirteen 28 day contact_periods or contact_cycles for a CRM application, on a 4 day offset, for two groups of contacts.
Period_1 begins on the first Tuesday of each January for Group_A and on the first Saturday of each January for Group_B -- from now to eternity.
Period_2 begins 28 days after Period_1 ... something like... $timedate = new TimeDate();
$today = $timedate->handle_offset(date("Y-m-d"), $timedate >dbDayFormat, false);
$StartCycleYear = (1stTuesday_ea_January); //if Group_A || if Group_B ????
$StartPeriod_2 = $StartCycleYear("Y-m-d", strtotime('+28 days'));
$StartPeriod_3 = $StartPeriod_2 ("Y-m-d", strtotime('+28 days'));
//etc...
if ($today < $StartPeriod_2) {
$Period='$StartCycleYear';
} else if ($today > $StartPeriod_2 && $today < $StartPeriod_3 ){
$Period= '$StartPeriod_2';
}
//update visit_by date
$update_visit_by =" UPDATE accounts,contacts,emailman SET accounts.visit_by = '$Period' WHERE accounts.name = contacts.agency_name AND emailman.related_id = contacts.id AND emailman.marketing_id = '8c63da95-3b5f-3348-3465-45245671f1e1' ";
$result = @mysql_query ($update_visit_by); // Run the query.
I offer a rough sketch only. I know the syntax is off, and I can see that such an approach is going to grow into an
unwieldy mass of some 100 odd lines, but if it makes any sense at all, how might I establish/calculate $StartCyleYear
and then add to that date in 28 day increments with conditions for Group_A || Group_B?
Otherwise, I'm MORE THAN OPEN to ANY suggestions as to how I might rethink my approach.
I need a little help. Total noob so please be patient.
The idea is to establish thirteen 28 day contact_periods or contact_cycles for a CRM application, on a 4 day offset, for two groups of contacts.
Period_1 begins on the first Tuesday of each January for Group_A and on the first Saturday of each January for Group_B -- from now to eternity.
Period_2 begins 28 days after Period_1 ... something like... $timedate = new TimeDate();
$today = $timedate->handle_offset(date("Y-m-d"), $timedate >dbDayFormat, false);
$StartCycleYear = (1stTuesday_ea_January); //if Group_A || if Group_B ????
$StartPeriod_2 = $StartCycleYear("Y-m-d", strtotime('+28 days'));
$StartPeriod_3 = $StartPeriod_2 ("Y-m-d", strtotime('+28 days'));
//etc...
if ($today < $StartPeriod_2) {
$Period='$StartCycleYear';
} else if ($today > $StartPeriod_2 && $today < $StartPeriod_3 ){
$Period= '$StartPeriod_2';
}
//update visit_by date
$update_visit_by =" UPDATE accounts,contacts,emailman SET accounts.visit_by = '$Period' WHERE accounts.name = contacts.agency_name AND emailman.related_id = contacts.id AND emailman.marketing_id = '8c63da95-3b5f-3348-3465-45245671f1e1' ";
$result = @mysql_query ($update_visit_by); // Run the query.
I offer a rough sketch only. I know the syntax is off, and I can see that such an approach is going to grow into an
unwieldy mass of some 100 odd lines, but if it makes any sense at all, how might I establish/calculate $StartCyleYear
and then add to that date in 28 day increments with conditions for Group_A || Group_B?
Otherwise, I'm MORE THAN OPEN to ANY suggestions as to how I might rethink my approach.