Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Store customer data in DB from sign-up form
- add_action('wp_ajax_bre_signup_preview_pdf', 'bre_signup_preview_pdf');
- add_action('wp_ajax_nopriv_bre_signup_preview_pdf', 'bre_signup_preview_pdf');
- /**
- *
- * PROPOSED FUNCTION
- *
- * @The following functions are designed to replace the:
- * - breContractPDF()
- * - makePDF()
- *
- * breGetContractData($type=session|db, $id=contract_id){}
- * breGeneratePDF($data){}
- * breEmailPDF($data, $pdf_path){}
- *
- */
- function bre_signup_preview_pdf(){
- if ( !wp_verify_nonce($_POST['nonce'], 'nebula_ajax_nonce') ){
- die('Permission Denied.');
- }
- breGetContractData('session');
- }
- function breGetContractData($type, $id=false){
- // echo 'This is action is saved within the LIVE theme!'; wp_die();
- $type = ($type == 'db')? 'db': 'session';
- #1- Determine if we should use DB
- if( $type == 'db' ){ //&& $id
- //////////////////////////
- // @TODO: abstract this to remove the connection details and pull them from the wp-config
- //////////////////////////
- $servername = 'localhost';
- $username = 'bluerockenergy';
- $password = 'rgy572$BRE';
- $dbname = 'bluerock_wp';
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT id, service_type, first_name, last_name, company, emailaddress, electricplan, electric_utility, bre_electricplan, bre_electric_fixed_price_shown, bre_greenoptionpercentage, eletric_account_number_1, eletric_account_number_2, eletric_account_number_3, eletric_account_number_4, eletric_account_number_5, glasplan, gas_utility, bre_gasplan, bre_gas_fixed_price_shown, gas_account_number_1, gas_account_number_2, gas_account_number_3, gas_account_number_4, gas_account_number_5, contact_first_name, contact_last_name, contact_phone, contact_email, contact_fax, tax_exempt, tax_exempt_filename, mailing_address_1, mailing_address_2, mailing_city, mailing_state, mailing_zip, billing_address_1, billing_address_2, billing_city, billing_state, billing_zip, service_address_1, service_address_2, service_city, service_state, service_zip, industry, promo_code, electric_terms_accepted, gas_terms_accepted, hard_copy_requested, bill_of_rights_accepted, identity_validation_code, confirmation_number ga_cid, timestamp, contract_generated, confirmation_number_el, confirmation_number_gas
- FROM customer_signups
- ORDER BY `id` DESC LIMIT 0,1"; //WHERE?
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- $PDFvalues = $row;
- $customer_data = array(
- 'id' => $row["id"],
- 'service_type' => $row["service_type"],
- 'first_name' => $row["first_name"],
- 'last_name' => $row["last_name"],
- 'company' => $row["company"],
- 'emailaddress' => $row["emailaddress"],
- 'electricplan' => $row["electricplan"],
- 'electric_utility' => $row["electric_utility"],
- 'bre_electricplan' => $row["bre_electricplan"],
- 'bre_electric_fixed_price_shown' => $row["bre_electric_fixed_price_shown"],
- 'bre_greenoptionpercentage' => $row["bre_greenoptionpercentage"],
- 'eletric_account_number_1' => $row["eletric_account_number_1"],
- 'eletric_account_number_2' => $row["eletric_account_number_2"],
- 'eletric_account_number_3' => $row["eletric_account_number_3"],
- 'eletric_account_number_4' => $row["eletric_account_number_4"],
- 'eletric_account_number_5' => $row["eletric_account_number_5"],
- 'glasplan' => $row["glasplan"],
- 'gas_utility' => $row["gas_utility"],
- 'bre_gasplan' => $row["bre_gasplan"],
- 'bre_gas_fixed_price_shown' => $row["bre_gas_fixed_price_shown"],
- 'gas_account_number_1' => $row["gas_account_number_1"],
- 'gas_account_number_2' => $row["gas_account_number_2"],
- 'gas_account_number_3' => $row["gas_account_number_3"],
- 'gas_account_number_4' => $row["gas_account_number_4"],
- 'gas_account_number_5' => $row["gas_account_number_5"],
- 'contact_first_name' => $row["contact_first_name"],
- 'contact_last_name' => $row["contact_last_name"],
- 'contact_phone' => $row["contact_phone"],
- 'contact_email' => $row["contact_email"],
- 'contact_fax' => $row["contact_fax"],
- 'tax_exempt' => $row["tax_exempt"],
- 'tax_exempt_filename' => $row["tax_exempt_filename"],
- 'mailing_address_1' => $row["mailing_address_1"],
- 'mailing_address_2' => $row["mailing_address_2"],
- 'mailing_city' => $row["mailing_city"],
- 'mailing_state' => $row["mailing_state"],
- 'mailing_zip' => $row["mailing_zip"],
- 'billing_address_1' => $row["billing_address_1"],
- 'billing_address_2' => $row["billing_address_2"],
- 'billing_city' => $row["billing_city"],
- 'billing_state' => $row["billing_state"],
- 'billing_zip' => $row["billing_zip"],
- 'service_address_1' => $row["service_address_1"],
- 'service_address_2' => $row["service_address_2"],
- 'service_city' => $row["service_city"],
- 'service_state' => $row["service_state"],
- 'service_zip' => $row["service_zip"],
- 'industry' => $row["industry"],
- 'promo_code' => $row["promo_code"],
- 'electric_terms_accepted' => $row["electric_terms_accepted"],
- 'gas_terms_accepted' => $row["gas_terms_accepted"],
- 'hard_copy_requested' => $row["hard_copy_requested"],
- 'bill_of_rights_accepted' => $row["bill_of_rights_accepted"],
- 'identity_validation_code' => $row["identity_validation_code"],
- 'confirmation_number_el' => $row["confirmation_number_el"],
- 'confirmation_number_gas' => $row["confirmation_number_gas"],
- 'contract_generated' => $row["contract_generated"],
- 'ga_cid' => $row["ga_cid"],
- 'timestamp' => $row["timestamp"],
- );
- } //endwhile
- // @TODO: if we're doing the DB side of things, we should probably update DB like the current working function.
- // @TODO: COME BACK TO THIS!
- // ...
- } //endif
- } else{ #1- Or determine if we should just use the SESSION data
- $customer_data = array(
- 'service_type' => sanitize_text_field($_POST['data']['service_type']),
- 'first_name' => sanitize_text_field($_POST['data']['first_name']),
- 'last_name' => sanitize_text_field($_POST['data']['last_name']),
- 'company' => sanitize_text_field($_POST['data']['company']),
- 'emailaddress' => sanitize_text_field($_POST['data']['emailaddress']),
- 'electricplan' => sanitize_text_field($_POST['data']['electricplan']),
- 'electric_utility' => sanitize_text_field($_POST['data']['electric_utility']),
- 'bre_electricplan' => sanitize_text_field($_POST['data']['bre_electricplan']),
- 'bre_electric_fixed_price_shown' => sanitize_text_field($_POST['data']['bre_electric_fixed_price_shown']),
- 'bre_greenoptionpercentage' => sanitize_text_field($_POST['data']['bre_greenoptionpercentage']),
- 'eletric_account_number_1' => sanitize_text_field($_POST['data']['eletric_account_number_1']),
- 'eletric_account_number_2' => sanitize_text_field($_POST['data']['eletric_account_number_2']),
- 'eletric_account_number_3' => sanitize_text_field($_POST['data']['eletric_account_number_3']),
- 'eletric_account_number_4' => sanitize_text_field($_POST['data']['eletric_account_number_4']),
- 'eletric_account_number_5' => sanitize_text_field($_POST['data']['eletric_account_number_5']),
- 'glasplan' => sanitize_text_field($_POST['data']['glasplan']),
- 'gas_utility' => sanitize_text_field($_POST['data']['gas_utility']),
- 'bre_gasplan' => sanitize_text_field($_POST['data']['bre_gasplan']),
- 'bre_gas_fixed_price_shown' => sanitize_text_field($_POST['data']['bre_gas_fixed_price_shown']),
- 'gas_account_number_1' => sanitize_text_field($_POST['data']['gas_account_number_1']),
- 'gas_account_number_2' => sanitize_text_field($_POST['data']['gas_account_number_2']),
- 'gas_account_number_3' => sanitize_text_field($_POST['data']['gas_account_number_3']),
- 'gas_account_number_4' => sanitize_text_field($_POST['data']['gas_account_number_4']),
- 'gas_account_number_5' => sanitize_text_field($_POST['data']['gas_account_number_5']),
- 'contact_first_name' => sanitize_text_field($_POST['data']['contact_first_name']),
- 'contact_last_name' => sanitize_text_field($_POST['data']['contact_last_name']),
- 'contact_phone' => sanitize_text_field($_POST['data']['contact_phone']),
- 'contact_email' => sanitize_text_field($_POST['data']['contact_email']),
- 'contact_fax' => sanitize_text_field($_POST['data']['contact_fax']),
- 'tax_exempt' => sanitize_text_field($_POST['data']['tax_exempt']),
- 'tax_exempt_filename' => sanitize_text_field($_POST['data']['tax_exempt_filename']),
- 'mailing_address_1' => sanitize_text_field($_POST['data']['mailing_address_1']),
- 'mailing_address_2' => sanitize_text_field($_POST['data']['mailing_address_2']),
- 'mailing_city' => sanitize_text_field($_POST['data']['mailing_city']),
- 'mailing_state' => sanitize_text_field($_POST['data']['mailing_state']),
- 'mailing_zip' => sanitize_text_field($_POST['data']['mailing_zip']),
- 'billing_address_1' => sanitize_text_field($_POST['data']['billing_address_1']),
- 'billing_address_2' => sanitize_text_field($_POST['data']['billing_address_2']),
- 'billing_city' => sanitize_text_field($_POST['data']['billing_city']),
- 'billing_state' => sanitize_text_field($_POST['data']['billing_state']),
- 'billing_zip' => sanitize_text_field($_POST['data']['billing_zip']),
- 'service_address_1' => sanitize_text_field($_POST['data']['service_address_1']),
- 'service_address_2' => sanitize_text_field($_POST['data']['service_address_2']),
- 'service_city' => sanitize_text_field($_POST['data']['service_city']),
- 'service_state' => sanitize_text_field($_POST['data']['service_state']),
- 'service_zip' => sanitize_text_field($_POST['data']['service_zip']),
- 'industry' => sanitize_text_field($_POST['data']['industry']),
- 'promo_code' => sanitize_text_field($_POST['data']['promo_code']),
- 'electric_terms_accepted' => sanitize_text_field($_POST['data']['electric_terms_accepted']),
- 'gas_terms_accepted' => sanitize_text_field($_POST['data']['gas_terms_accepted']),
- 'hard_copy_requested' => sanitize_text_field($_POST['data']['hard_copy_requested']),
- 'bill_of_rights_accepted' => sanitize_text_field($_POST['data']['bill_of_rights_accepted']),
- 'identity_validation_code' => sanitize_text_field($_POST['data']['identity_validation_code']),
- 'confirmation_number_el' => sanitize_text_field($_POST['data']['confirmation_number_el']),
- 'confirmation_number_gas' => sanitize_text_field($_POST['data']['confirmation_number_gas']),
- 'contract_generated' => '',
- 'ga_cid' => sanitize_text_field($_POST['data']['ga_cid']),
- 'timestamp' => sanitize_text_field(time()),
- );
- } //endelse
- // echo json_encode( $customer_data ); wp_die();
- breGeneratePDF($customer_data);
- }
- function breGeneratePDF($data){
- // echo json_encode( $customer_data ); wp_die();
- // echo 'Jef!';
- ///////////////////////////// create contract number section end
- // @NOTE: HEREBLOCK should never be indented.
- // FDF header section
- $fdf_header = <<<FDF
- %FDF-1.2
- 1 0 obj
- <<
- /FDF << /Fields [
- FDF;
- // FDF footer section
- $fdf_footer = <<<FDF
- ] >> >>
- endobj
- trailer
- << /Root 1 0 R >>
- %%EOF;
- FDF;
- // @NOTE: HEREBLOCK should never be indented.
- switch( $data['mailing_state'] ){ //@TODO: consider pulling the contact_state?
- case 'NY':
- $fdf_content = getNYcontractTemplate( $data );
- break;
- // @TODO: Commenting these out until we need them
- // case 'PA':
- // $fdf_content = getPAcontractTemplate( $data );
- // break;
- // case 'MA':
- // $fdf_content = getMAcontractTemplate( $data );
- // break;
- // case 'CT':
- // $fdf_content = getCTcontractTemplate( $data );
- // break;
- }
- // Logic pushed into each template function
- // if ($electricplan == 1){
- // $resultE = makePDF("E", $PDFvalues, $electricContractNumber);
- // }
- // if ($glasplan == 1){
- // $resultG = makePDF("G", $PDFvalues, $gasContractNumber);
- // }
- }
- function getNYcontractTemplate($data){
- if($data['electric_utility']== "NatGrid-E"){
- $electric_utilityTxt = "National Grid - Upstate NY";
- } else if($data['electric_utility']== "ConEd-E"){
- $electric_utilityTxt = "Consolidated Edison";
- } else if($data['electric_utility']== "NYSEG-E"){
- $electric_utilityTxt = "NYSEG";
- } else if($data['electric_utility']== "NYSEG"){ // incase this value gets changed from NYSEG-E to NYSEG
- $electric_utilityTxt = "NYSEG";
- } else if($data['electric_utility']== "O&R-E"){
- $electric_utilityTxt = "Orange & Rockland";
- } else if($data['electric_utility']== "RGE-E"){
- $electric_utilityTxt = "Rochester Gas & Electric";
- } else if($data['electric_utility']== "CHGE-E"){
- $electric_utilityTxt = "Central Hudson Gas & Electric";
- }
- if($data['gas_utility']== "NatGrid-G"){
- $gas_utilityTxt = "National Grid - Upstate NY";
- } else if($data['gas_utility']== "Keyspan-G"){
- $gas_utilityTxt = "National Grid - Metro NY";
- } else if($data['gas_utility']== "KeyspanLI-G"){
- $gas_utilityTxt = "National Grid - Long Island NY";
- } else if($data['gas_utility']== "ConEd-G"){
- $gas_utilityTxt = "Consolidated Edison";
- } else if($data['gas_utility']== "NYSEG-G"){
- $gas_utilityTxt = "NYSEG";
- } else if($data['gas_utility']== "NYSEG"){// incase this value gets changed from NYSEG-E to NYSEG
- $gas_utilityTxt = "NYSEG";
- } else if($data['gas_utility']== "O&R-G"){
- $gas_utilityTxt = "Orange & Rockland";
- } else if($data['gas_utility']== "RGE-G"){
- $gas_utilityTxt = "Rochester Gas & Electric";
- } else if($data['gas_utility']== "CHGE-G"){
- $gas_utilityTxt = "Central Hudson Gas & Electric";
- } else if($data['gas_utility']== "NationalGas"){
- $gas_utilityTxt = "National Fuel Gas";
- }
- //confirmation number field under logo
- if($data['electricplan'] == 1){
- $confirmation_number_el_top = "Confirmation #: BRE-" . $data['contractNumber']; //when called from an if then statemment where electic is true, an electric contract number is passed into ' $data[$ontractNumber']
- $fdf_content = "<< /T(confirmNumber)/V({$confirmation_number_el_top}) >>";
- }
- if($data['glasplan'] == 1){
- $confirmation_number_gas_top = "Confirmation #: BRE-" . $data['contractNumber'];//when called from an if then statemment where gas is true, a gas contract number is passed into ' $data[$ontractNumber']
- $fdf_content .= "<< /T(gasConfirmNumber)/V({$confirmation_number_gas_top}) >>";
- }
- //time and date field under logo
- $datetimeFormat = 'Y-m-d H:i:sa';
- $date = new \DateTime();
- $date->setTimestamp($timestamp);
- $dateTime = $date->format($datetimeFormat);
- $customerName = $data['first_name'] . " " . $data['last_name'];
- $fdf_content .= "<< /T(customer)/V({$customerName}) >>";//page 2
- $fdf_content .= "<< /T(company)/V({$company}) >>";//page 1
- $fdf_content .= "<< /T(utilityName)/V({$electric_utilityTxt}) >>";
- //electric utility rate ready radio buttons
- $NYSEG = 'NYSEG';
- $RGE = 'RGE';
- //electric utility bill ready radio buttons
- $NationalGrid = 'NationalGrid';
- $ConEdison = 'ConEdison';
- $CentralHudson = 'CentralHudson';
- $OR = 'OR';
- //bill ready buttons
- if ($data['electric_utility'] == 'NYSEG-E'){
- $fdf_content .= "<< /T(utility)/V({$NYSEG}) >>"; //bill ready page 1 radio button
- $fdf_content .= "<< /T(utility2)/V({$NYSEG}) >>"; //bill ready page 5 radio button
- } else if($data['electric_utility'] == 'RGE-E'){
- $fdf_content .= "<< /T(utility)/V({$RGE}) >>"; //bill ready page 1 radio button
- $fdf_content .= "<< /T(utility2)/V({$RGE}) >>"; //bill ready page 5 radio button
- //rate ready buttons
- } else if($data['electric_utility'] == 'NatGrid-E'){
- $fdf_content .= "<< /T(utilityName2)/V({$NationalGrid}) >>"; //rate ready page 5 radio button
- } else if($data['electric_utility'] == 'ConEd-E'){
- $fdf_content .= "<< /T(utilityName2)/V({$ConEdison}) >>";//rate ready page 5 radio button
- } else if($data['electric_utility'] == 'CHGE-E'){
- $fdf_content .= "<< /T(utilityName2)/V({$CentralHudson}) >>";//rate ready page 5 radio button
- } else if($data['electric_utility'] == 'O&R-E'){
- $fdf_content .= "<< /T(utilityName2)/V({$ORG}) >>";//rate ready page 5 radio button
- }
- //gas utility text field
- $fdf_content .= "<< /T(gasUtilityName)/V({$gas_utilityTxt}) >>";
- //the following is for Gas utility radio buttons if the utility is national grid
- $upstate = 'Upstate';
- $metro = 'Metro';
- $longIsland = 'LongIsland';
- $NationalGridUpstate = 'NationalGridUpstate';
- $NationalGridMetro = 'NationalGridMetro';
- $NationalGridLongIsland = 'NationalGridLongIsland';
- $ConEdison = 'ConEdison';
- $NYSEG = 'NYSEG';
- $ORG = 'OR';
- $RGE = 'RGE';
- $CentralHudson = 'CentralHudson';
- $NationalFuel = 'NationalFuel';
- if($data['gas_utility'] == 'NatGrid-G'){
- $fdf_content .= "<< /T(gasUtilityNG)/V({$upstate}) >>"; //gas utility radio button page 1
- $fdf_content .= "<< /T(gasUtility2)/V({$NationalGridUpstate}) >>"; //gas utility radio button page 5
- } else if($data['gas_utility'] == 'Keyspan-G'){
- $fdf_content .= "<< /T(gasUtilityNG)/V({$metro}) >>"; //gas utility radio button page 1
- $fdf_content .= "<< /T(gasUtility2)/V({$NationalGridMetro}) >>"; //gas utility radio button page 5
- } else if($data['gas_utility'] == 'KeyspanLI-G'){
- $fdf_content .= "<< /T(gasUtilityNG)/V({$longIsland}) >>"; //gas utility radio button page 1
- $fdf_content .= "<< /T(gasUtility2)/V({$NationalGridLongIsland}) >>"; //gas utility radio button page 5
- } else if($data['gas_utility'] == 'ConEd-G'){
- $fdf_content .= "<< /T(gasUtility2)/V({$ConEdison}) >>"; //gas utility radio button page 5
- } else if($data['gas_utility'] == 'NYSEG-G'){
- $fdf_content .= "<< /T(gasUtility2)/V({$NYSEG}) >>"; //gas utility radio button page 5
- } else if($data['gas_utility'] == 'O&R-G'){
- $fdf_content .= "<< /T(gasUtility2)/V({$ORG}) >>"; //gas utility radio button page 5
- } else if($data['gas_utility'] == 'RGE-G'){
- $fdf_content .= "<< /T(gasUtility2)/V({$RGE}) >>"; //gas utility radio button page 5
- } else if($data['gas_utility'] == 'CHGE-G'){
- $fdf_content .= "<< /T(gasUtility2)/V({$CentralHudson}) >>"; //gas utility radio button page 5
- } else if($data['gas_utility'] == 'NationalGas'){
- $fdf_content .= "<< /T(gasUtility2)/V({$NationalFuel}) >>"; //gas utility radio button page 5
- }
- // @TODO: Start Testing Here! <jef@phg.com>
- //electric account numbers
- $electricAccountNumbers2 = $eletric_account_number_1.", ".$eletric_account_number_2;
- $electricAccountNumbers3 = $eletric_account_number_1.", ".$eletric_account_number_2.", ".$eletric_account_number_3;
- $electricAccountNumbers4 = $eletric_account_number_1.", ".$eletric_account_number_2.", ".$eletric_account_number_3.", ".$eletric_account_number_4;
- $electricAccountNumbers5 = $eletric_account_number_1.", ".$eletric_account_number_2.", ".$eletric_account_number_3.", ".$eletric_account_number_4.", ".$eletric_account_number_5;
- if(!$eletric_account_number_2){
- $fdf_content .= "<< /T(utilityAccNum)/V({$eletric_account_number_1}) >>";
- } else if(!$eletric_account_number_3){
- $fdf_content .= "<< /T(utilityAccNum)/V({$electricAccountNumbers2}) >>";
- } else if(!$eletric_account_number_4){
- $fdf_content .= "<< /T(utilityAccNum)/V({$electricAccountNumbers3}) >>";
- } else if(!$eletric_account_number_5){
- $fdf_content .= "<< /T(utilityAccNum)/V({$electricAccountNumbers4}) >>";
- } else{
- $fdf_content .= "<< /T(utilityAccNum)/V({$electricAccountNumbers5}) >>";
- }
- //gas account numbers
- $gasAccountNumbers2 = $gas_account_number_1.", ".$gas_account_number_2;
- $gasAccountNumbers3 = $gas_account_number_1.", ".$gas_account_number_2.", ".$gas_account_number_3;
- $gasAccountNumbers4 = $gas_account_number_1.", ".$gas_account_number_2.", ".$gas_account_number_3.", ".$gas_account_number_4;
- $gasAccountNumbers5 = $gas_account_number_1.", ".$gas_account_number_2.", ".$gas_account_number_3.", ".$gas_account_number_4.", ".$gas_account_number_5;
- if(!$gas_account_number_2){
- $fdf_content .= "<< /T(gasUtilityAccNum)/V({$gas_account_number_1}) >>";
- } else if(!$gas_account_number_3){
- $fdf_content .= "<< /T(gasUtilityAccNum)/V({$gasAccountNumbers2}) >>";
- } else if(!$gas_account_number_4){
- $fdf_content .= "<< /T(gasUtilityAccNum)/V({$gasAccountNumbers3}) >>";
- } else if(!$gas_account_number_5){
- $fdf_content .= "<< /T(gasUtilityAccNum)/V({$gasAccountNumbers4}) >>";
- } else{
- $fdf_content .= "<< /T(gasUtilityAccNum)/V({$gasAccountNumbers5}) >>";
- }
- $BlueLock100 = 'BlueLock100';
- $BluePremier = 'BluePremier';
- $Yes = 'Yes';
- // electric fixed price (blueLock100) or variable price (BluePremier) option
- if ($bre_electricplan == "BlueLock100"){
- $fdf_content .= "<< /T(fixedPriceOptions)/V({$BlueLock100}) >>"; //commercial fixed price contracts
- $fdf_content .= "<< /T(managedPortfolioPlans)/V({$BlueLock100}) >>";//residential contracts
- $fdf_content .= "<< /T(fixedPrice)/V({$fixed_price_electric}) >>";
- } else if($bre_electricplan == "BluePremier"){
- $fdf_content .= "<< /T(fixedPriceOptions)/V({$BluePremier}) >>"; //commercial fixed price contracts
- $fdf_content .= "<< /T(managedPortfolioPlans)/V({$BluePremier}) >>";//residential contracts
- $fdf_content .= "<< /T(bluePremier)/V({$Yes}) >>";//commercial variable price contracts
- }
- // gas fixed price (blueLock100) or variable price (BluePremier) option
- if ($bre_gasplan == "BlueLock100"){
- $fdf_content .= "<< /T(gasFixedPriceOptions)/V({$BlueLock100}) >>"; //commercial fixed price contracts
- $fdf_content .= "<< /T(gasManagedPortfolioPlans)/V({$BlueLock100}) >>";//residential contracts
- $fdf_content .= "<< /T(gasFixedPrice)/V({$fixed_price_gas}) >>";
- } else if($bre_gasplan == "BluePremier"){
- $fdf_content .= "<< /T(gasFixedPriceOptions)/V({$BluePremier}) >>"; //commercial fixed price contracts
- $fdf_content .= "<< /T(gasManagedPortfolioPlans)/V({$BluePremier}) >>";//residential contracts
- $fdf_content .= "<< /T(variablePriceOption)/V({$BluePremier}) >>";//commercial variable price contracts
- }
- $greenOption = $bre_greenoptionpercentage;
- $greenUp30 = 'greenUp30';
- $greenUp50 = 'greenUp50';
- $greenUp75 = 'greenUp75';
- $greenUp100 = 'greenUp100';
- if ($greenOption == "GREENUP30"){
- $fdf_content .= "<< /T(greenOption)/V({$greenUp30}) >>";
- } else if($greenOption == "GREENUP50"){
- $fdf_content .= "<< /T(greenOption)/V({$greenUp50}) >>";
- } else if($greenOption == "GREENUP75"){
- $fdf_content .= "<< /T(greenOption)/V({$greenUp75}) >>";
- } else if($greenOption == "GREENUP100"){
- $fdf_content .= "<< /T(greenOption)/V({$greenUp100}) >>";
- }
- //$fdf_content .= "<< /T(startMonth)/V({}) >>"; no database table field for this
- //$fdf_content .= "<< /T(startYear)/V({}) >>"; no database table field for this
- $enrollmentTerm = 'twelve';
- $fdf_content .= "<< /T(enrollmentTerm)/V({$enrollmentTerm}) >>";//page 1
- $fdf_content .= "<< /T(gasEnrollmentTerm)/V({$enrollmentTerm}) >>";//page 1
- $contactFirstLastName = $contact_first_name." ".$contact_last_name;
- $fdf_content .= "<< /T(contactName)/V({$contactFirstLastName}) >>";//page 2
- //$fdf_content .= "<< /T(contactName2)/V({$contactFirstLastName}) >>";//page5 - this field name is now contactName
- $fdf_content .= "<< /T(contactPhone)/V({$contact_phone}) >>";//page 2
- //$fdf_content .= "<< /T(contactPhone2)/V({$contact_phone}) >>"; //page5 - this field name is now contactPhone
- $fdf_content .= "<< /T(contactFax)/V({$contact_fax}) >>"; //page 2
- $fdf_content .= "<< /T(contactEmail)/V({$contact_email}) >>";//page 2
- $teNo = 'No';
- $teYes = 'Yes';
- if($tax_exempt == "0"){
- $fdf_content .= "<< /T(taxExempt)/V({$teNo}) >>";
- } else if ($tax_exempt == "1"){ //what is the value for yes? is it one. No is 0
- $fdf_content .= "<< /T(taxExempt)/V({$teYes}) >>";
- }
- $mailing_address = $mailing_address_1." ".$mailing_address_2;
- $mailingCityStateZip = $mailing_city.", ".$mailing_state." ".$mailing_zip;
- $fdf_content .= "<< /T(address)/V({$mailing_address}) >>";
- $fdf_content .= "<< /T(cityStateZip)/V({$mailingCityStateZip}) >>";
- $billing_address = $billing_address_1." ".$billing_address_2;
- $billingCityStateZip = $billing_city.", ".$billing_state." ".$billing_zip;
- if($mailing_address != $billing_address){
- $fdf_content .= "<< /T(billingAddress)/V({$billing_address}) >>";
- $fdf_content .= "<< /T(billingCityStateZip)/V({$billingCityStateZip}) >>";
- }
- $fdf_content .= "<< /T(organizationCode)/V({$industry}) >>";
- $fdf_content .= "<< /T(promoCode)/V({$promo_code}) >>";
- $lastFourDigitsOfSS = "Last 4 digits of Social Security number of person submitting: ". $identity_validation_code;
- $fdf_content .= "<< /T(lastFourDigitsOfSS)/V({$lastFourDigitsOfSS}) >>";
- $breSignatureline = "Online Sign Up";
- $customerSignatureline = "Signed electronically on ". $dateTime;
- $fdf_content .= "<< /T(BlueRockSign)/V({$breSignatureline}) >>";
- $fdf_content .= "<< /T(CustomerSign)/V({$customerSignatureline}) >>";
- if($eorg == "E"){
- $fdf_contentE = $fdf_content;
- return $fdf_contentE;
- }
- if($eorg == "G"){
- $fdf_contentG = $fdf_content;
- return $fdf_contentG;
- }
- }
- function breEmailPDF($data, $pdf_path){
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement