ckroon
Posts: 869
|
Posted: 08/20/2007, 6:34 PM |
|
I have a cool function compares two date fields and decides which one to put in the component:
$Component->SetValue( $Container->date_fallisma2->GetValue());
if ($Container->school_enr_date2->GetValue() < $Container->date_fallisma2->GetValue())
$Component->SetValue( $Container->date_fallisma2->GetValue());
if ($Container->school_enr_date2->GetValue() > $Container->date_fallisma2->GetValue())
$Component->SetValue( $Container->school_enr_date2->GetValue());
What I need is for it to add 7 days to the value school_enr_date ( The school just adopted a policy that after a student enrolls, they are not "officialy" enrolled until 7 days has passed.
The part of code where school_enr_date is prepped in a Dlookup here:
global $DBConnection1;
$Page = CCGetParentPage($sender);
$ccs_result = CCDLookUp('school_enr_date', 'classlist', "student_id=". CCGetFromGet("stud_id",0), $Page->Connections["Connection1"]);
$ccs_result = CCParseDate($ccs_result, array("yyyy", "-", "mm", "-", "dd"));
$Container->school_enr_date2->SetValue($ccs_result);
Where and how do I add the +7 days? I have tried a few things but my syntax is all wrong. I assume it has to happen before the CCParseDate..?
_________________
Walter Kempees...you are dearly missed. |
|
|
wkempees
|
Posted: 08/21/2007, 4:09 AM |
|
It's all a matter of 1,2,3
1: http://forums.codecharge.com/posts.php?post_id=89870&s_keyword=CCDateAdd
2: http://forums.codecharge.com/posts.php?post_id=89900&s_keyword=CCDateAdd
3:
$Component->SetValue( $Container->date_fallisma2->GetValue());
if ($Container->school_enr_date2->GetValue() <
$Container->date_fallisma2->GetValue())
$Component->SetValue( $Container->date_fallisma2->GetValue());
if ($Container->school_enr_date2->GetValue() >
$Container->date_fallisma2->GetValue())
$Component->SetValue( $Container->school_enr_date2->GetValue());
$Component->SetValue(CCDateAdd( $Component->GetValue(), '+7 days') );
You might want to check if it is not continuously adding 7 days everytime
you go through the form.
Walter
"ckroon" <ckroon@forum.codecharge> schreef in bericht
news:546ca410a8d42a@news.codecharge.com...
>I have a cool function compares two date fields and decides which one to
>put in
> the component:
>
> $Component->SetValue( $Container->date_fallisma2->GetValue());
>
> if ($Container->school_enr_date2->GetValue() <
> $Container->date_fallisma2->GetValue())
> $Component->SetValue( $Container->date_fallisma2->GetValue());
>
> if ($Container->school_enr_date2->GetValue() >
> $Container->date_fallisma2->GetValue())
> $Component->SetValue( $Container->school_enr_date2->GetValue());
>
> What I need is for it to add 7 days to the value school_enr_date ( The
> school
> just adopted a policy that after a student enrolls, they are not
> "officialy"
> enrolled until 7 days has passed.
>
> The part of code where school_enr_date is prepped in a Dlookup here:
>
>
> global $DBConnection1;
> $Page = CCGetParentPage($sender);
> $ccs_result = CCDLookUp('school_enr_date', 'classlist', "student_id=".
> CCGetFromGet("stud_id",0), $Page->Connections["Connection1"]);
> $ccs_result = CCParseDate($ccs_result, array("yyyy", "-", "mm", "-",
> "dd"));
> $Container->school_enr_date2->SetValue($ccs_result);
>
>
> Where and how do I add the +7 days? I have tried a few things but my
> syntax is
> all wrong. I assume it has to happen before the CCParseDate..?
>
>
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
|
|
|
|