<?php


$array_cols2=array(id_col,domain,invoice_type,package_type,domain_type,customer_id,ref_no,description,facebook,website,domain,breakup_type);

$tdsettings2=array(
	'table'=>master,
	'id_col'=>id_col,
	'ref_value'=>routine_invoice_alias,
	'where_col'=>id_col,
	'fields_array'=>$array_cols2,
	'where_value'=>$id,
	'echo'=>'0',
	'status_vaue'=>'Active',
	'order'=>'DESC',
	'type'=>'wherecol_ref_status');

$tdload2=db_fetch($tdsettings2);

foreach($tdload2 as $td_item2){

$invoice_type=$td_item2[invoice_type];
$features1=$td_item2[description];
$this_total=$td_item2[facebook];
$discount_percentage=$td_item2[website];
$phases=$td_item2[breakup_type];
$package_type=$td_item2[package_type];
$customer_id=$td_item2[customer_id];
$ref_no=$td_item2[ref_no];

}

$discount_percentage2=$discount_percentage/100;
$discounted1=$discount_percentage2*$this_total;
$discounted2=$this_total-$discounted1;
$discount_price=$discounted2;


$phase_type=db_ref(sub_table2,id_col,$phases,sub_table_url4);

if($phase_type=="two"){

$phase1_title=db_ref(sub_table2,id_col,$phases,sub_table_url2);	
$phase2_title=db_ref(sub_table2,id_col,$phases,sub_table_url3);
$phase1=db_ref(sub_table2,id_col,$phases,sub_table_url6);	
$phase2=db_ref(sub_table2,id_col,$phases,sub_table_url7);	

$phase1_value=$phase1/100;
$phase1_amount=$discount_price*$phase1_value;

$phase2_value=$phase2/100;
$phase2_amount=$discount_price*$phase2_value;

$phase_text='
<table width="660" border="0" align="center" cellpadding="2" cellspacing="0">
  <tr>&nbsp;<br /></tr>
  <tr>
    <td width="290" align="center">'.$phase1_title.'</td>
    <td width="370" align="center">'.$unit.'&nbsp;'.number_format($phase1_amount).'*</td>
  </tr>
  <tr>
    <td width="290" align="center">'.$phase2_title.'</td>
    <td width="370" align="center">'.$unit.'&nbsp;'.number_format($phase2_amount).'*</td>
  </tr>
</table>

';

	
}

if($phase_type=="three"){

$phase1_title=db_ref(sub_table2,id_col,$phases,sub_table_url2);	
$phase2_title=db_ref(sub_table2,id_col,$phases,sub_table_url5);
$phase3_title=db_ref(sub_table2,id_col,$phases,sub_table_url3);
$phase1=db_ref(sub_table2,id_col,$phases,sub_table_url6);	
$phase2=db_ref(sub_table2,id_col,$phases,sub_table_url7);	
$phase3=db_ref(sub_table2,id_col,$phases,sub_table_url8);	

$phase1_value=$phase1/100;
$phase1_amount=$discount_price*$phase1_value;

$phase2_value=$phase2/100;
$phase2_amount=$discount_price*$phase2_value;

$phase3_value=$phase3/100;
$phase3_amount=$discount_price*$phase3_value;

$phase_text='
<table width="660" border="0" align="center" cellpadding="2" cellspacing="0">
  <tr>&nbsp;<br /></tr>
  <tr>
    <td width="290" align="center">'.$phase1_title.'</td>
    <td width="370" align="center">'.$unit.'&nbsp;'.number_format($phase1_amount).'*</td>
  </tr>
  <tr>
    <td width="290" align="center">'.$phase2_title.'</td>
    <td width="370" align="center">'.$unit.'&nbsp;'.number_format($phase2_amount).'*</td>
  </tr>
  <tr>
    <td width="290" align="center">'.$phase3_title.'</td>
    <td width="370" align="center">'.$unit.'&nbsp;'.number_format($phase3_amount).'*</td>
  </tr>
</table>

';

	
}








//exit();

$package_title=db_ref(sub_table2,id_col,$package_type,sub_table_title);
$amount=db_ref(sub_table2,id_col,$package_type,sub_table_url2);

$amount2=$amount/2;

$invoice_title=db_ref(sub_table2,id_col,$invoice_type,sub_table_title);

$array_cols=array(id_col,company,person,address,city,country);

$tdsettings=array(
	'table'=>master,
	'id_col'=>id_col,
	'ref_value'=>routine_customer_alias,
	'where_col'=>id_col,
	'fields_array'=>$array_cols,
	'where_value'=>$customer_id,
	'echo'=>'0',
	'status_vaue'=>'Active',
	'order'=>'DESC',
	'type'=>'wherecol_ref_status');

$tdload=db_fetch($tdsettings);

foreach($tdload as $td_item){
	
$person_name=strtoupper($td_item[person]);	
$company_name=strtoupper($td_item[company]);	
$address=strtoupper($td_item[address]);	
$city_name=$td_item[city];
$country=$td_item[country];
	
}

$city_name=strtoupper($city_name);
$country=strtoupper($country);

$dated1=date("l F j, Y");
$dte = strtotime("+7 day");
$dated2= date("l F j, Y", $dte);

//$tax_note="*5 % General Sales Tax apllies to all purchases.";


?>