package SPA_2015_VOPForm;
my $path = "../../";
my $title = "Verification of Participation Form";
!>
#include ../../header.iphtml
#include ../../checkuser.iphtml
=$title!>
;
my $wkshp_no = '';
$wkshp_no = $main::cgi->param('wid');
if ($main::cgi->param('id')) {
&display_vop($wkshp_no);
} elsif ($main::cgi->param('button')) {
&submit_credits($wkshp_no);
} else {
&list_vop();
}
sub list_vop {
my ($total_cme) = 0;
my ($max_cme) = 0;
my $voplist = '';
my $vopSQL = '';
return;
$sth = $main::dbh->prepare ("SELECT non_pharm,pharm FROM new_lecture,meeting_evaluated WHERE meeting_evaluated.sessionID=new_lecture.lectureid AND meeting_evaluated.memberID=$userID AND meeting_evaluated.meetingID=$meeting_no");
$sth->execute() ||
die "Couldn't execut query: $DBI::errstr\n";
undef(@ary);
$total_cme = 0;
while (@ary = $sth->fetchrow_array())
{
if ($ary[1])
{
$total_cme += $ary[1];
} else {
$total_cme += $ary[0];
}
}
$sth->finish;
if (!$total_cme) {
print p("$participant : You have not accumulated any CME credit hours for this course. Click ",a({href=>'topics.iphtml'},'here')," to complete the evaluation form. After completing the evaluation form, return here to certify and submit your CME hours.");
} else {
# my $fullcourse = 0;
# $cursor = $main::dbh->prepare (qq{
# SELECT IF(workshop_no>0,'0','1') FROM registrants WHERE meeting_no=? AND member_id=? ORDER BY workshop_no DESC LIMIT 1
# });
# $cursor->execute($meeting_no, $userID);
# $fullcourse = $cursor->fetchrow();
# $cursor->finish();
if ($fullcourse)
{
$vopSQL = "SELECT t1.meeting_no, t1.workshop_no, t1.breakout_no, t2.name FROM registrants t1, meeting t2 WHERE t1.meeting_no = t2.meeting_no AND t1.workshop_no = t2.workshop_no AND t1.breakout_no = t2.breakout_no AND t1.cme='N' AND t1.workshop_no=0 AND t1.member_id = $userID AND t1.meeting_no = $meeting_no ORDER BY t2.workshop_no";
}
else
{
$vopSQL = "SELECT registrants.meeting_no, registrants.workshop_no, registrants.breakout_no, meeting.name FROM registrants, meeting WHERE registrants.meeting_no = meeting.meeting_no AND registrants.workshop_no = meeting.workshop_no AND registrants.breakout_no = meeting.Breakout_no AND registrants.attended='Y' AND registrants.cme='N' AND member_id = $userID AND registrants.meeting_no = $meeting_no ORDER BY meeting.workshop_no";
}
# $vopSQL = "SELECT registrants.meeting_no, registrants.workshop_no, registrants.breakout_no, meeting.name FROM registrants, meeting WHERE registrants.meeting_no = meeting.meeting_no AND registrants.workshop_no = meeting.workshop_no AND registrants.breakout_no = meeting.Breakout_no AND registrants.attended='Y' AND member_id = '$userID' AND registrants.meeting_no = '$meeting_no' ORDER BY meeting.workshop_no"; # SHOW VOP IF SUBMITTED OR NOT
$sth = $main::dbh->prepare ($vopSQL) ||
die "Prepare failed: $DBI::errstr\n";
$sth->execute() ||
die "Couldn't execute query: $DBI::errstr\n$vopSQL\n";
undef(@ary);
@ary = $sth->fetchrow;
$sth->finish;
if (@ary) {
print h3({-align=>'center'},'Do Not Submit Your Verification Form until after you have completed your evaluation of ALL topics you have attended.');
print p("$participant : Click on the link(s) below to complete your Verification of Participation Form.");
$sth->execute;
while (@ary = $sth->fetchrow()) {
$voplist .= "$ary[3]\n";
}
$sth->finish;
print "";
} else {
print p('Your Verification of Participation Forms for this meeting have been received. If you have prematurely submitted your form before you completed all the evaluation forms, you must contact the SPA office.');
print p(em('Society for Pediatric Anesthesia'),'
2209 Dickens Road
Richmond, VA 23230-2005');
print p('804-282-9780 Phone
804-282-0090 Fax
',a({href=>'mailto:spa@societyhq.com'},'spa@societyhq.com'),' Email');
print p("
");
}
}
}
sub display_vop {
my $workshopID = shift;
my $complete = 1;
my $vopSQL = '';
my ($total_cme) = 0;
my ($total_moco) = 0;
my ($total_hrs) = 0;
my ($max_cme) = 0;
return;
my $cursor = $main::dbh->prepare(qq{
SELECT aba_id FROM member WHERE member_id = ?
});
$cursor->execute($userID);
undef(@fields);
@fields = $cursor->fetchrow;
$cursor->finish;
my ($aba_num) = $fields[0];
if ($fullcourse)
{
$vopSQL = "SELECT non_pharm,pharm FROM new_lecture,meeting_evaluated WHERE meeting_evaluated.sessionID=new_lecture.lectureid AND meeting_evaluated.memberID=$userID AND meeting_evaluated.meetingID=$meeting_no";
}
else
{
$vopSQL = "SELECT non_pharm,pharm FROM new_lecture,meeting_evaluated WHERE meeting_evaluated.sessionID=new_lecture.lectureid AND meeting_evaluated.memberID=$userID AND meeting_evaluated.meetingID=$meeting_no AND meeting_evaluated.workshopID=$workshopID";
}
$sth = $main::dbh->prepare(qq{$vopSQL});
$sth->execute() ||
die "Couldn't execut query: $DBI::errstr\n";
undef(@ary);
while (@ary = $sth->fetchrow_array())
{
$total_moco += $ary[1];
$total_cme += $ary[0];
}
$sth->finish;
$total_hrs = $total_cme + $total_moco;
if (!$total_hrs) {
print p("You have not accumulated any CME credit hours for this course. Click ",a({href=>'topics.iphtml'},'here')," to complete the evaluation form. After completing the evaluation form, return here to certify and submit your CME hours.");
$complete = 0;
}
if ($complete) {
$vopSQL = "SELECT name,location,city,state,country,MONTHNAME(meeting.start_date), DAYOFMONTH(meeting.start_date), YEAR(meeting.end_date), MONTHNAME(meeting.end_date), DAYOFMONTH(meeting.end_date), credits FROM meeting WHERE meeting_no=$meeting_no AND workshop_no='$workshopID' AND breakout_no=0";
$sth = $main::dbh->prepare ($vopSQL) ||
die "Prepare failed: $DBI::errstr\n";
$sth->execute() ||
die "Couldn't execute query: $DBI::errstr\n$vopSQL\n";
undef(@fields);
@fields = $sth->fetchrow;
$sth->finish;
$mtg_name = $fields[0];
$mtg_hotel = $fields[1];
$mtg_location = $fields[2] . ", " . $fields[3] . " " . $fields[4];
$mtg_date = $fields[5] . ' ' . $fields[6];
if ($fields[6] eq $fields[9]) {
$mtg_date .= ", $fields[7]";
} else {
if ($fields[6] ne $fields[9] && $fields[5] eq $fields[8]) {
$mtg_date .= " - $fields[9], $fields[7]";
} else {
$mtg_date .= " - $fields[8] $fields[9], $fields[7]";
}
}
$max_cme = $fields[10];
if ($fullcourse)
{
$vopSQL = "SELECT DATE_FORMAT(lecture_date,'%W - %M %e, %Y'), lecture,non_pharm,pharm,sessionID FROM new_lecture,meeting_evaluated WHERE meeting_evaluated.sessionID=new_lecture.lectureid AND meeting_evaluated.memberID=$userID AND meeting_evaluated.meetingID=$meeting_no ORDER BY lecture_date,lecture";
}
else
{
$vopSQL = "SELECT DATE_FORMAT(lecture_date,'%W - %M %e, %Y'), lecture,non_pharm,pharm,sessionID FROM new_lecture,meeting_evaluated WHERE meeting_evaluated.sessionID=new_lecture.lectureid AND meeting_evaluated.memberID=$userID AND meeting_evaluated.meetingID=$meeting_no AND meeting_evaluated.workshopID=$workshopID ORDER BY lecture_date,lecture";
}
$sth = $main::dbh->prepare(qq{$vopSQL});
$sth->execute() ||
die "Couldn't execut query: $DBI::errstr\n";
undef(@ary);
print p({-style=>'color:#F00'},'Nota Bene: Please verify the number of credits you are claiming before you submit this form as you will be unable to change the number of credits once submitted.');
print p('The ',em('Society for Pediatric Anesthesia (SPA)'), 'maintains records of learner participation for six years. To enable SPA to maintain accurate records of your participation and ',strong('TO RECEIVE YOUR CME CERTIFICATE'), 'you must complete the evaluation form for each topic that you attended then submit this form.');
print "\n";
$sth->finish;
}
}
sub submit_credits {
my $workshopID = shift;
my ($total_cme) = 0;
my ($total_moco) = 0;
my ($total_hrs) = 0;
my ($max_cme) = 0;
my (%cookie_in) = $main::cgi->cookie("SPAID");
my ($cookie_uid) = $cookie_in{"id"};
my ($userID) = $cookie_uid;
$sth = $main::dbh->prepare ("SELECT non_pharm,pharm FROM new_lecture,meeting_evaluated WHERE meeting_evaluated.sessionID=new_lecture.lectureid AND meeting_evaluated.memberID=$userID AND meeting_evaluated.meetingID=$meeting_no");
$sth->execute() ||
die "Couldn't execut query: $DBI::errstr\n";
undef(@ary);
while (@ary = $sth->fetchrow_array())
{
$total_moco += $ary[1];
$total_cme += $ary[0];
}
$sth->finish;
$total_hrs = $total_cme + $total_moco;
my $missing = '';
if (!$main::cgi->param('signature')) { $missing .= "You must check the box that you certify that you are claiming the number of hours you actually spent in the educational activity.\n" };
if (!$total_hrs) { $missing .= "Unable to set the number of credits hours - Please notify the SPA office of this error!\n" };
if ($missing) {
print p({-style=>'color:#F00'},'The following error(s) accured while submitting your credits:');
print "$missing
\n";
print p('Click ',a({-href=>'vop.iphtml'},'here'), ' to go back.');
} else {
my $aba_number = $main::cgi->param('ABA');
my $updateSQL = "";
if (!$aba_number)
{
$updateSQL = "UPDATE member SET aba_id=NULL WHERE member_id=$userID LIMIT 1";
} else {
$updateSQL = "UPDATE member SET aba_id='$aba_number',updated_by='Registrant - ABA #' WHERE member_id=$userID LIMIT 1";
}
$main::dbh->do(qq{
$updateSQL
});
my $vopSQL = "SELECT credits FROM meeting WHERE meeting_no=$meeting_no AND workshop_no='$workshopID' AND breakout_no=0";
$sth = $main::dbh->prepare ($vopSQL) ||
die "Prepare failed: $DBI::errstr\n";
$sth->execute() ||
die "Couldn't execute query: $DBI::errstr\n$vopSQL\n";
undef(@fields);
@fields = $sth->fetchrow;
$sth->finish;
$max_cme = $fields[0];
$total_hrs = $max_cme if $total_hrs > $max_cme;
my $updateSQL = "UPDATE registrants SET credits='$total_cme', other_credits='$total_moco',cme='Y',attended='Y' WHERE meeting_no='$meeting_no' AND workshop_no='$workshopID' AND breakout_no=0 AND member_id='$userID' LIMIT 1";
my $rows = $main::dbh->do(qq{$updateSQL});
$rows += 0;
if (!$rows) {
print p({-style=>'color:#F00'},"We're sorry, unable to submit your Verification of Participation Form at this time. Please try again latter.");
} else {
print h4("Form Submitted Successfully");
print p('Your Verification of Participation Form has been received. You can now print your',a({-href=>'cme.iphtml'},'CME Certificate'));
}
}
}
!>
#include ../../footer_include.iphtml