Jump to content

Whats wrong with this code


Bifter

Recommended Posts

function html () { 
return "<html> 
<body bgcolor=\"#AAAAAA\"> 
<table width=\"100%\" height=\"100%\" border=\"0\"> 
<tr width=\"100%\" height=\"10%\"> 
<td align=\"center\" valign=\"center\" width=\"90%\"> 
<table BGCOLOR=\"#cccccc\" BORDER=0 CELLSPACING=0><TR><TD><table BGCOLOR=\"#cccccc\" BORDER=0 CELLSPACING=2> 
<TR> 
<TD ALIGN=\"right\">DED:</TD> 
<TD COLSPAN=3 BGCOLOR=\"#ffffff\"> 
b
</TD> 
</TR> 
<TR> 
<TD ALIGN=\"right\">IP</TD> 
<TD COLSPAN=5 BGCOLOR=\"#ffffff\">"return function MainUnit ();"</TD> 
</td> 
</TR> 
</tr> 
</table></table> 
</body> 
</html>";
}

 

truly stumped!

Link to comment
Share on other sites

<?php
function html () { 
echo '<html> 
<body bgcolor=\"#AAAAAA\"> 
<table width=\"100%\" height=\"100%\" border=\"0\"> 
<tr width=\"100%\" height=\"10%\"> 
<td align=\"center\" valign=\"center\" width=\"90%\"> 
<table BGCOLOR=\"#cccccc\" BORDER=0 CELLSPACING=0>
<TR>
<TD><table BGCOLOR=\"#cccccc\" BORDER=0 CELLSPACING=2> 
<TR> 
<TD ALIGN=\"right\">DED:</TD> 
<TD COLSPAN=3 BGCOLOR=\"#ffffff\"> 
</TD> 
</TR> 
<TR> 
<TD ALIGN=\"right\">IP</TD> 
<TD COLSPAN=5 BGCOLOR=\"#ffffff\">"'. return function MainUnit (); .'"</TD> 
</td> 
</TR> 
</tr> 
</table></table> 
</body> 
</html>';
}

 

truly stumped!

 

 

Unless I'm missing something, that should be it. Assuming all of your functions, etc... are being called correctly.

Link to comment
Share on other sites

This may also help:

$MainUnit = array(
			array('Unit' => 'Avaya', 'Price' => '406'),
                array('Unit' => 'Cisco', 'Price' => '1500'),
                array('Unit' => 'Samsung', 'Price' => '995')
                );

 

/* Main Unit */
function MainUnit ($MainUnit) {
global $MainUnit;
return $MainUnit['0']['Price'] . "<br>";
}

 

Link to comment
Share on other sites

If you're passing a variable into a function as a parameter, you should not declare it as "global":

<?php
function MainUnit ($MainUnit) {
return $MainUnit['0']['Price'] . "<br>";
}
?>

 

The problem with this line

<?php
<TD COLSPAN=5 BGCOLOR=\"#ffffff\">"'. return function MainUnit (); .'"</TD> 
?>

is that you have a "return function" in the middle of an echo, which is incorrect.

 

It should be

<?php
<TD COLSPAN=5 BGCOLOR=\"#ffffff\">"'. MainUnit () .'"</TD> 
?>

 

Ken

Link to comment
Share on other sites

Hi Ken,

 

Thanks for your help, however still returning the following error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /homepages/6/d137097173/htdocs/Flip Sol/New/test/process-new.php on line 94

 

Below is the whole code:

<?php
/* Avaya - From Form*/
$LinesAnalogue = $_POST['LinesAnalogue'];
$LinesISDN2 = $_POST['LinesISDN2'];
$LinesISDN30 = $_POST['LinesISDN30'];
$DigitalExt = $_POST['DigitalExt'];
$AnalogueExt = $_POST['AnalogueExt'];
$Voicemail = $_POST['Voicemail'];
$BasicHand = $_POST['BasicHand'];
$GeneralHand = $_POST['GeneralHand'];
$ExecHand = $_POST['ExecHand'];

/* Main Unit */
$MainUnit = array(
			array('Unit' => 'Avaya', 'Price' => '406'),
                array('Unit' => 'Cisco', 'Price' => '1500'),
                array('Unit' => 'Samsung', 'Price' => '995')
                );

/* Line Cards */
$LineCard = array(
                array('Card' => 'Analogue Card/s', 'Price' => '232'),
                array('Card' => 'ISDN2e Card/s', 'Price' => '275'),
                array('Card' => 'ISDN30e Card/s', 'Price' => '530'),
			array('Card' => 'Cisco ISDN2e Card/s', 'Price' => '200'),
                array('Card' => 'Cisco ISDN30e Card/s', 'Price' => '600'),
			array('Card' => 'Samsung Analogue Card/s', 'Price' => '345'),
			array('Card' => 'Samsung ISDN2e Card/s', 'Price' => '395'),
                array('Card' => 'Samsund ISDN30e Card/s', 'Price' => '530')
                );

/* Extension Cards */
$ExtCard = array(
                array('Card' => 'Digital Extension Card/s', 'Price' => '319'),
                array('Card' => 'Analogue Extension Card/s', 'Price' => '145'),
			array('Card' => 'Cisco Switch', 'Price' => '1200'),
			array('Card' => 'Samsung Digital Extension Card/s', 'Price' => '295'),
                array('Card' => 'Samsung Analogue Extension Card/s', 'Price' => '295'),
                );

/* Voicemail */
$VoicemailPrice =  array(
                array('Card' => 'Avaya', 'Price' => '500'),
                array('Card' => 'Cisco', 'Price' => '600'),
			array('Card' => 'Samsung', 'Price' => '100'),
			);

/* Handsets */
$Phones = array(
                array('Phone' => 'Basic Model/s', 'Price' => '72'),
                array('Phone' => 'General Model/s', 'Price' => '152'),
                array('Phone' => 'Executive Model/s', 'Price' => '218'),
			array('Phone' => 'Cisco Basic Model/s', 'Price' => '135'),
                array('Phone' => 'Cisco General Model/s', 'Price' => '192'),
                array('Phone' => 'Cisco Executive Model/s', 'Price' => '297'),
			array('Phone' => 'Samsung Basic Model/s', 'Price' => '100'),
                array('Phone' => 'Samsung General Model/s', 'Price' => '150'),
                array('Phone' => 'Samsung Executive Model/s', 'Price' => '230')
                );

/* Extras */
$Instal = array(
                array('Phone' => 'Avaya', 'Price' => '400'),
                array('Phone' => 'Cisco', 'Price' => '1200'),
                array('Phone' => 'Samsung', 'Price' => '400')
			);
$Train =  array(
                array('Phone' => 'Avaya', 'Price' => '400'),
                array('Phone' => 'Cisco', 'Price' => '500'),
                array('Phone' => 'Samsung', 'Price' => '400')
			);

function html () { 
return "<html> 
<body bgcolor=\"#AAAAAA\"> 
<table width=\"100%\" height=\"100%\" border=\"0\"> 
<tr width=\"100%\" height=\"10%\"> 
<td align=\"center\" valign=\"center\" width=\"90%\"> 
<table BGCOLOR=\"#cccccc\" BORDER=0 CELLSPACING=0><TR><TD><table BGCOLOR=\"#cccccc\" BORDER=0 CELLSPACING=2> 
<TR> 
<TD ALIGN=\"right\">DED:</TD> 
<TD COLSPAN=3 BGCOLOR=\"#ffffff\"> 
b
</TD> 
</TR> 
<TR> 
<TD ALIGN=\"right\">IP</TD> 
<TD COLSPAN=5 BGCOLOR=\"#ffffff\">"'. MainUnit () .'"</TD> 
</td> 
</TR> 
</tr> 
</table></table> 
</body> 
</html>";
}

/*----------*/
/* Avaya */
/*----------*/
/* Main Unit */
function MainUnit ($MainUnit) {
return $MainUnit['0']['Price'] . "<br>";
}

/* Analogue Card */
function AnaLineTotal ($LineCard,$LinesAnalogue) {
global $LinesAnalogue;
global $LineCard;
if ($LinesAnalogue <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesAnalogue <= 5 ) {
   return $LineCard['0']['Price'] . "<br>";
   }
elseif ($LinesAnalogue <= 8 ) {
   return $LineCard['0']['Price'] * 2 . "<br>";
   }
elseif ($LinesAnalogue <= 12 ) {
   return $LineCard['0']['Price'] * 3 . "<br>";
   }
elseif ($LinesAnalogue >= 13 ) {
   return "Please Call" . "<br>";
   }
}
/* Number Required */
function AnaNumReq ($LinesAnalogue) {
global $LinesAnalogue;
if ($LinesAnalogue <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesAnalogue <= 5 ) {
   return "1" . "<br>";
   }
elseif ($LinesAnalogue <= 8 ) {
   return "2" . "<br>";
   }
elseif ($LinesAnalogue <= 12 ) {
   return "3" . "<br>";
   }
elseif ($LinesAnalogue >= 13 ) {
   return "Please Call" . "<br>";
   }
}


/* ISDN2 Card */
function ISDN2LineTotal ($LineCard,$LinesISDN2) {
global $LinesISDN2;
global $LineCard;
if ($LinesISDN2 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN2 <= 8 ) {
   return $LineCard['1']['Price'] . "<br>";
   }
elseif ($LinesISDN2 <= 16 ) {
   return $LineCard['1']['Price'] * 2 . "<br>";
   }
elseif ($LinesISDN2 >= 17 ) {
   return "Please Call" . "<br>";
   }
}

/* Number Required */
function ISDN2NumReq ($LinesISDN2) {
global $LinesISDN2;
if ($LinesISDN2 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN2 <= 8 ) {
   return "1" . "<br>";
   }
elseif ($LinesISDN2 <= 16 ) {
   return "2" . "<br>";
   }
elseif ($LinesISDN2 >= 17 ) {
   return "Please Call" . "<br>";
   }
}


/* ISDN30 Card */
function ISDN30LineTotal ($LineCard,$LinesISDN30) {
global $LinesISDN30;
global $LineCard;
if ($LinesISDN30 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN30 <= 30 ) {
   return $LineCard['2']['Price'] . "<br>";
   }
elseif ($LinesISDN30 <= 60 ) {
   return $LineCard['2']['Price'] * 2 . "<br>";
   }
elseif ($LinesISDN30 >= 61 ) {
   return "Please Call" . "<br>";
   }
}
/* Number Required */
function ISDN30NumReq ($LinesISDN30) {
global $LinesISDN30;
if ($LinesISDN30 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN30 <= 30 ) {
   return "1" . "<br>";
   }
elseif ($LinesISDN30 <= 60 ) {
   return "2" . "<br>";
   }
elseif ($LinesISDN30 >= 61 ) {
   return "Please Call" . "<br>";
   }
}


/* Total Number of Lines */
function NumLines ($LinesAnalogue,$LinesISDN2,$LinesISDN30) {
global $LinesAnalogue;
global $LinesISDN2;
global $LinesISDN30;
return $LinesAnalogue + $LinesISDN2 + $LinesISDN30;
} 

/* Digital Extension Card */
function DigExtLineTotal ($ExtCard,$DigitalExt) {
global $DigitalExt;
global $ExtCard;
if ($DigitalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($DigitalExt <= 8 ) {
   return $ExtCard['0']['Price'] . "<br>";
   }
elseif ($DigitalExt <= 16 ) {
   return $ExtCard['0']['Price'] * 2 . "<br>";
   }
elseif ($DigitalExt <= 24 ) {
   return $ExtCard['0']['Price'] * 3 . "<br>";
   }
elseif ($DigitalExt >= 25 ) {
   return "Please Call" . "<br>";
   }

}

/* Number Required */
function DigExtNumReq ($DigitalExt) {
global $DigitalExt;
if ($DigitalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($DigitalExt <= 8 ) {
   return "1" . "<br>";
   }
elseif ($DigitalExt <= 16 ) {
   return "2" . "<br>";
   }
elseif ($DigitalExt <= 24 ) {
   return "3" . "<br>";
   }
elseif ($DigitalExt >= 25 ) {
   return "Please Call" . "<br>";
   }
}


/* Analogue Extension Card */
function AnaExtLineTotal ($ExtCard,$AnalogueExt) {
global $AnalogueExt;
global $ExtCard;
if ($AnalogueExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($AnalogueExt <= 4 ) {
   return $ExtCard['1']['Price'] . "<br>";
   }
elseif ($AnalogueExt <= 8 ) {
   return $ExtCard['1']['Price'] * 2 . "<br>";
   }
elseif ($AnalogueExt <= 12 ) {
   return $ExtCard['1']['Price'] * 3 . "<br>";
   }
elseif ($AnalogueExt >= 13 ) {
   return "Please Call" . "<br>";
   }
}

/* Number Required */
function AnaExtNumReq ($AnalogueExt) {
global $AnalogueExt;
if ($AnalogueExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($AnalogueExt <= 4 ) {
   return "1" . "<br>";
   }
elseif ($AnalogueExt <= 8 ) {
   return "2" . "<br>";
   }
elseif ($AnalogueExt <= 12 ) {
   return "3" . "<br>";
   }
elseif ($AnalogueExt >= 13 ) {
   return "Please Call" . "<br>";
   }
}


/* Total Extensions */

function TotalExtension ($DigitalExt,$AnalogueExt) {
global $DigitalExt;
global $AnalogueExt;

return $DigitalExt + $AnalogueExt;
}

/* echo "Total Number of Extensions : ";
echo TotalExtension ( ) . "<br>"; */

/* Voicemail */
function Voicemail ($VoicemailPrice,$Voicemail) {
global $Voicemail;
global $VoicemailPrice;

if ($Voicemail == 1 ) {
return $VoicemailPrice['0']['Price'] . "<br>";
	}
else return "Not Required" . "<br>";
}

/* Basic Phone */
function BasPhoneLineTotal ($Phones,$BasicHand) {
global $BasicHand;
global $Phones;
if ($BasicHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $BasicHand * $Phones['0']['Price'] . "<br>";
}

/* Mid Range Phone */
function MidPhoneLineTotal ($Phones,$GeneralHand) {
global $GeneralHand;
global $Phones;
if ($GeneralHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $GeneralHand * $Phones['1']['Price'] . "<br>";
}


/* Executive Phone */
function ExecPhoneLineTotal ($Phones,$ExecHand) {
global $ExecHand;
global $Phones;
if ($ExecHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $ExecHand * $Phones['2']['Price'] . "<br>";
}


/* Total Number of Phones */
function NumPhones ($BasicHand,$GeneralHand,$ExecHand) {
global $BasicHand;
global $GeneralHand;
global $ExecHand;
return $BasicHand + $GeneralHand + $ExecHand;
}

/* Installation */
function InstallLineTotal ($Instal,$TotalExt) {
Global $Instal;
$TotalExt = TotalExtension ( );
if ($TotalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($TotalExt <= 10 ) {
   return $Instal['0']['Price'] . "<br>";
   }
elseif ($TotalExt <= 20 ) {
   return ($Instal['0']['Price'] / 2) * 3 . "<br>";
   }
elseif ($TotalExt <= 40 ) {
   return $Instal['0']['Price'] * 2 . "<br>";
   }
elseif ($TotalExt >= 41 ) {
   return "Subject to Survey" . "<br>";
   }
}


/* Training */
function TrainLineTotal ($Train,$TotalExt) {
Global $Train;
$TotalExt = TotalExtension ( );
if ($TotalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($TotalExt <= 20 ) {
   return $Train['0']['Price'] . "<br>";
   }
elseif ($TotalExt <= 30 ) {
   return ($Train['0']['Price'] / 2) * 3 . "<br>";
   }
elseif ($TotalExt >= 31 ) {
   return "Subject to Survey" . "<br>";
   }
}


/* Phone Total */
function PhoneTotal ( ) {
return BasPhoneLineTotal () + MidPhoneLineTotal () + ExecPhoneLineTotal ();
}

/*
*----------------------------------
*      Avaya Hardware Total
*----------------------------------
*/
function HardTotal ( ) {
return Total ( ) - (InstallLineTotal () + TrainLineTotal ()) ;
}

/*
*----------------------------------
*            Running Total
*----------------------------------
*/
function Total ( ) {
return MainUnit () + AnaLineTotal () + ISDN2LineTotal () + ISDN30LineTotal () + AnaExtLineTotal () + DigExtLineTotal () + Voicemail () + PhoneTotal () + InstallLineTotal () + TrainLineTotal ();
}

/*----------*/
/* Cisco */
/*----------*/
/* Main Unit */
function CiscoMainUnit ($MainUnit) {
global $MainUnit;
return $MainUnit['1']['Price'] . "<br>";
}

/* ISDN2 Card */
function CiscoISDN2LineTotal ($LineCard,$LinesISDN2) {
global $LinesISDN2;
global $LineCard;
if ($LinesISDN2 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN2 <= 8 ) {
   return $LineCard['3']['Price'] . "<br>";
   }
elseif ($LinesISDN2 <= 16 ) {
   return $LineCard['3']['Price'] * 2 . "<br>";
   }
elseif ($LinesISDN2 >= 17 ) {
   return "Please Call" . "<br>";
   }
}

/* Number Required */
function CiscoISDN2NumReq ($LinesISDN2) {
global $LinesISDN2;
if ($LinesISDN2 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN2 <= 8 ) {
   return "1" . "<br>";
   }
elseif ($LinesISDN2 <= 16 ) {
   return "2" . "<br>";
   }
elseif ($LinesISDN2 >= 17 ) {
   return "Please Call" . "<br>";
   }
}


/* ISDN30 Card */
function CiscoISDN30LineTotal ($LineCard,$LinesISDN30) {
global $LinesISDN30;
global $LineCard;
if ($LinesISDN30 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN30 <= 30 ) {
   return $LineCard['4']['Price'] . "<br>";
   }
elseif ($LinesISDN30 <= 60 ) {
   return $LineCard['4']['Price'] * 2 . "<br>";
   }
elseif ($LinesISDN30 >= 61 ) {
   return "Please Call" . "<br>";
   }
}
/* Number Required */
function CiscoISDN30NumReq ($LinesISDN30) {
global $LinesISDN30;
if ($LinesISDN30 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN30 <= 30 ) {
   return "1" . "<br>";
   }
elseif ($LinesISDN30 <= 60 ) {
   return "2" . "<br>";
   }
elseif ($LinesISDN30 >= 61 ) {
   return "Please Call" . "<br>";
   }
}

/* Digital Extension Card */
function CiscoDigExtLineTotal ($ExtCard,$DigitalExt) {
global $DigitalExt;
global $ExtCard;
if ($DigitalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($DigitalExt <= 24 ) {
   return $ExtCard['2']['Price'] . "<br>";
   }
elseif ($DigitalExt <= 48 ) {
   return $ExtCard['2']['Price'] * 2 . "<br>";
   }
elseif ($DigitalExt >= 49 ) {
   return "Please Call" . "<br>";
   }

}

/* Number Required */
function CiscoDigExtNumReq ($DigitalExt) {
global $DigitalExt;
if ($DigitalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($DigitalExt <= 24 ) {
   return "1" . "<br>";
   }
elseif ($DigitalExt <= 48 ) {
   return "2" . "<br>";
   }
elseif ($DigitalExt >= 49 ) {
   return "Please Call" . "<br>";
   }
}

/* echo "Total Number of Extensions : ";
echo TotalExtension ( ) . "<br>"; */

/* Voicemail */
function CiscoVoicemail ($VoicemailPrice,$Voicemail) {
global $Voicemail;
global $VoicemailPrice;

if ($Voicemail == 1 ) {
return $VoicemailPrice['1']['Price'] . "<br>";
	}
else return "Not Required" . "<br>";
}

/* Basic Phone */
function CiscoBasPhoneLineTotal ($Phones,$BasicHand) {
global $BasicHand;
global $Phones;
if ($BasicHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $BasicHand * $Phones['3']['Price'] . "<br>";
}

/* Mid Range Phone */
function CiscoMidPhoneLineTotal ($Phones,$GeneralHand) {
global $GeneralHand;
global $Phones;
if ($GeneralHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $GeneralHand * $Phones['4']['Price'] . "<br>";
}


/* Executive Phone */
function CiscoExecPhoneLineTotal ($Phones,$ExecHand) {
global $ExecHand;
global $Phones;
if ($ExecHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $ExecHand * $Phones['5']['Price'] . "<br>";
}

/* Installation */
function CiscoInstallLineTotal ($Instal,$TotalExt) {
Global $Instal;
$TotalExt = TotalExtension ( );
if ($TotalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($TotalExt <= 24 ) {
   return $Instal['1']['Price'] . "<br>";
   }
elseif ($TotalExt <= 48 ) {
   return $Instal['1']['Price'] * 2 . "<br>";
   }
elseif ($TotalExt >= 49 ) {
   return "Subject to Survey" . "<br>";
   }
}


/* Training */
function CiscoTrainLineTotal ($Train,$TotalExt) {
Global $Train;
$TotalExt = TotalExtension ( );
if ($TotalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($TotalExt <= 24 ) {
   return $Train['0']['Price'] . "<br>";
   }
elseif ($TotalExt <= 48 ) {
   return $Train['0']['Price'] * 2 . "<br>";
   }
elseif ($TotalExt >= 49 ) {
   return "Subject to Survey" . "<br>";
   }
}


/* Phone Total */
function CiscoPhoneTotal ( ) {
return CiscoBasPhoneLineTotal () + CiscoMidPhoneLineTotal () + CiscoExecPhoneLineTotal ();
}

/*
*----------------------------------
*      Cisco Hardware Total
*----------------------------------
*/
function CiscoHardTotal ( ) {
return CiscoTotal ( ) - (CiscoInstallLineTotal () + CiscoTrainLineTotal ()) ;
}

/*
*----------------------------------
*            Running Total
*----------------------------------
*/
function CiscoTotal ( ) {
return CiscoMainUnit () + CiscoISDN2LineTotal () + CiscoISDN30LineTotal () + CiscoDigExtLineTotal () + CiscoVoicemail () + CiscoPhoneTotal () + CiscoInstallLineTotal () + CiscoTrainLineTotal ();
}

/*----------*/
/* Samsung */
/*----------*/
/* Main Unit */
function SamMainUnit ($MainUnit) {
global $MainUnit;
return $MainUnit['2']['Price'] . "<br>";
}

/* Analogue Card */
function SamAnaLineTotal ($LineCard,$LinesAnalogue) {
global $LinesAnalogue;
global $LineCard;
if ($LinesAnalogue <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesAnalogue <= 8 ) {
   return $LineCard['5']['Price'] . "<br>";
   }
elseif ($LinesAnalogue <= 16 ) {
   return $LineCard['5']['Price'] * 2 . "<br>";
   }
elseif ($LinesAnalogue >= 17 ) {
   return "Please Call" . "<br>";
   }
}
/* Number Required */
function SamAnaNumReq ($LinesAnalogue) {
global $LinesAnalogue;
if ($LinesAnalogue <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesAnalogue <= 8 ) {
   return "1" . "<br>";
   }
elseif ($LinesAnalogue <= 16 ) {
   return "2" . "<br>";
   }
elseif ($LinesAnalogue >= 17 ) {
   return "Please Call" . "<br>";
   }
}


/* ISDN2 Card */
function SamISDN2LineTotal ($LineCard,$LinesISDN2) {
global $LinesISDN2;
global $LineCard;
if ($LinesISDN2 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN2 <= 8 ) {
   return $LineCard['6']['Price'] . "<br>";
   }
elseif ($LinesISDN2 <= 16 ) {
   return $LineCard['6']['Price'] * 2 . "<br>";
   }
elseif ($LinesISDN2 >= 17 ) {
   return "Please Call" . "<br>";
   }
}

/* Number Required */
function SamISDN2NumReq ($LinesISDN2) {
global $LinesISDN2;
if ($LinesISDN2 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN2 <= 8 ) {
   return "1" . "<br>";
   }
elseif ($LinesISDN2 <= 16 ) {
   return "2" . "<br>";
   }
elseif ($LinesISDN2 >= 17 ) {
   return "Please Call" . "<br>";
   }
}


/* ISDN30 Card */
function SamISDN30LineTotal ($LineCard,$LinesISDN30) {
global $LinesISDN30;
global $LineCard;
if ($LinesISDN30 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN30 <= 30 ) {
   return $LineCard['7']['Price'] . "<br>";
   }
elseif ($LinesISDN30 <= 60 ) {
   return $LineCard['7']['Price'] * 2 . "<br>";
   }
elseif ($LinesISDN30 >= 61 ) {
   return "Please Call" . "<br>";
   }
}
/* Number Required */
function SamISDN30NumReq ($LinesISDN30) {
global $LinesISDN30;
if ($LinesISDN30 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN30 <= 30 ) {
   return "1" . "<br>";
   }
elseif ($LinesISDN30 <= 60 ) {
   return "2" . "<br>";
   }
elseif ($LinesISDN30 >= 61 ) {
   return "Please Call" . "<br>";
   }
}

/* Digital Extension Card */
function SamDigExtLineTotal ($ExtCard,$DigitalExt) {
global $DigitalExt;
global $ExtCard;
if ($DigitalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($DigitalExt <= 8 ) {
   return $ExtCard['3']['Price'] . "<br>";
   }
elseif ($DigitalExt <= 16 ) {
   return $ExtCard['3']['Price'] * 2 . "<br>";
   }
elseif ($DigitalExt <= 24 ) {
   return $ExtCard['3']['Price'] * 3 . "<br>";
   }
elseif ($DigitalExt >= 25 ) {
   return "Please Call" . "<br>";
   }

}

/* Number Required */
function SamDigExtNumReq ($DigitalExt) {
global $DigitalExt;
if ($DigitalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($DigitalExt <= 8 ) {
   return "1" . "<br>";
   }
elseif ($DigitalExt <= 16 ) {
   return "2" . "<br>";
   }
elseif ($DigitalExt <= 24 ) {
   return "3" . "<br>";
   }
elseif ($DigitalExt >= 25 ) {
   return "Please Call" . "<br>";
   }
}


/* Analogue Extension Card */
function SamAnaExtLineTotal ($ExtCard,$AnalogueExt) {
global $AnalogueExt;
global $ExtCard;
if ($AnalogueExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($AnalogueExt <= 8 ) {
   return $ExtCard['4']['Price'] . "<br>";
   }
elseif ($AnalogueExt <= 16 ) {
   return $ExtCard['4']['Price'] * 2 . "<br>";
   }
elseif ($AnalogueExt <= 24 ) {
   return $ExtCard['4']['Price'] * 3 . "<br>";
   }
elseif ($AnalogueExt >= 25 ) {
   return "Please Call" . "<br>";
   }
}

/* Number Required */
function SamAnaExtNumReq ($AnalogueExt) {
global $AnalogueExt;
if ($AnalogueExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($AnalogueExt <= 8 ) {
   return "1" . "<br>";
   }
elseif ($AnalogueExt <= 16 ) {
   return "2" . "<br>";
   }
elseif ($AnalogueExt <= 24 ) {
   return "3" . "<br>";
   }
elseif ($AnalogueExt >= 25 ) {
   return "Please Call" . "<br>";
   }
}

/* Voicemail */
function SamVoicemail ($VoicemailPrice,$Voicemail) {
global $Voicemail;
global $VoicemailPrice;

if ($Voicemail == 1 ) {
return $VoicemailPrice['2']['Price'] . "<br>";
	}
else return "Not Required" . "<br>";
}

/* Basic Phone */
function SamBasPhoneLineTotal ($Phones,$BasicHand) {
global $BasicHand;
global $Phones;
if ($BasicHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $BasicHand * $Phones['6']['Price'] . "<br>";
}

/* Mid Range Phone */
function SamMidPhoneLineTotal ($Phones,$GeneralHand) {
global $GeneralHand;
global $Phones;
if ($GeneralHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $GeneralHand * $Phones['7']['Price'] . "<br>";
}


/* Executive Phone */
function SamExecPhoneLineTotal ($Phones,$ExecHand) {
global $ExecHand;
global $Phones;
if ($ExecHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $ExecHand * $Phones['8']['Price'] . "<br>";
}

/* Installation */
function SamInstallLineTotal ($Instal,$TotalExt) {
Global $Instal;
$TotalExt = TotalExtension ( );
if ($TotalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($TotalExt <= 10 ) {
   return $Instal['2']['Price'] . "<br>";
   }
elseif ($TotalExt <= 20 ) {
   return ($Instal['2']['Price'] / 2) * 3 . "<br>";
   }
elseif ($TotalExt <= 40 ) {
   return $Instal['2']['Price'] * 2 . "<br>";
   }
elseif ($TotalExt >= 41 ) {
   return "Subject to Survey" . "<br>";
   }
}


/* Training */
function SamTrainLineTotal ($Train,$TotalExt) {
Global $Train;
$TotalExt = TotalExtension ( );
if ($TotalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($TotalExt <= 20 ) {
   return $Train['2']['Price'] . "<br>";
   }
elseif ($TotalExt <= 30 ) {
   return ($Train['2']['Price'] / 2) * 3 . "<br>";
   }
elseif ($TotalExt >= 31 ) {
   return "Subject to Survey" . "<br>";
   }
}


/* Phone Total */
function SamPhoneTotal ( ) {
return SamBasPhoneLineTotal () + SamMidPhoneLineTotal () + SamExecPhoneLineTotal ();
}

/*
*----------------------------------
*      Samsung Hardware Total
*----------------------------------
*/
function SamHardTotal ( ) {
return SamTotal ( ) - (SamInstallLineTotal () + SamTrainLineTotal ()) ;
}

/*
*----------------------------------
*            Running Total
*----------------------------------
*/
function SamTotal ( ) {
return SamMainUnit () + SamAnaLineTotal () + SamISDN2LineTotal () + SamISDN30LineTotal () + SamAnaExtLineTotal () + SamDigExtLineTotal () + SamVoicemail () + SamPhoneTotal () + SamInstallLineTotal () + SamTrainLineTotal ();
}

echo html ();
?>

Link to comment
Share on other sites

Excellent works, thanks sooo much.

 

One last thing and ill leave you all alone :P :  - If I then wanted to call html () , for instance as the body of an email, would the functions within html () display as outputs or would it just quote the text html () ????

 

Thanks for everybodys help on this!

Link to comment
Share on other sites

Sorry im not making much sense, but would something like this:

 

<?php
require('process.php');
//define the receiver of the email
$to = 'youraddress@example.com';
//define the subject of the email
$subject = 'Test HTML email'; 
//create a boundary string. It must be unique 
//so we use the MD5 algorithm to generate a random hash
$random_hash = md5(date('r', time())); 
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com";
//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; 
//define the body of the message.
ob_start(); //Turn on output buffering
?>
--PHP-alt-<?php echo $random_hash; ?>  
Content-Type: text/plain; charset="iso-8859-1" 
Content-Transfer-Encoding: 7bit

Hello World!!! 
This is simple text email message. 

--PHP-alt-<?php echo $random_hash; ?>  
Content-Type: text/html; charset="iso-8859-1" 
Content-Transfer-Encoding: 7bit

<?php $html = function html (); ?>

<?php echo $html; ?>

--PHP-alt-<?php echo $random_hash; ?>--
<?
//copy current buffer contents into $message variable and delete current output buffer
$message = ob_get_clean();
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
echo $mail_sent ? "Mail sent" : "Mail failed";
?>

 

would the body of the email ($html) be the same as it displays in the browser?

 

Cheers,

Link to comment
Share on other sites

This sends the mail, however resets all the data apart from MainUnit () to 'Not Required' when the mail is received - any ideas?

 

Mail Script:

<?php
require('process-new.php');
//define the receiver of the email
$to = $_POST['Email'];
//define the subject of the email
$subject = 'Online Quote from Flip Solutions'; 
//create a boundary string. It must be unique 
//so we use the MD5 algorithm to generate a random hash
$random_hash = md5(date('r', time())); 
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: quotingtool@flipsolutions.co.uk\r\nReply-To: webmaster@example.com";
//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; 
//define the body of the message.
ob_start(); //Turn on output buffering
?>
--PHP-alt-<?php echo $random_hash; ?>  
Content-Type: text/plain; charset="iso-8859-1" 
Content-Transfer-Encoding: 7bit

This email requires HTML to be turned on, please enable this and resend the email! 

--PHP-alt-<?php echo $random_hash; ?>  
Content-Type: text/html; charset="iso-8859-1" 
Content-Transfer-Encoding: 7bit

<?php echo html(); ?>

--PHP-alt-<?php echo $random_hash; ?>--
<?
//copy current buffer contents into $message variable and delete current output buffer
$message = ob_get_clean();
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
echo $mail_sent ? "Mail sent" : "Mail failed";
?>

 

Process-new script

<?php
/* Avaya - From Form*/
$LinesAnalogue = $_POST['LinesAnalogue'];
$LinesISDN2 = $_POST['LinesISDN2'];
$LinesISDN30 = $_POST['LinesISDN30'];
$DigitalExt = $_POST['DigitalExt'];
$AnalogueExt = $_POST['AnalogueExt'];
$Voicemail = $_POST['Voicemail'];
$BasicHand = $_POST['BasicHand'];
$GeneralHand = $_POST['GeneralHand'];
$ExecHand = $_POST['ExecHand'];

/* Main Unit */
$MainUnit = array(
   array('Unit' => 'Avaya', 'Price' => '406'),
                array('Unit' => 'Cisco', 'Price' => '1500'),
                array('Unit' => 'Samsung', 'Price' => '995')
                );

/* Line Cards */
$LineCard = array(
                array('Card' => 'Analogue Card/s', 'Price' => '232'),
                array('Card' => 'ISDN2e Card/s', 'Price' => '275'),
                array('Card' => 'ISDN30e Card/s', 'Price' => '530'),
			array('Card' => 'Cisco ISDN2e Card/s', 'Price' => '200'),
                array('Card' => 'Cisco ISDN30e Card/s', 'Price' => '600'),
			array('Card' => 'Samsung Analogue Card/s', 'Price' => '345'),
			array('Card' => 'Samsung ISDN2e Card/s', 'Price' => '395'),
                array('Card' => 'Samsund ISDN30e Card/s', 'Price' => '530')
                );

/* Extension Cards */
$ExtCard = array(
                array('Card' => 'Digital Extension Card/s', 'Price' => '319'),
                array('Card' => 'Analogue Extension Card/s', 'Price' => '145'),
			array('Card' => 'Cisco Switch', 'Price' => '1200'),
			array('Card' => 'Samsung Digital Extension Card/s', 'Price' => '295'),
                array('Card' => 'Samsung Analogue Extension Card/s', 'Price' => '295'),
                );

/* Voicemail */
$VoicemailPrice =  array(
                array('Card' => 'Avaya', 'Price' => '500'),
                array('Card' => 'Cisco', 'Price' => '600'),
			array('Card' => 'Samsung', 'Price' => '100'),
			);

/* Handsets */
$Phones = array(
                array('Phone' => 'Basic Model/s', 'Price' => '72'),
                array('Phone' => 'General Model/s', 'Price' => '152'),
                array('Phone' => 'Executive Model/s', 'Price' => '218'),
			array('Phone' => 'Cisco Basic Model/s', 'Price' => '135'),
                array('Phone' => 'Cisco General Model/s', 'Price' => '192'),
                array('Phone' => 'Cisco Executive Model/s', 'Price' => '297'),
			array('Phone' => 'Samsung Basic Model/s', 'Price' => '100'),
                array('Phone' => 'Samsung General Model/s', 'Price' => '150'),
                array('Phone' => 'Samsung Executive Model/s', 'Price' => '230')
                );

/* Extras */
$Instal = array(
                array('Phone' => 'Avaya', 'Price' => '400'),
                array('Phone' => 'Cisco', 'Price' => '1200'),
                array('Phone' => 'Samsung', 'Price' => '400')
			);
$Train =  array(
                array('Phone' => 'Avaya', 'Price' => '400'),
                array('Phone' => 'Cisco', 'Price' => '500'),
                array('Phone' => 'Samsung', 'Price' => '400')
			);

function html () { 
return "<html>
<body>
<table width=\"57%\" align=\"center\" cellpadding=5 class=bordered>
  <tr>
    <th><div align=\"center\"><strong>Total Lines Required </strong></div></th>
    <th><div align=\"center\"><strong>Total Extensions Required </strong></div></th>
    <th><div align=\"center\"><strong>Total Phones Required </strong></div></th>
  </tr>
  <tr>
    <td><div align=\"center\">". NumLines () ."</div></td>
    <td> <div align=\"center\">". TotalExtension () ."</div></td>
    <td><div align=\"center\">". NumPhones () ."</div></td>
  </tr>
</table>
<br />
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td width=\"33%\"><table width=\"99%\" align=\"left\" cellpadding=5 class=bordered>
<tr>
<th colspan=4><img src=\"http://www.flipsolutions.co.uk/images/quoting/avaya.png\" width=\"120\" height=\"49\"></th></tr>
      <tr>
        <th width=\"34%\"><div align=\"center\"><strong>Part </strong></div></th>
        <th width=\"18%\"><div align=\"center\"><strong>Unit Price </strong></div></th>
        <th width=\"24%\"><div align=\"center\"><strong>No. Required </strong></div></th>
        <th width=\"24%\"><div align=\"center\"><strong>Line Total </strong></div></th>
      </tr>
      <tr>
        <td><div align=\"center\">Main Unit </div></td>
        <td><div align=\"center\">£406.00</div></td>
        <td><div align=\"center\">1</div></td>
        <td><div align=\"center\">£". MainUnit () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Analogue Card </div></td>
        <td><div align=\"center\">£232.00</div></td>
        <td><div align=\"center\">". AnaNumReq () ."</div></td>
        <td><div align=\"center\">£". AnaLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">ISDN2e Card </div></td>
        <td><div align=\"center\">£275.00</div></td>
        <td><div align=\"center\">". ISDN2NumReq () ."</div></td>
        <td><div align=\"center\">£". ISDN2LineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">ISDN30e Card </div></td>
        <td><div align=\"center\">£530.00</div></td>
        <td><div align=\"center\">". ISDN30NumReq () ."</div></td>
        <td><div align=\"center\">£". ISDN30LineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Digital Extension Card </div></td>
        <td><div align=\"center\">£319.00</div></td>
        <td><div align=\"center\">". DigExtNumReq () ."</div></td>
        <td><div align=\"center\">£". DigExtLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Analogue Extension Card </div></td>
        <td><div align=\"center\">£145.00</div></td>
        <td><div align=\"center\">". AnaExtNumReq () ."</div></td>
        <td><div align=\"center\">£". AnaExtLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Voicemail</div></td>
        <td><div align=\"center\">£500.00</div></td>
        <td><div align=\"center\">1</div></td>
        <td><div align=\"center\">". Voicemail () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Basic Handset </div></td>
        <td><div align=\"center\">£72.00</div></td>
        <td><div align=\"center\">". BasPhoneLineNum () ."</div></td>
        <td><div align=\"center\">£". BasPhoneLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\"><div class=\"gallerycontainer\">
<a class=\"thumbnail\" href=\"#thumb\"><img src=\"http://www.flipsolutions.co.uk/images/quoting/5402.png\" width=\"98px\" height=\"81px\" border=\"0\" /><span><img src=\"http://www.flipsolutions.co.uk/images/quoting/5402_large.png\" /><br />Avaya 5402 Terminal</span></a>
</div></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Mid Range Handset </div></td>
        <td><div align=\"center\">£152.00</div></td>
        <td><div align=\"center\">". MidPhoneLineNum () ."</div></td>
        <td><div align=\"center\">£". MidPhoneLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\"><div class=\"gallerycontainer\">
<a class=\"thumbnail\" href=\"#thumb\"><img src=\"http://www.flipsolutions.co.uk/images/quoting/5410.png\" width=\"98px\" height=\"81px\" border=\"0\" /><span><img src=\"http://www.flipsolutions.co.uk/images/quoting/5410_large.png\" /><br />Avaya 5410 Terminal</span></a>
</div></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Executive Handset </div></td>
        <td><div align=\"center\">£218.00</div></td>
        <td><div align=\"center\">". ExecPhoneLineNum () ."</div></td>
        <td><div align=\"center\">£". ExecPhoneLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\"><div class=\"gallerycontainer\">
<a class=\"thumbnail\" href=\"#thumb\"><img src=\"http://www.flipsolutions.co.uk/images/quoting/5420.png\" width=\"98px\" height=\"81px\" border=\"0\" /><span><img src=\"http://www.flipsolutions.co.uk/images/quoting/5420_large.png\" /><br />Avaya 5420 Terminal</span></a>
</div></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
      </tr>
      <tr>
        <td><div align=\"center\"><strong>Hardware Total </strong></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><b><div align=\"center\">£". HardTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Installation</div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\">£". InstallLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Training</div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\">£". TrainLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><b><div align=\"center\">Total</div></b></td>
        <td><b><div align=\"center\">£". Total () ."</div></b></td>
      </tr>
    </table></td>
    <td width=\"33%\"><table width=\"99%\" align=\"left\" cellpadding=5 class=bordered>
<tr>
<th colspan=4><img src=\"http://www.flipsolutions.co.uk/images/quoting/cisco.png\" width=\"89\" height=\"49\"></th></tr>
      <tr>
        <th width=\"34%\"><div align=\"center\"><strong>Part </strong></div></th>
        <th width=\"18%\"><div align=\"center\"><strong>Unit Price </strong></div></th>
        <th width=\"24%\"><div align=\"center\"><strong>No. Required </strong></div></th>
        <th width=\"24%\"><div align=\"center\"><strong>Line Total </strong></div></th>
      </tr>
      <tr>
        <td><div align=\"center\">Main Unit </div></td>
        <td><div align=\"center\">£1,500.00</div></td>
        <td><div align=\"center\">1</div></td>
        <td><div align=\"center\">£". CiscoMainUnit () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">ISDN2e Card </div></td>
        <td><div align=\"center\">£200.00</div></td>
        <td><div align=\"center\">". CiscoISDN2NumReq () ."</div></td>
        <td><div align=\"center\">£". CiscoISDN2LineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">ISDN30e Card </div></td>
        <td><div align=\"center\">£600.00</div></td>
        <td><div align=\"center\">". CiscoISDN30NumReq () ."</div></td>
        <td><div align=\"center\">£". CiscoISDN30LineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Switch</div></td>
        <td><div align=\"center\">£1,200.00</div></td>
        <td><div align=\"center\">". CiscoDigExtNumReq () ."</div></td>
        <td><div align=\"center\">£". CiscoDigExtLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Voicemail</div></td>
        <td><div align=\"center\">£600.00</div></td>
        <td><div align=\"center\">1</div></td>
        <td><div align=\"center\">". CiscoVoicemail () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Basic Handset </div></td>
        <td><div align=\"center\">£135.00</div></td>
        <td><div align=\"center\">". BasPhoneLineNum () ."</div></td>
        <td><div align=\"center\">£". CiscoBasPhoneLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\"><div class=\"gallerycontainer\">
<a class=\"thumbnail\" href=\"#thumb\"><img src=\"http://www.flipsolutions.co.uk/images/quoting/7906.png\" width=\"98px\" height=\"81px\" border=\"0\" /><span><img src=\"http://www.flipsolutions.co.uk/images/quoting/7906_large.png\" /><br />Cisco 7906G Handset</span></a>
</div></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Mid Range Handset </div></td>
        <td><div align=\"center\">£192.00</div></td>
        <td><div align=\"center\">". MidPhoneLineNum () ."</div></td>
        <td><div align=\"center\">£". CiscoMidPhoneLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\"><div class=\"gallerycontainer\">
<a class=\"thumbnail\" href=\"#thumb\"><img src=\"http://www.flipsolutions.co.uk/images/quoting/7941.png\" width=\"98px\" height=\"81px\" border=\"0\" /><span><img src=\"http://www.flipsolutions.co.uk/images/quoting/7941_large.png\" /><br />Cisco 7941G Handset</span></a>
</div></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Executive Handset </div></td>
        <td><div align=\"center\">£297.00</div></td>
        <td><div align=\"center\">". ExecPhoneLineNum () ."</div></td>
        <td><div align=\"center\">£". CiscoExecPhoneLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\"><div class=\"gallerycontainer\">
<a class=\"thumbnail\" href=\"#thumb\"><img src=\"http://www.flipsolutions.co.uk/images/quoting/7970.png\" width=\"98px\" height=\"81px\" border=\"0\" /><span><img src=\"http://www.flipsolutions.co.uk/images/quoting/7970_large.png\" /><br />Cisco 7970G Handset</span></a>
</div></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
      </tr>
      <tr>
        <td><div align=\"center\"><strong>Hardware Total </strong></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><b><div align=\"center\">£". CiscoHardTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Installation</div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\">£". CiscoInstallLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Training</div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\">£". CiscoTrainLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><b><div align=\"center\">Total</div></b></td>
        <td><b><div align=\"center\">£". CiscoTotal () ."</div></b></td>
      </tr>
    </table></td>
    <td width=\"33%\"><table width=\"99%\" align=\"right\" cellpadding=5 class=bordered>
<tr>
<th colspan=4><img src=\"http://www.flipsolutions.co.uk/images/quoting/samsung.png\" width=\"114\" height=\"49\"></th></tr>
      <tr>
        <th width=\"34%\"><div align=\"center\"><strong>Part </strong></div></th>
        <th width=\"18%\"><div align=\"center\"><strong>Unit Price </strong></div></th>
        <th width=\"24%\"><div align=\"center\"><strong>No. Required </strong></div></th>
        <th width=\"24%\"><div align=\"center\"><strong>Line Total </strong></div></th>
      </tr>
      <tr>
        <td><div align=\"center\">Main Unit </div></td>
        <td><div align=\"center\">£995.00</div></td>
        <td><div align=\"center\">1</div></td>
        <td><div align=\"center\">£". SamMainUnit () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Analogue Card </div></td>
        <td><div align=\"center\">£345.00</div></td>
        <td><div align=\"center\">". SamAnaNumReq () ."</div></td>
        <td><div align=\"center\">£". SamAnaLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">ISDN2e Card </div></td>
        <td><div align=\"center\">£395.00</div></td>
        <td><div align=\"center\">". SamISDN2NumReq () ."</div></td>
        <td><div align=\"center\">£". SamISDN2LineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">ISDN30e Card </div></td>
        <td><div align=\"center\">£530.00</div></td>
        <td><div align=\"center\">". SamISDN30NumReq () ."</div></td>
        <td><div align=\"center\">£". SamISDN30LineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Digital Extension Card </div></td>
        <td><div align=\"center\">£295.00</div></td>
        <td><div align=\"center\">". SamDigExtNumReq () ."</div></td>
        <td><div align=\"center\">£". SamDigExtLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Analogue Extension Card </div></td>
        <td><div align=\"center\">£295.00</div></td>
        <td><div align=\"center\">". SamAnaExtNumReq () ."</div></td>
        <td><div align=\"center\">£". SamAnaExtLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Voicemail</div></td>
        <td><div align=\"center\">£1,000.00</div></td>
        <td><div align=\"center\">1</div></td>
        <td><div align=\"center\">". SamVoicemail () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Basic Handset </div></td>
        <td><div align=\"center\">£100.00</div></td>
        <td><div align=\"center\">". BasPhoneLineNum () ."</div></td>
        <td><div align=\"center\">£". SamBasPhoneLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\"><div class=\"gallerycontainer\">
<a class=\"thumbnail\" href=\"#thumb\"><img src=\"http://www.flipsolutions.co.uk/images/quoting/5007s.png\" width=\"98px\" height=\"81px\" border=\"0\" /><span><img src=\"http://www.flipsolutions.co.uk/images/quoting/5007s_large.png\" /><br />Samsung DS-5007s Handset</span></a>
</div></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Mid Range Handset </div></td>
        <td><div align=\"center\">£150.00</div></td>
        <td><div align=\"center\">". MidPhoneLineNum () ."</div></td>
        <td><div align=\"center\">£". SamMidPhoneLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\"><div class=\"gallerycontainer\">
<a class=\"thumbnail\" href=\"#thumb\"><img src=\"http://www.flipsolutions.co.uk/images/quoting/5014s.png\" width=\"98px\" height=\"81px\" border=\"0\" /><span><img src=\"http://www.flipsolutions.co.uk/images/quoting/5014s_large.png\" /><br />Samsung DS-5014s Handset</span></a>
</div></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Executive Handset </div></td>
        <td><div align=\"center\">£230.00</div></td>
        <td><div align=\"center\">". ExecPhoneLineNum () ."</div></td>
        <td><div align=\"center\">£". SamExecPhoneLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\"><div class=\"gallerycontainer\">
<a class=\"thumbnail\" href=\"#thumb\"><img src=\"http://www.flipsolutions.co.uk/images/quoting/5038s.png\" width=\"98px\" height=\"81px\" border=\"0\" /><span><img src=\"http://www.flipsolutions.co.uk/images/quoting/5038s_large.png\" /><br />Samsung DS-5038s Handset</span></a>
</div></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
      </tr>
      <tr>
        <td><div align=\"center\"><strong>Hardware Total </strong></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><b><div align=\"center\">£". SamHardTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Installation</div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\">£". SamInstallLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\">Training</div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\">£". SamTrainLineTotal () ."</div></td>
      </tr>
      <tr>
        <td><div align=\"center\"></div></td>
        <td><div align=\"center\"></div></td>
        <td><b><div align=\"center\">Total</div></b></td>
        <td><b><div align=\"center\">£". SamTotal () ."</div></b></td>
      </tr>
    </table></td>
  </tr>
</table>
<p> </p>
</table>
</body> 
</html>";
}

/*----------*/
/* Avaya */
/*----------*/
/* Main Unit */
function MainUnit ($MainUnit) {
global $MainUnit;
return $MainUnit['0']['Price'] . "<br>";
}

/* Analogue Card */
function AnaLineTotal ($LineCard,$LinesAnalogue) {
global $LinesAnalogue;
global $LineCard;
if ($LinesAnalogue <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesAnalogue <= 5 ) {
   return $LineCard['0']['Price'] . "<br>";
   }
elseif ($LinesAnalogue <= 8 ) {
   return $LineCard['0']['Price'] * 2 . "<br>";
   }
elseif ($LinesAnalogue <= 12 ) {
   return $LineCard['0']['Price'] * 3 . "<br>";
   }
elseif ($LinesAnalogue >= 13 ) {
   return "Please Call" . "<br>";
   }
}
/* Number Required */
function AnaNumReq ($LinesAnalogue) {
global $LinesAnalogue;
if ($LinesAnalogue <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesAnalogue <= 5 ) {
   return "1" . "<br>";
   }
elseif ($LinesAnalogue <= 8 ) {
   return "2" . "<br>";
   }
elseif ($LinesAnalogue <= 12 ) {
   return "3" . "<br>";
   }
elseif ($LinesAnalogue >= 13 ) {
   return "Please Call" . "<br>";
   }
}


/* ISDN2 Card */
function ISDN2LineTotal ($LineCard,$LinesISDN2) {
global $LinesISDN2;
global $LineCard;
if ($LinesISDN2 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN2 <= 8 ) {
   return $LineCard['1']['Price'] . "<br>";
   }
elseif ($LinesISDN2 <= 16 ) {
   return $LineCard['1']['Price'] * 2 . "<br>";
   }
elseif ($LinesISDN2 >= 17 ) {
   return "Please Call" . "<br>";
   }
}

/* Number Required */
function ISDN2NumReq ($LinesISDN2) {
global $LinesISDN2;
if ($LinesISDN2 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN2 <= 8 ) {
   return "1" . "<br>";
   }
elseif ($LinesISDN2 <= 16 ) {
   return "2" . "<br>";
   }
elseif ($LinesISDN2 >= 17 ) {
   return "Please Call" . "<br>";
   }
}


/* ISDN30 Card */
function ISDN30LineTotal ($LineCard,$LinesISDN30) {
global $LinesISDN30;
global $LineCard;
if ($LinesISDN30 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN30 <= 30 ) {
   return $LineCard['2']['Price'] . "<br>";
   }
elseif ($LinesISDN30 <= 60 ) {
   return $LineCard['2']['Price'] * 2 . "<br>";
   }
elseif ($LinesISDN30 >= 61 ) {
   return "Please Call" . "<br>";
   }
}
/* Number Required */
function ISDN30NumReq ($LinesISDN30) {
global $LinesISDN30;
if ($LinesISDN30 <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($LinesISDN30 <= 30 ) {
   return "1" . "<br>";
   }
elseif ($LinesISDN30 <= 60 ) {
   return "2" . "<br>";
   }
elseif ($LinesISDN30 >= 61 ) {
   return "Please Call" . "<br>";
   }
}


/* Total Number of Lines */
function NumLines ($LinesAnalogue,$LinesISDN2,$LinesISDN30) {
global $LinesAnalogue;
global $LinesISDN2;
global $LinesISDN30;
return $LinesAnalogue + $LinesISDN2 + $LinesISDN30;
} 

/* Digital Extension Card */
function DigExtLineTotal ($ExtCard,$DigitalExt) {
global $DigitalExt;
global $ExtCard;
if ($DigitalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($DigitalExt <= 8 ) {
   return $ExtCard['0']['Price'] . "<br>";
   }
elseif ($DigitalExt <= 16 ) {
   return $ExtCard['0']['Price'] * 2 . "<br>";
   }
elseif ($DigitalExt <= 24 ) {
   return $ExtCard['0']['Price'] * 3 . "<br>";
   }
elseif ($DigitalExt >= 25 ) {
   return "Please Call" . "<br>";
   }

}

/* Number Required */
function DigExtNumReq ($DigitalExt) {
global $DigitalExt;
if ($DigitalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($DigitalExt <= 8 ) {
   return "1" . "<br>";
   }
elseif ($DigitalExt <= 16 ) {
   return "2" . "<br>";
   }
elseif ($DigitalExt <= 24 ) {
   return "3" . "<br>";
   }
elseif ($DigitalExt >= 25 ) {
   return "Please Call" . "<br>";
   }
}


/* Analogue Extension Card */
function AnaExtLineTotal ($ExtCard,$AnalogueExt) {
global $AnalogueExt;
global $ExtCard;
if ($AnalogueExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($AnalogueExt <= 4 ) {
   return $ExtCard['1']['Price'] . "<br>";
   }
elseif ($AnalogueExt <= 8 ) {
   return $ExtCard['1']['Price'] * 2 . "<br>";
   }
elseif ($AnalogueExt <= 12 ) {
   return $ExtCard['1']['Price'] * 3 . "<br>";
   }
elseif ($AnalogueExt >= 13 ) {
   return "Please Call" . "<br>";
   }
}

/* Number Required */
function AnaExtNumReq ($AnalogueExt) {
global $AnalogueExt;
if ($AnalogueExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($AnalogueExt <= 4 ) {
   return "1" . "<br>";
   }
elseif ($AnalogueExt <= 8 ) {
   return "2" . "<br>";
   }
elseif ($AnalogueExt <= 12 ) {
   return "3" . "<br>";
   }
elseif ($AnalogueExt >= 13 ) {
   return "Please Call" . "<br>";
   }
}


/* Total Extensions */

function TotalExtension ($DigitalExt,$AnalogueExt) {
global $DigitalExt;
global $AnalogueExt;

return $DigitalExt + $AnalogueExt;
}

/* echo "Total Number of Extensions : ";
echo TotalExtension ( ) . "<br>"; */

/* Voicemail */
function Voicemail ($VoicemailPrice,$Voicemail) {
global $Voicemail;
global $VoicemailPrice;

if ($Voicemail == 1 ) {
return $VoicemailPrice['0']['Price'] . "<br>";
	}
else return "Not Required" . "<br>";
}

/* Basic Phone */
function BasPhoneLineTotal ($Phones,$BasicHand) {
global $BasicHand;
global $Phones;
if ($BasicHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $BasicHand * $Phones['0']['Price'] . "<br>";
}
/* Basic Phone Number*/
function BasPhoneLineNum ($Phones,$BasicHand) {
global $BasicHand;
global $Phones;
if ($BasicHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $BasicHand . "<br>";
}

/* Mid Range Phone */
function MidPhoneLineTotal ($Phones,$GeneralHand) {
global $GeneralHand;
global $Phones;
if ($GeneralHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $GeneralHand * $Phones['1']['Price'] . "<br>";
}
/* Mid Range Phone Number*/
function MidPhoneLineNum ($Phones,$GeneralHand) {
global $GeneralHand;
global $Phones;
if ($GeneralHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $GeneralHand . "<br>";
}

/* Executive Phone */
function ExecPhoneLineTotal ($Phones,$ExecHand) {
global $ExecHand;
global $Phones;
if ($ExecHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $ExecHand * $Phones['2']['Price'] . "<br>";
}
/* Executive Phone Number*/
function ExecPhoneLineNum ($Phones,$ExecHand) {
global $ExecHand;
global $Phones;
if ($ExecHand <= 0 ) {
   return "Not Required" . "<br>";
   }
else return $ExecHand . "<br>";
}

/* Total Number of Phones */
function NumPhones ($BasicHand,$GeneralHand,$ExecHand) {
global $BasicHand;
global $GeneralHand;
global $ExecHand;
return $BasicHand + $GeneralHand + $ExecHand;
}

/* Installation */
function InstallLineTotal ($Instal,$TotalExt) {
Global $Instal;
$TotalExt = TotalExtension ( );
if ($TotalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($TotalExt <= 10 ) {
   return $Instal['0']['Price'] . "<br>";
   }
elseif ($TotalExt <= 20 ) {
   return ($Instal['0']['Price'] / 2) * 3 . "<br>";
   }
elseif ($TotalExt <= 40 ) {
   return $Instal['0']['Price'] * 2 . "<br>";
   }
elseif ($TotalExt >= 41 ) {
   return "Subject to Survey" . "<br>";
   }
}


/* Training */
function TrainLineTotal ($Train,$TotalExt) {
Global $Train;
$TotalExt = TotalExtension ( );
if ($TotalExt <= 0 ) {
   return "Not Required" . "<br>";
   }
elseif ($TotalExt <= 20 ) {
   return $Train['0']['Price'] . "<br>";
   }
elseif ($TotalExt <= 30 ) {
   return ($Train['0']['Price'] / 2) * 3 . "<br>";
   }
elseif ($TotalExt >= 31 ) {
   return "Subject to Survey" . "<br>";
   }
}


/* Phone Total */
function PhoneTotal ( ) {
return BasPhoneLineTotal () + MidPhoneLineTotal () + ExecPhoneLineTotal ();
}

/*
*----------------------------------
*      Avaya Hardware Total
*----------------------------------
*/
function HardTotal ( ) {
return Total ( ) - (InstallLineTotal () + TrainLineTotal ()) ;
}

/*
*----------------------------------
*            Running Total
*----------------------------------
*/
function Total ( ) {
return MainUnit () + AnaLineTotal () + ISDN2LineTotal () + ISDN30LineTotal () + AnaExtLineTotal () + DigExtLineTotal () + Voicemail () + PhoneTotal () + InstallLineTotal () + TrainLineTotal ();
}

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.