<?php
              $beg1Why9919a='';
         // beg1Why9919a
$map_idQ='';
$display_block11='';

 if (isset($_POST['jedID2z'])) {
	$jedID2z=$_POST['jedID2z'];
$groupS4=$text_account2;//stays to current group
if ($jedID2z==100){
$groupS4=$_POST['groupyz'];
 $sql2 = "UPDATE $table_name36 SET   customer_group_id='$groupS4',status='1'  WHERE customer_id='$text_account3'" ; //add support_id the opportunity to be part of the $nameCustG[$groupS4]
$result2 = @mysql_query($sql2,$connection) or die(mysql_error());
$viewmail .="<div class=\"success\"> <font size=\"4\">Congratulations!   You have accepted this $newministryopportunity. Please click the red <i>My Dashboard Tab</i> below or close this browser window to begin your new program.</font></div> ";

$app_idQ=1000;
$gsurvey_idR2=1000;
$Qstat5=1000;
$Rtoday=date("Y-m-d h:i:s");

       $sql2azzDe = "INSERT INTO $table_name301 ( app_id, survey_id, create_date, test_stat, customer_id ,van1, van2)  VALUES ('$app_idQ','$gsurvey_idR2', '$Rtoday', '$Qstat5','$text_account3','$groupS4','$text_account2')";
$result2azzDe = @mysql_query($sql2azzDe,$connection) or die(mysql_error());
       $sql2azzDe = "INSERT INTO $table_name302 ( app_id, survey_id, create_date, test_stat, customer_id ,van1, van2) VALUES ('$app_idQ','$gsurvey_idR2', '$Rtoday', '$Qstat5','$text_account3','$groupS4','$text_account2')";
$result2azzDe = @mysql_query($sql2azzDe,$connection) or die(mysql_error());
///$mess="<div class=success>A Decision Record for Application has been created.</div>";


}

if ($jedID2z==101){
$groupS4=$_POST['groupyz'];
 $sql2 = "UPDATE $table_name36 SET   customer_group_id='$groupS4',status='0'  WHERE customer_id='$text_account3'" ; //add support_id
$result2 = @mysql_query($sql2,$connection) or die(mysql_error());
$viewmail .="<div class=\"warning2\"> You have declined the opportunity to be part of $newministryopportunity.   We thank you for your participation in the $nameCustG[$groupS4] application process and pray God’s continued blessings over you, your family and your ministry.  Should you decide to re-apply for the $nameCustG[$groupS4] program when it is offered again, you will be required to start the process as a new applicant.  Please click the red <i>My Dashboard Tab</i> below or close this browser window.</div>"; 
$app_idQ=1001;
$gsurvey_idR2=1000;
$Qstat5=1001;
$Rtoday=date("Y-m-d h:i:s");

       $sql2azzDe = "INSERT INTO $table_name301 ( app_id, survey_id, create_date, test_stat, customer_id ,van1, van2)  VALUES ('$app_idQ','$gsurvey_idR2', '$Rtoday', '$Qstat5','$text_account3','$groupS4','$text_account2')";
$result2azzDe = @mysql_query($sql2azzDe,$connection) or die(mysql_error());
       $sql2azzDe = "INSERT INTO $table_name302 ( app_id, survey_id, create_date, test_stat, customer_id ,van1, van2) VALUES ('$app_idQ','$gsurvey_idR2', '$Rtoday', '$Qstat5','$text_account3','$groupS4','$text_account2')";
$result2azzDe = @mysql_query($sql2azzDe,$connection) or die(mysql_error());
///$mess="<div class=success>A Decision Record for Application $map_idQ has been created.</div>";
}



}







    ////
$buyApp='';
$startApp='';
               $startApp[1]=" <FORM  name=\"formcheck\" METHOD=\"POST\" ACTION=\"$runCAP\">

                 <input type=\"hidden\" name=\"gbad\" value=\"1\"  />
                 <input type=\"hidden\" name=\"survey_id\" value=\"21\"  />
                 <input type=\"hidden\" name=\"yummap\" value=\"100\" size=\"40\" />
               <input type=\"hidden\" name=\"gbadMod\" value=\"\"  />
                <input type=\"hidden\" name=\"jedID2\" value=\"3\"  />
                <button class=\"fsSubmitButton\" type=\"input\">Start Application</button>
         </form>";

 
     $XX1=1;
    $bucketstitle='';
     $bucketsZ='';
$otherApp='';



$RegEve2=0;

 $sql12daaE ="SELECT * FROM $table_name1005B WHERE survey_id = '$port_id' AND van36 >'0'";
          $result331daaE = @mysql_query($sql12daaE,$connection) or die(mysql_error());
$RegEve2 = mysql_num_rows( $result331daaE);


    $sql12daa ="SELECT * FROM $table_name1005B WHERE survey_id = '$port_id' Order by surveyQ_id DESC limit 1";
          $result331daa = @mysql_query($sql12daa,$connection) or die(mysql_error());
  while ($row1daa1 = mysql_fetch_array($result331daa)) {
     $buckets=  $row1daa1['surveyQ_id'];
$bucketsKt=  $row1daa1['surveyQ_idK'];
   //     echo "buckets = $buckets  K= $bucketsKt <br/>";
              }

     ///  for ($x22=1; $x22<=$buckets; $x22++) {
for ($x22=1; $x22<=$buckets; $x22++) {
$bucketsZ[$x22]=0;
       $XX1=$XX1+1;                    //AND Z_num >'-1' AND title !='NONE' Order by surveyQ_idK, surveyQ_id 
          $sql12ad12 ="SELECT * FROM $table_name1005B WHERE survey_id = '$port_id' AND sub_id='0' AND status='1' AND surveyQ_idK='$x22' Order by surveyQ_idK, surveyQ_id ";
           $result331daa = @mysql_query($sql12ad12,$connection) or die(mysql_error());
            while ($row1daa12 = mysql_fetch_array($result331daa)) {
     $bucketstitle[$x22]=  $row1daa12['title'];
     $judge=   $row1daa12['surveyQ_id'];

//echo "judge = $judge $bucketstitle[$x22] $x22<br/>";

                                                                                                              
      //  $x22              // Order by surveyQ_idK, surveyQ_id
           $sql12ad12aG ="SELECT * FROM $table_name1005B WHERE survey_id = '$port_id' AND sub_id='1' AND surveyQ_id='$judge' order by Z_num DESC limit 1 ";
            $result331daaG = @mysql_query($sql12ad12aG,$connection) or die(mysql_error());
             while ($row1daa1G = mysql_fetch_array($result331daaG)) {
     $bucketsZ[$x22]=  $row1daa1G['Z_num'];

       //   echo "bucketsZ = $bucketsZ[$x22] -$bucketstitle[$x22] <br/>";

             }
if ($bucketsZ[$x22]<1){
$bucketsZ[$x22]=0;
}
         for ($x2=1; $x2<=$bucketsZ[$x22]; $x2++) {                                                                          // Z_num     Order by
                  $XX1=$XX1+1;
     $sql12ad12aG1 ="SELECT * FROM $table_name1005B WHERE survey_id = '$port_id' AND sub_id='1' AND surveyQ_id='$judge' AND  surveyQ_idK='$x2' AND status='1'   ";
            $result331daaG1 = @mysql_query($sql12ad12aG1,$connection) or die(mysql_error());
             while ($row1daa1G1 = mysql_fetch_array($result331daaG1)) {
     $infoZ[$x2]=  $row1daa1G1['information_id'];
       $titleZ[$x2]=  $row1daa1G1['title'];

        //  echo "InfoZ = $x2 - $x22 -$infoZ[$x2] <br/>";


         $testy= $infoZ[$x2];
 $sql33 ="SELECT * FROM $table_name92 WHERE information_id = '$testy' ";
  $result33 = @mysql_query($sql33,$connection) or die(mysql_error());
        $row22 =mysql_fetch_array($result33,MYSQL_ASSOC);
          $display_block9=  $row22['description'];
            $display_block9=stripslashes($display_block9);
              // $display_block9=htmlspecialchars_decode($display_block9);
            $display_block9=  html_entity_decode($display_block9, ENT_QUOTES, 'UTF-8');
            $display_block19[$x2]=$display_block9;
 // $display_block19[$x2]=      htmlentities( $display_block9, ENT_QUOTES | ENT_SUBSTITUTE, "UTF-8" );


 $find[] = 'â'; // left side double smart quote
$find[] = 'â'; // left side single smart quote
$find[] = 'â'; // right side single smart quote
$find[] = 'â¦'; // elipsis
$find[] = 'â'; // em dash
$find[] = 'â'; // en dash
$find[] = 'â'; // right side double smart quote                       // â
$replace[] = '"';
$replace[] = "'";
$replace[] = "'";
$replace[] = "...";
$replace[] = "-";
$replace[] = "-";
  $replace[] = '"';
$display_block19[$x2]= str_replace($find, $replace, $display_block19[$x2]);     // $infozz[$x2]
   $buyprint='';
    $appprint='';
$otherprint='';//payprint
    $Intprint='';
    $Roadprint='';
$buyprint2a='';
$buyprint[$x2]=  $row1daa1G1['buy'];
$zPersonalT[$x2]='';
          $buyprint2='';
      if ($buyprint[$x2]>0){
   $buyprint2a=$buyprint[$x2];


 $zPersonalT[$x2]=  $row1daa1G1['zPersonalT'];
if ($zPersonalT[$x2] !=$blink){
$buttontile="$zPersonalT[$x2]";
}else{
$buttontile="Pay Fees";
}



  $buyApp[$buyprint2a] =   "<FORM  name=\"formcheck\"  METHOD=\"POST\" ACTION=\"$loc2/index.php?route=product/category&cc=$cc99&path=$buyprint2a\">

                 <input type=\"hidden\" name=\"gbad\" value=\"1\"  />
                 <input type=\"hidden\" name=\"survey_id\" value=\"21\"  />
                 <input type=\"hidden\" name=\"yummap\" value=\"100\" size=\"40\" />
               <input type=\"hidden\" name=\"gbadMod\" value=\"\"  />
                <button class=\"fsSubmitButton\" type=\"input\">$buttontile</button>
         </form>";





  $buyApp[1] =   "<FORM  name=\"formcheck\"  METHOD=\"POST\" ACTION=\"$buyApp2\">

                 <input type=\"hidden\" name=\"gbad\" value=\"1\"  />
                 <input type=\"hidden\" name=\"survey_id\" value=\"21\"  />
                 <input type=\"hidden\" name=\"yummap\" value=\"100\" size=\"40\" />
               <input type=\"hidden\" name=\"gbadMod\" value=\"\"  />
                <input type=\"hidden\" name=\"jedID2\" value=\"3\"  />
                <button class=\"fsSubmitButton\" type=\"input\">Pay Application Fee</button>
         </form>";

 $buyprint2=$buyApp[$buyprint2a];

      }
  $appprint2=''; 
$zPersonalT[$x2]='';
 $appprint[$x2]=  $row1daa1G1['app'];
 

      if ($appprint[$x2]>0){

$appprint2a=$appprint[$x2];
 $zPersonalT[$x2]=  $row1daa1G1['zPersonalT'];
if ($zPersonalT[$x2] !=$blink){
$buttontile="$zPersonalT[$x2]";
}else{
$buttontile="Pay Fees";
}


$startApp[$appprint2a] =   "<FORM  name=\"formcheck\"  METHOD=\"POST\" ACTION=\"$loc2/index.php?route=product/product&cc=$cc99&product_id=$appprint2a\">

                 <input type=\"hidden\" name=\"gbad\" value=\"1\"  />
                 <input type=\"hidden\" name=\"survey_id\" value=\"21\"  />
                 <input type=\"hidden\" name=\"yummap\" value=\"100\" size=\"40\" />
               <input type=\"hidden\" name=\"gbadMod\" value=\"\"  />
                <button class=\"fsSubmitButton\" type=\"input\">$buttontile</button>
         </form>";



   $appprint2=$startApp[$appprint2a];
      }


 $otherprint[$x2]=  $row1daa1G1['pay'];
$otherprintZZ=  $row1daa1G1['pay'];

   $otherprint2='';
      if ($otherprint[$x2]>0){
$othergroup='';
$othergroupZ=  $row1daa1G1['groupy'];
$otherApp='';

$otherApp[1] =   "<FORM  name=\"formcheck\" target=\"blank\" METHOD=\"POST\" ACTION=\"$badboy\">

                 <input type=\"hidden\" name=\"groupyz\" value=\"$othergroupZ\"  />
                   <input type=\"hidden\" name=\"status\" value=\"1\" size=\"40\" />
                <input type=\"hidden\" name=\"jedID2z\" value=\"100\"  />
            
                <button class=\"fsSubmitButton\" type=\"input\">I Accept</button>
         </form>";

$otherApp[2] =   "<FORM  name=\"formcheck\" target=\"blank\" METHOD=\"POST\" ACTION=\"$badboy\">
<input type=\"hidden\" name=\"groupyz\" value=\"$othergroupRegZ\"  />
                 <input type=\"hidden\" name=\"status\" value=\"0\" size=\"40\" />
                <input type=\"hidden\" name=\"jedID2z\" value=\"101\"  />
                <button class=\"fsSubmitButton\" type=\"input\">I Decline</button>
         </form></td></tr></table>";

$otherApp[3]="<FORM  name=\"formcheck\" METHOD=\"POST\" ACTION=\"$runCAP\">

                 <input type=\"hidden\" name=\"gbad\" value=\"1\"  />
                 <input type=\"hidden\" name=\"survey_id\" value=\"21\"  />
                 <input type=\"hidden\" name=\"yummap\" value=\"100\" size=\"40\" />
               <input type=\"hidden\" name=\"gbadMod\" value=\"\"  />
                <input type=\"hidden\" name=\"jedID2\" value=\"3\"  />
                <button class=\"fsSubmitButton\" type=\"input\">Start Application</button>
         </form>";




if ($otherprintZZ==6){

///echo "hello <br/>";
$jedID2U=3;
$port_idz=$row1daa1G1['zPersonalT'];
$showchart=$row1daa1G1['zDoctor'];
$display_blockRA92='';
include('file/NewUploadsP.php');
//$display_blockRA92='yes';
$otherApp[6]="$display_blockRA92";
$showchart='';
}

if ($otherprintZZ==7){

///echo "hello <br/>";
$jedID2U=7;
$port_idz=$row1daa1G1['zPersonalT'];
$showchart=$row1daa1G1['zDoctor'];
include('file/NewPayment.php');
//$display_blockRA92='yes';
$otherApp[7]="$display_blockRA92";
$showchart='';
}


if ($otherprintZZ==8){

///echo "hello <br/>";
$jedID2U=8;
//$port_idz=$row1daa1G1['zPersonalT'];
$bobmail='';
$whomail=$row1daa1G1['zDoctor'];
$memail=$row1daa1G1['zPersonalT'];

include('file/mailtrial.php');
//$display_blockRA92='yes';
$otherApp[8]="$bobmail";
$whomail='';
$memail='';

}



if ($otherprintZZ==9){

///echo "hello <br/>";
$jedID2U=3;
$port_idz=$row1daa1G1['zPersonalT'];
$showchart=$row1daa1G1['zDoctor'];
$display_blockRA92='';
include('file/NewAgentsP.php');
//$display_blockRA92='yes';
$otherApp[9]="$topcat22";
$showchart='';
}





   $otherprint2=$otherApp[$otherprintZZ];
      }


$zPersonalT[$x2]='';
 $Intprint[$x2]=  $row1daa1G1['Intprint'];
        $Intprint2='';
      if ($Intprint[$x2]>0){
     // require($vqmod->modCheck('admin/GoTool/dashboard2/file/section7RoadmapList2.php'));
     // require($vqmod->modCheck('admin/GoTool/dashboard2/file/ZInterview.php'));

 $zPersonalT[$x2]=  $row1daa1G1['zPersonalT'];
if ($zPersonalT[$x2]==1){

      include('file/ZInterview.php');
}

$pathg='';
if ($zPersonalT[$x2]==2){
$pathg[$x2]=  $row1daa1G1['title3'];

      include('file/freeEvent.php');
}


if ($zPersonalT[$x2]>10){
$badboyInt="$loc2/index.php?route=product/category&cc=$cc99&path=$zPersonalT[$x2]";
$display_block11="<FORM  name=\"formcheck\" target=\"blank\" METHOD=\"POST\" ACTION=\"$badboyInt\">
                 <input type=\"hidden\" name=\"status\" value=\"0\" size=\"40\" />

                <button class=\"fsSubmitButton\" type=\"input\">Sign Up For Session</button>
         </form></td></tr></table>";
   $Intprint2=$display_block11;
}


   $Intprint2=$display_block11;
      }

     $Roadprint[$x2]=  $row1daa1G1['road'];
            $Roadprint2='';
      if ($Roadprint[$x2]>0){
       //  echo " Roadprint - $Roadprint[$x2]-$x2 :$Z_num</br>";
       include('file/ZRoadmap2.php');
$Roadprint2=$display_blockRA;
$display_blockRA='';
      }


          $Checkprint[$x2]=  $row1daa1G1['check1'];

               $Checkprint2='';
      if ($Checkprint[$x2]>0){

       include('file/ZChecklist.php');
$Checkprint2=$beg1AA;
      }

           $Pathprint[$x2]=  $row1daa1G1['path'];

               $Pathprint2='';
      if ($Pathprint[$x2]>0){

       include('file/ZPathway.php');
$Pathprint2=$display_blockRA;
$display_blockRA='';
      }

           $Upprint[$x2]=  $row1daa1G1['upp'];

                     $Upprint2='';
      if ($Upprint[$x2]>0){
           //   echo "Upp - $Upprint[$x2]<br/>";
               include('file/ZButtons.php');
       include('file/ZUpload.php');
$Upprint2=$beg1;
      }

           $Assessprint[$x2]=  $row1daa1G1['assess'];

                      $Assessprint2='';

      if ($Assessprint[$x2]>0){

   //   $zDisc =1;
     // $zKolbe =1;
    //  $zStrength =1;
    //  $zTakeSpirit=1;
    //  $zSpirit =1;
    //  $zLifeTime =1;
   //   $zPersonal =1;

      $zDisc=$row1daa1G1['zDisc'];
$zKolbe=$row1daa1G1['zKolbe'];
$zStrength=$row1daa1G1['zStrength'];
$zSpiritTake=$row1daa1G1['zSpiritTake'];
$zSpirit=$row1daa1G1['zSpirit'];
$zLife=$row1daa1G1['zLife'];
$zLifeTime=$row1daa1G1['zLifeTime'];
$zPersonal=$row1daa1G1['zPersonal'];

      $PersonalForms=$row1daa1G1['zPersonalT'];
                         // echo "Assess = $Assessprint[$x2]<br/>";
       include('file/ZAssessments.php');
$Assessprint2=$zAssess;
      }

      $Reportprint[$x2]=  $row1daa1G1['Report'];

                      $Reportprint2='';
      if ($Reportprint[$x2]>0){

       include('file/ZReports.php');
$Reportprint2=$zReports;
      }

              $EnrollAgentsprint[$x2]=  $row1daa1G1['Enroll'];
                     $Enrollprint2='';
                     $zAgentReports='';

                   //  echo " EnrollAgentsprint - $EnrollAgentsprint[$x2]</br>";
      if ($EnrollAgentsprint[$x2]>0){
                 //  $AgentMat=1;
                 //  $EnrollMat=1 ;
                 //  $AgentList=1;
                 //  $AgentForm=1;
                   $AgentMat=$row1daa1G1['AgentMat']; ;
                   $EnrollMat=$row1daa1G1['EnrollMat'];  ;
                   $AgentList=$row1daa1G1['AgentList']; ;
                   $AgentForm=$row1daa1G1['AgentForm']; ;
$title_disp2="LINKS&nbsp;TO&nbsp;VIDEO&nbsp;PRESENTATION";
$title_disp3="ENROLL AN AGENT";
$title_disp37="MY AGENTS";
$title_disp4="FORMS";

       include('file/ZEnrollAgents.php');
$Enrollprint2=$zAgentReports;


       }
               $SignMemsprint[$x2]=  $row1daa1G1['SignMem'];

                     $SignUpprint2='';
                     $SignMemprint2='';
                     $zMemReports='';
      if ($SignMemsprint[$x2]>0){
                   $CompMat=1;
                   $ReadyToPayMat=1 ;
                   $Incomplete=1;
                   $StatementShow=1;
//$title_disp2="COMPLETED SIGN UPS";
//$title_disp21="SIGN UPS READY TO PAY";
//$title_disp3="INCOMPLETE SIGN UPS";
//$title_disp529="STATEMENTS";

$title_disp2=$row1daa1G1['title3'];
$title_disp21=$row1daa1G1['title37'];
$title_disp3=$row1daa1G1['title4'];
$title_disp529=$row1daa1G1['MemCardTitle'];

       include('file/ZMemStatements.php');
$SignMemprint2=$zMemReports;


       }

               $Doctorprint[$x2]=  $row1daa1G1['Doctor'];

                        $Doctorprint2='';
      if ($Doctorprint[$x2]>0){
           // $groupy=28;
            $groupy=$row1daa1G1['groupy'];
          //  $zDoctor="Doctor(s)";
             $zDoctor=$row1daa1G1['zDoctor'];
       include('file/ZDoctors.php');
$Doctorprint2= $display_blockRA;
$display_blockRA='';
//;
      }

             $MemCardprint[$x2]=  $row1daa1G1['Memcard'];
                     $MemCardprint2='';
                      $zMemReports='';

      if ($MemCardprint[$x2]>0){
                   $MemCard=1;
                   $MemRecord=1 ;
                   $MemCard=$row1daa1G1['Card'];
                   $MemRecord=$row1daa1G1['MemRecord'];
             //   $zDoctor="Doctor(s)";
                $zDoctor=$row1daa1G1['zDoctor'];
//$title_disp2="YOUR MEMBERSHIP&nbsp;CARD";
//$title_disp22="YOUR COMPLETE&nbsp;VISIT HISTORY";
// $MemCardTitle  ="$CAPz Membership Card";
 $title_disp2=$row1daa1G1['title3'];
$title_disp22=$row1daa1G1['title37'];
 $MemCardTitle=$row1daa1G1['MemCardTitle'];


       include('file/ZMemCard.php');
$MemCardprint2=$zMemReports;


       }


             $Patientprint[$x2]=  $row1daa1G1['Patient'];

                       $Patientprint2='';
      if ($Patientprint[$x2]>0){
          ////  $zDoctor="Doctor(s)";
          //$zPatient="Patient";
          $zPatient=$row1daa1G1['zDoctor'];
          $dlength=30;
       include('file/ZPatientLook.php');
$Patientprint2= $display_blockRA;
$display_blockRA='';
//;
      }



         $beg1Why9919 .="
     <h3 class=\"collapsible\" id=\"section1$XX1\"><font color=\"921319\">$titleZ[$x2]</font><span></span></h3>
<div class=\"container\">
    <div class=\"content\">

          $display_block19[$x2]
          <table><tr><td>$appprint2</td><td>$buyprint2</td></tr></table>
          $Intprint2
          $Roadprint2
          $Checkprint2
          $Pathprint2
          $Upprint2
          $Assessprint2
          $Reportprint2
          $Enrollprint2
          $SignMemprint2
          $Doctorprint2
          $MemCardprint2
          $Patientprint2
$otherprint2
    </div>
</div>
   ";


             }




             }//for
                        $section4 .=  "<h3 class=\"collapsible\" id=\"section$x22\">$bucketstitle[$x22]<span></span></h3>
<div class=\"container\">
    <div class=\"content\">
          $beg1Why9919
    </div>
</div>
   ";
    $beg1Why9919='';
            }


     $Ztitle1='';
 }  //end of bucket

?>
