Esempio n. 1
0
function comparison_form_process()
{
    if (isset($_POST['btnComprison'])) {
        $test_comp = new comparisonClass();
        //        $test_comp->set_goConex_single_switch_price($_POST['goConexSnglPole']);
        //        $test_comp->set_goConex_three_switch_price($_POST['goConexDcro3Wy']);
        //        $test_comp->set_goConex_four_way_switch($_POST['goConexDcro4Wy']);
        //$test_comp->set_goConex_lbr_cst_pr_inst($_POST['goConexWireConStple']);
        $test_comp->set_work_days($_POST['txtAvailbleWrkDay']);
        $test_comp->set_avl_wrk_dy_pr_yr($_POST['txtGC_avlWrkD_prYr']);
        $test_comp->set_lbr_rate_tr($_POST['txt_lbr_rate']);
        $test_comp->set_bldr_share($_POST['txtPrcnt_builderShare']);
        $test_comp->set_prft_dsire_gc($_POST['txtPrftDsireGC']);
        global $wpdb;
        $table_name = $wpdb->prefix . 'comparison_tbl';
        $wpdb->insert($table_name, array('user_id' => get_current_user_id(), 'gc_available_wrk_day_pr_yr' => $_POST['txtAvailbleWrkDay'], 'available_wrk_day_pr_yr' => $_POST['txtGC_avlWrkD_prYr'], 'tr_labor_rate' => $_POST['txt_lbr_rate'], 'builder_share' => $_POST['txtPrcnt_builderShare'], 'gc_profit_dsire' => $_POST['txtPrftDsireGC'], 'tr_wire2cond_total' => $test_comp->get_two_wire_total(), 'tr_wire3cond_total' => $test_comp->get_three_wire_total(), 'tr_pipe_conduit_total' => $test_comp->get_pip_conduit_total(), 'tr_one_gang_box_total' => $test_comp->get_one_gang_box_total(), 'tr_two_gang_box_total' => $test_comp->get_two_gang_box_total(), 'tr_three_gang_box_total' => $test_comp->get_three_gang_box_total(), 'tr_four_gang_box_total' => $test_comp->get_four_gang_box_total(), 'tr_one_gang_vpr_bt_total' => $test_comp->get_one_gang_vapour_total(), 'tr_two_gang_vpr_bt_total' => $test_comp->get_secon_gang_vapour_total(), 'tr_three_gang_vpr_bt_total' => $test_comp->get_third_gang_vapour_total(), 'tr_four_gang_vpr_bt_total' => $test_comp->get_fourth_gang_vapour_total(), 'dec_snglepol_sw_total' => $test_comp->get_dec_single_switch_total(), 'dec_three_wy_sw_total' => $test_comp->get_three_way_switch_total(), 'dec_four_wy_sw_total' => $test_comp->get_four_way_switch_total(), 'wire_connctr_stple_total' => $test_comp->get_wire_conduct_total(), 'tr_mtrial_cst_pr_instltion' => $test_comp->get_material_cost_pr_inst(), 'tr_mtrial_cst_pr_switch' => $test_comp->get_material_cost_pr_switch(), 'tr_nm_sw_pr_home' => $test_comp->get_switces_per_home(), 'tr_roughin_hr_svd_pr_home_no_leg' => $test_comp->get_total_combined_hrly_rate_per_home(), 'tr_mnt_instl_vpr_barriar' => $test_comp->get_total_combined_hrly_rate_install_switch_vpr(), 'tr_mnt_dmge_sw_loc' => $test_comp->get_total_combined_hrly_rate_dmge_switch_loc(), 'tr_fnl_hr_svd_eliminating_sw_legs' => $test_comp->get_total_combined_hrly_rate_eliminatingSwLeg(), 'tr_lbr_cst_pr_installtion' => $test_comp->get_labour_cost_pr_inst(), 'tr_lbr_cst_pr_sw' => $test_comp->get_labour_cost_pr_switch(), 'tr_matrial_and_lbr_cst' => $test_comp->get_material_and_labour_cost(), 'tr_installed_sw_cst' => $test_comp->get_installed_switch_cost(), 'avl_vlue_option_exsting_bsns' => $test_comp->get_new_AvlvalueOptionExistingBsns(), 'total_option_profit_exsting_bsns' => $test_comp->get_totalOptionProfitExistingBsns(), 'tr_annual_man_hrs' => $test_comp->get_annualManHrsTR(), 'gc_annual_man_hrs' => $test_comp->get_annualManHrsGC(), 'tr_avg_hrs_roughin_pr_home' => $test_comp->get_avg_hrs_roughInPrHomeTR(), 'gc_avg_hrs_roughin_pr_home' => $test_comp->get_avg_hrs_roughInPrHomeGC(), 'tr_days_pr_roughin' => $test_comp->get_daysPrRoughInTR(), 'gc_days_pr_roughin' => $test_comp->get_daysPrRoughInGC(), 'annual_hrs_svd_exsting_roughin' => $test_comp->get_AnnualHrsSvdExistingRoughIn(), 'total_pssble_added_roughin_pr_anm' => $test_comp->get_TotalPossibleAddRoughInPrAnm(), 'avg_gross_prft_pr_home' => $test_comp->get_avg_grossProfitPrHome(), 'gc_avg_option_prft_increase_instl' => $test_comp->get_gc_OptionProfitIncrease_Instl(), 'annual_grs_prft_potential' => $test_comp->get_annual_grsPrftPotential(), 'staff_svng_hr_svd_mn_avl_pr_hr' => $test_comp->get_staff_svngHrSvdMnHrAvlPrYr(), 'annual_saving' => $test_comp->get_Annual_Savings(), 'gc_pwr_cntrl_total' => $test_comp->get_totalOptionProfitExistingBsns(), 'gc_pwr_cntrl_value_pr_home' => $test_comp->get_GC_pwr_Conrol_needs(), 'gc_pwr_cntrl_bldr_option_prce_pr_hme' => $test_comp->get_bldr_option_prce_pr_home(), 'gc_pwr_cntrl_total_vlu_dlr_pr_hme' => $test_comp->get_GC_total_value_dlr_pr_home(), 'gc_pwr_cntrl_total_adjust_staff' => $test_comp->get_GC_total_PwrCntrl_adjust_staff(), 'gc_pwr_cntrl_adjust_staff_vlue_pr_hme' => $test_comp->get_GC_PwrCntrl_adjust_staff_VluPrHome(), 'gc_pwr_cntrl_adjust_staff_dlr_vlue_pr_hme' => $test_comp->get_GC_PwrCntrl_value_dlr_pr_home(), 'gc_pwr_cntrl_do_more_exstng_rsrces_total' => $test_comp->get_PwrCntrl_doMoreExistingRsrcs(), 'gc_pwr_cntrl_do_more_exstng_rsrces_vlue_pr_hme' => $test_comp->get_PwrCntrl_doMoreExistingRsrcs_VluePrHome(), 'gc_pwr_cntrl_do_more_exstng_rsrces_dlr_vlue_pr_hme' => $test_comp->get_PwrCntrl_doMoreExistingRsrcs_TotalVluDlrPrHome()));
        echo '<br/>';
        echo '<hr/>';
        echo '<h2>Results:</h2>';
        echo '<br/>';
        echo '<table width="60%">';
        echo '<tbody>';
        echo '<tr style="padding-bottom:30px;">';
        echo '<th colspan="2" style="text-align:right"><strong>Traditional Wiring</strong></th>';
        echo '<th colspan="3" style="text-align:right"><strong>GoConex</strong></th>';
        echo '</tr>';
        echo '<tr>';
        echo '<td><strong>Switch Leg Materials</strong></td>';
        echo '<td><strong>No. Switches per home</strong></td>';
        echo '<td><strong>Total</strong></td>';
        echo '<td><strong>&nbsp;</strong></td>';
        echo '<td><strong>Price</strong></td>';
        echo '<td><strong>Total</strong></td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Wire - 2 conductor (price per foot or meter)</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_two_wire_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Wire - 3 conductor (price per foot or meter)</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_three_wire_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Pipe / Conduit (price per unit of length)</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_pip_conduit_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>1 gang boxes</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_one_gang_box_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>2 gang boxes</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_two_gang_box_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>3 gang boxes</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_three_gang_box_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>3 gang boxes</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_four_gang_box_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_switces_per_home() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo ' <td>1 gang vapour boot</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_one_gang_vapour_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>2 gang vapour boot</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_secon_gang_vapour_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>3 gang vapour boot</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_third_gang_vapour_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>4 gang vapour boot</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_fourth_gang_vapour_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Decora single pole switches</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_dec_single_switch_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Decora 3 way switch</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_three_way_switch_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Decora 4 way switch</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_four_way_switch_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Wire conectors & staples</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_wire_conduct_total() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Material cost per installation</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_material_cost_pr_inst() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        // . $test_comp->get_goConex_material_cost_pr_inst() .
        echo '</tr>';
        echo '<tr>';
        echo '<td>Material cost per switch</td>';
        echo '<td>&nbsp;</td>';
        // echo '<td>$' . $test_comp->get_material_cost_pr_switch() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        // echo '<td>$' . $test_comp->get_goConex_material_cost_pr_switch() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td colspan="5"><br/><hr/><h2>Labour</h2></td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td><strong>Total</strong></td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Rough in hours saved per home/unit no switch legs</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_total_combined_hrly_rate_per_home() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Minutes per unit to install switch vapour barrier</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_total_combined_hrly_rate_install_switch_vpr() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Minutes per unit to manage damage to switch locations</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_total_combined_hrly_rate_dmge_switch_loc() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Final hours saved per home/unit eliminating switch legs</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_total_combined_hrly_rate_eliminatingSwLeg() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Labour cost per installation</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_labour_cost_pr_inst() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Labour cost per switch</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_labour_cost_pr_switch() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Materials & labour cost</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_material_and_labour_cost() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        //echo '<td>$' . $test_comp->get_goConex_material_cost_pr_inst() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Installed switch cost</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_installed_switch_cost() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        //echo '<td>$' . $test_comp->get_goConex_material_cost_pr_switch() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>New Available Value Options per home/unit on existing business</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_new_AvlvalueOptionExistingBsns() . '</td>';
        // echo '<td>$' . $test_comp->get_cost_diff_trad_goConex() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Total Options Profits existing business</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>$' . $test_comp->get_totalOptionProfitExistingBsns() . '</td>';
        // echo '<td>$' . $test_comp->get_cost_diff_trad_goConex() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td colspan="5"><br/><hr/></td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Do More With Your Existing People Resources</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>Traditional</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>GoConex</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Annual Man Hours (8 Hour Day)</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>' . $test_comp->get_annualManHrsTR() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>' . $test_comp->get_annualManHrsGC() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Average hours for rough-in per home</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>' . $test_comp->get_avg_hrs_roughInPrHomeTR() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>' . $test_comp->get_avg_hrs_roughInPrHomeGC() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Days Per Rough-in</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>' . $test_comp->get_daysPrRoughInTR() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>' . $test_comp->get_daysPrRoughInGC() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Annual Hours Saved Existing Rough-ins</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>' . $test_comp->get_AnnualHrsSvdExistingRoughIn() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Total Possible Additional Rough-ins per Annum</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>' . $test_comp->get_TotalPossibleAddRoughInPrAnm() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Average Gross Profit Per Home</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>' . $test_comp->get_avg_grossProfitPrHome() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>GoConex Options Profit Increase For Added Installations</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>' . $test_comp->get_gc_OptionProfitIncrease_Instl() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Annual Gross Profit Increase Potential</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>' . $test_comp->get_annual_grsPrftPotential() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>&nbsp;</td>';
        echo '<td colspan="2"><strong>OR</strong></td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Staff Savings, Hours Saved vs Man Hours Available Per Year</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>' . $test_comp->get_staff_svngHrSvdMnHrAvlPrYr() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Annual Savings</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>' . $test_comp->get_Annual_Savings() . '</td>';
        echo '<td>&nbsp;</td>';
        echo '<td>&nbsp;</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td><strong>Available Value Dollars</strong></td>';
        echo '<td colspan="2"> GOOD, BETTER, BEST </td>';
        echo '<td rowspan="2">BUILDER OPTION PRICING PER HOME</td>';
        echo '<td rowspan="2">What % Would The Builder Share?</td>';
        echo '<td rowspan="2">Total Value Dollars Per Home</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>&nbsp;</td>';
        echo '<td>Total</td>';
        echo '<td>Value Per Home</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Using GoConex For All Your Power Control Needs</td>';
        echo '<td>' . $test_comp->get_totalOptionProfitExistingBsns() . ' </td>';
        echo '<td>' . $test_comp->get_GC_pwr_Conrol_needs() . '</td>';
        echo '<td rowspan="3">' . $test_comp->get_bldr_option_prce_pr_home() . '</td>';
        echo '<td rowspan="3">' . $test_comp->get_bldr_share() * 100 . '</td>';
        echo '<td>' . $test_comp->get_GC_total_value_dlr_pr_home() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Using GoConex For All Your Power Control Needs AND Adjust Staff Resources For Efficiency</td>';
        echo '<td>' . $test_comp->get_GC_total_PwrCntrl_adjust_staff() . ' </td>';
        echo '<td>' . $test_comp->get_GC_PwrCntrl_adjust_staff_VluPrHome() . ' </td>';
        echo '<td>' . $test_comp->get_GC_PwrCntrl_value_dlr_pr_home() . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>Using GoConex For All Your Power Control Needs AND Do More With Your Existing People Resources</td>';
        echo '<td>' . $test_comp->get_PwrCntrl_doMoreExistingRsrcs() . ' </td>';
        echo '<td>' . $test_comp->get_PwrCntrl_doMoreExistingRsrcs_VluePrHome() . ' </td>';
        echo '<td>' . $test_comp->get_PwrCntrl_doMoreExistingRsrcs_TotalVluDlrPrHome() . '</td>';
        echo '</tr>';
        echo '</tbody>';
        echo '</table>';
    }
}