Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php include "db-connect.php"; //ini_set('display_errors','1'); //error_reporting(E_AL..

Decoded Output download

<?php 
include "db-connect.php"; 
//ini_set('display_errors','1'); 
//error_reporting(E_ALL); 
session_start(); 
$uid=$_SESSION['uid']; 
 
$query = "select * from it1_ay2018.personal p LEFT JOIN it1_ay2018.filing_status fs on p.uid = fs.uid where p.uid='$uid'"; 
$personal =mysqli_query($dbcon,$query); 
$row_personal = mysqli_fetch_array($personal); 
$itr1 .= '<?xml version="1.0" encoding="UTF-8"?><ns3:ITR xmlns:ns3="http://incometaxindiaefiling.gov.in/main" xmlns="http://incometaxindiaefiling.gov.in/master" xmlns:ns2="http://incometaxindiaefiling.gov.in/ITR1">'.PHP_EOL;  
 $itr1 .= "<ns2:ITR1>".PHP_EOL; 
 $itr1 .="<CreationInfo>".PHP_EOL; 
 $itr1 .= '<SWVersionNo>1.1</SWVersionNo>'.PHP_EOL; 
 $itr1 .= '<SWCreatedBy>SW10001472</SWCreatedBy>'.PHP_EOL; 
 $itr1 .= '<XMLCreatedBy>SW10001472</XMLCreatedBy>'.PHP_EOL; 
 $itr1 .= '<XMLCreationDate>'.date("Y-m-d").'</XMLCreationDate>'.PHP_EOL; 
 $itr1 .= '<IntermediaryCity>Delhi</IntermediaryCity>'.PHP_EOL; 
 $key = 'HjV9erXxix5M5Pk'; 
$data = 'The quick brown fox jumps over the lazy dog'; 
$digest = OpenSSL::Digest.new('sha256_HMAC'); 
$sig = OpenSSL::HMAC.digest($digest, $key, $data, 2226); 
$sig1 = OpenSSL::HMAC.hexdigest($digest, $key, $data, 2226); 
$sig2 = hex2bin($sig1); 
$sig3 = base64_encode($sig2); 
$itr1 .= '<Digest>'.$sig3.'</Digest>'.PHP_EOL; 
/* $string = $final_xml_string; 
$value = hash_pbkdf2('sha256', 'HjV9erXxix5M5Pk', $string, 2226); 
$sig2 = hex2bin($value); 
$sig3 = base64_encode($sig2); */ 
//$itr1 .= '<Digest>'.$sig3.'</Digest>'.PHP_EOL; 
 $itr1 .= '</CreationInfo>'.PHP_EOL; 
 $itr1 .= '<Form_ITR1>'.PHP_EOL; 
 $itr1 .= '<FormName>ITR-1</FormName>'.PHP_EOL; 
 $itr1 .= '<Description>For Indls having Income from Salary, Pension, family pension and Interest</Description>'.PHP_EOL; 
 $itr1 .= '<AssessmentYear>2017</AssessmentYear>'.PHP_EOL; 
 $itr1 .= '<SchemaVer>V1.0</SchemaVer>'.PHP_EOL; 
 $itr1 .= '<FormVer>Ver1.0</FormVer>'.PHP_EOL; 
 $itr1 .= '</Form_ITR1>'.PHP_EOL; 
$itr1 .= '<PersonalInfo>'.PHP_EOL; 
$itr1 .= '<AssesseeName>'.PHP_EOL; 
$itr1 .= '<FirstName>'.strtoupper($row_personal['first_name']).'</FirstName>'.PHP_EOL; 
if($row_personal['middle_name']!='') 
{ 
	$itr1 .= '<MiddleName>'.strtoupper($row_personal['middle_name']).'</MiddleName>'.PHP_EOL; 
} 
$itr1 .= '<SurNameOrOrgName>'.strtoupper($row_personal['last_name']).'</SurNameOrOrgName>'.PHP_EOL; 
$itr1 .= '</AssesseeName>'.PHP_EOL; 
$itr1 .= '<PAN>'.strtoupper($row_personal['pan']).'</PAN>'.PHP_EOL; 
$itr1 .= '<Address>'.PHP_EOL; 
$itr1 .= '<ResidenceNo>'.strtoupper($row_personal['door']).'</ResidenceNo>'.PHP_EOL; 
$itr1 .= '<LocalityOrArea>'.strtoupper($row_personal['locality']).'</LocalityOrArea>'.PHP_EOL; 
$itr1 .= '<CityOrTownOrDistrict>'.strtoupper($row_personal['city']).'</CityOrTownOrDistrict>'.PHP_EOL; 
$itr1 .= '<StateCode>'.strtoupper($row_personal['state']).'</StateCode>'.PHP_EOL; 
$itr1 .= '<CountryCode>'.strtoupper($row_personal['country']).'</CountryCode>'.PHP_EOL; 
if($row_personal['zipcheck']=='on' && $row_personal['country']!='91' ) 
{ 
	$itr1 .= '<ZipCode>'.$row_personal['zip_code'].'</ZipCode>'.PHP_EOL; 
} 
else if($row_personal['zipcheck']=='' && $row_personal['country']!='91') 
{ 
	$itr1 .= '<ZipCode>XXXXXX</ZipCode>'.PHP_EOL; 
} 
else 
{ 
	$itr1 .= '<PinCode>'.$row_personal['pincode'].'</PinCode>'.PHP_EOL; 
} 
$itr1 .= '<MobileNo>'.$row_personal['mobile'].'</MobileNo>'.PHP_EOL; 
$itr1 .= '<EmailAddress>'.strtoupper($row_personal['email']).'</EmailAddress>'.PHP_EOL; 
$itr1 .= '</Address>'.PHP_EOL; 
$itr1 .= '<DOB>'.$row_personal['dob'].'</DOB>'.PHP_EOL; 
$itr1 .= '<EmployerCategory>'.strtoupper($row_personal['emp_category']).'</EmployerCategory>'.PHP_EOL; 
$itr1 .= '<AadhaarCardNo>'.strtoupper($row_personal['aadhar']).'</AadhaarCardNo>'.PHP_EOL; 
$itr1 .= '</PersonalInfo>'.PHP_EOL; 
$itr1 .= '<FilingStatus>'.PHP_EOL; 
if($row_personal['return_filed']=='11' || $row_personal['return_filed']=='12') 
{ 
	  $itr1 .= '<ReturnFileSec>'.$row_personal['return_filed'].'</ReturnFileSec>'.PHP_EOL; 
      $itr1 .= '<ReturnType>'.$row_personal['return_type'].'</ReturnType>'.PHP_EOL; 
      $itr1 .= '<ResidentialStatus>'.$row_personal['res_status'].'</ResidentialStatus>'.PHP_EOL; 
} 
 
if($row_personal['return_filed']=='13' || $row_personal['return_filed']=='14' || $row_personal['return_filed']=='15' || $row_personal['return_filed']=='16') 
{ 
	  $itr1 .= '<ReturnFileSec>'.$row_personal['return_filed'].'</ReturnFileSec>'.PHP_EOL; 
      $itr1 .= '<ReturnType>'.$row_personal['return_type'].'</ReturnType>'.PHP_EOL; 
      $itr1 .= '<NoticeDateUnderSec>'.$row_personal['notice_date'].'</NoticeDateUnderSec>'.PHP_EOL; 
      $itr1 .= '<ResidentialStatus>'.$row_personal['res_status'].'</ResidentialStatus>'.PHP_EOL; 
} 
 
if($row_personal['return_filed']=='17') 
{ 
$itr1 .= '<ReturnFileSec>'.$row_personal['return_filed'].'</ReturnFileSec>'.PHP_EOL; 
$itr1 .= '<ReturnType>'.$row_personal['return_type'].'</ReturnType>'.PHP_EOL; 
$itr1 .= '<ReceiptNo>'.$row_personal['original_ack_number'].'</ReceiptNo>'.PHP_EOL; 
$itr1 .= '<OrigRetFiledDate>'.$row_personal['date_original_return'].'</OrigRetFiledDate>'.PHP_EOL; 
$itr1 .= '<ResidentialStatus>'.$row_personal['res_status'].'</ResidentialStatus>'.PHP_EOL; 
} 
 
if($row_personal['return_filed']=='18') 
{ 
$itr1 .= '<ReturnFileSec>'.$row_personal['return_filed'].'</ReturnFileSec>'.PHP_EOL; 
$itr1 .= '<AckNoOriginalReturn>'.$row_personal['original_ack_number'].'</AckNoOriginalReturn>'.PHP_EOL; 
$itr1 .= '<NoticeNo>'.$row_personal['notice_number'].'</NoticeNo>'.PHP_EOL; 
$itr1 .= '<DefRetOrigRetFiledDate>'.$row_personal['date_original_return'].'</DefRetOrigRetFiledDate>'.PHP_EOL; 
$itr1 .= '<ReturnType>'.$row_personal['return_type'].'</ReturnType>'.PHP_EOL; 
$itr1 .= '<ResidentialStatus>'.$row_personal['res_status'].'</ResidentialStatus>'.PHP_EOL;; 
$itr1 .= '<NoticeDateUnderSec>'.$row_personal['notice_date'].'</NoticeDateUnderSec>'.PHP_EOL; 
} 
if($row_personal['portuguese']=='Y') 
{ 
$itr1 .= '<PortugeseCC5A>Y</PortugeseCC5A>'.PHP_EOL; 
$itr1 .= '<PANOfSpouse>'.strtoupper($row_personal['spouse_pan']).'</PANOfSpouse>'.PHP_EOL;	 
} 
else 
{ 
$itr1 .= '<PortugeseCC5A>N</PortugeseCC5A>'.PHP_EOL; 
} 
 
$itr1 .= '</FilingStatus>'.PHP_EOL; 
 
$income = "select * from it1_ay2018.income where uid='$uid'"; 
$query_income =mysqli_query($dbcon,$income); 
$row_income = mysqli_fetch_array($query_income); 
 
$computation = "select * from it1_ay2018.tax_computation1 where uid='$uid'"; 
$query_computation =mysqli_query($dbcon,$computation); 
$row_computation = mysqli_fetch_array($query_computation); 
 
$incomeother = $row_income['other_income'] ? $row_income['other_income'] : '0'; 
$houseincome = $row_income['house_income'] ? $row_income['house_income'] : '0'; 
 
$itr1 .= '<ITR1_IncomeDeductions>'.PHP_EOL; 
$itr1 .= '<IncomeFromSal>'.$row_income['salary_income'].'</IncomeFromSal>'.PHP_EOL; 
$itr1 .= '<TotalIncomeOfHP>'.$houseincome.'</TotalIncomeOfHP>'.PHP_EOL; 
$itr1 .= '<IncomeOthSrc>'.$incomeother.'</IncomeOthSrc>'.PHP_EOL; 
$itr1 .= '<GrossTotIncome>'.$row_income['total_income'].'</GrossTotIncome>'.PHP_EOL; 
 
$deduction =  "SELECT  
    d.uid, 
    coalesce(d1.deduction_claimed_amount,0) as eightc_ded, 
    coalesce(d1.if_calc_amount,0) as eightc_ifcalc, 
    coalesce(d2.deduction_claimed_amount,0) as eightccc_ded, 
    coalesce(d2.if_calc_amount,0) as eightccc_ifcalc, 
	coalesce(d3.deduction_claimed_amount,0) as eightccd_ded, 
    coalesce(d3.if_calc_amount,0) as eightccd_ifcalc, 
	coalesce(d4.deduction_claimed_amount,0) as eightccg_ded, 
    coalesce(d4.if_calc_amount,0) as eightccg_ifcalc, 
	coalesce(dc4.deduction_claimed_amount,0) as eightccd2_ded, 
    coalesce(dc4.if_calc_amount,0) as eightccd2_ifcalc, 
	coalesce(dc5.deduction_claimed_amount,0) as eightccd3_ded, 
    coalesce(dc5.if_calc_amount,0) as eightccd3_ifcalc, 
	coalesce(d5.deduction_claimed_amount,0) as eightd_ded, 
    coalesce(d5.if_calc_amount,0) as eightd_ifcalc, 
	coalesce(d6.deduction_claimed_amount,0) as eightdd_ded, 
    coalesce(d6.if_calc_amount,0) as eightdd_ifcalc, 
	coalesce(d7.deduction_claimed_amount,0) as eightddb_ded, 
    coalesce(d7.if_calc_amount,0) as eightddb_ifcalc, 
	coalesce(d8.deduction_claimed_amount,0) as eighte_ded, 
    coalesce(d8.if_calc_amount,0) as eighte_ifcalc, 
	coalesce(d9.deduction_claimed_amount,0) as eightee_ded, 
    coalesce(d9.if_calc_amount,0) as eightee_ifcalc, 
	coalesce(d10.deduction_claimed_amount,0) as eightg_ded, 
    coalesce(d10.if_calc_amount,0) as eightg_ifcalc, 
	coalesce(d11.deduction_claimed_amount,0) as eightgg_ded, 
    coalesce(d11.if_calc_amount,0) as eightgg_ifcalc, 
	coalesce(d12.deduction_claimed_amount,0) as eightgga_ded, 
    coalesce(d12.if_calc_amount,0) as eightgga_ifcalc, 
	coalesce(d13.deduction_claimed_amount,0) as eightggc_ded, 
    coalesce(d13.if_calc_amount,0) as eightggc_ifcalc, 
	coalesce(d14.deduction_claimed_amount,0) as eightqqb_ded, 
    coalesce(d14.if_calc_amount,0) as eightqqb_ifcalc, 
	coalesce(d15.deduction_claimed_amount,0) as eightrrb_ded, 
    coalesce(d15.if_calc_amount,0) as eightrrb_ifcalc, 
	coalesce(d16.deduction_claimed_amount,0) as eighttta_ded, 
    coalesce(d16.if_calc_amount,0) as eighttta_ifcalc, 
	coalesce(d17.deduction_claimed_amount,0) as eightu_ded, 
    coalesce(d17.if_calc_amount,0) as eightu_ifcalc 
FROM  
    it1_ay2018.deductions as d 
LEFT JOIN it1_ay2018.deductions as d1 
    ON d.uid = d1.uid 
    AND d1.section = '80C' 
LEFT JOIN it1_ay2018.deductions as d2 
    ON d.uid = d2.uid 
   AND d2.section = '80CCC' 
   LEFT JOIN it1_ay2018.deductions as d3 
    ON d.uid = d3.uid 
   AND d3.section = '80CCD' 
   LEFT JOIN it1_ay2018.deductions as dc4 
    ON d.uid = dc4.uid 
   AND dc4.section = '80CCD2' 
   LEFT JOIN it1_ay2018.deductions as dc5 
    ON d.uid = dc5.uid 
   AND dc5.section = '80CCD3' 
   LEFT JOIN it1_ay2018.deductions as d4 
    ON d.uid = d4.uid 
   AND d4.section = '80CCG' 
   LEFT JOIN it1_ay2018.deductions as d5 
    ON d.uid = d5.uid 
   AND d5.section = '80D' 
   LEFT JOIN it1_ay2018.deductions as d6 
    ON d.uid = d6.uid 
   AND d6.section = '80DD' 
   LEFT JOIN it1_ay2018.deductions as d7 
    ON d.uid = d7.uid 
   AND d7.section = '80DDB' 
   LEFT JOIN it1_ay2018.deductions as d8 
    ON d.uid = d8.uid 
   AND d8.section = '80E' 
   LEFT JOIN it1_ay2018.deductions as d9 
    ON d.uid = d9.uid 
   AND d9.section = '80EE' 
   LEFT JOIN it1_ay2018.deductions as d10 
    ON d.uid = d10.uid 
   AND d10.section = '80G' 
   LEFT JOIN it1_ay2018.deductions as d11 
    ON d.uid = d11.uid 
   AND d11.section = '80GG' 
   LEFT JOIN it1_ay2018.deductions as d12 
    ON d.uid = d12.uid 
   AND d12.section = '80GGA' 
   LEFT JOIN it1_ay2018.deductions as d13 
    ON d.uid = d13.uid 
   AND d13.section = '80GGC' 
   LEFT JOIN it1_ay2018.deductions as d14 
    ON d.uid = d14.uid 
   AND d14.section = '80QQB' 
   LEFT JOIN it1_ay2018.deductions as d15 
    ON d.uid = d15.uid 
   AND d15.section = '80RRB' 
   LEFT JOIN it1_ay2018.deductions as d16 
    ON d.uid = d16.uid 
   AND d16.section = '80TTA' 
   LEFT JOIN it1_ay2018.deductions as d17 
    ON d.uid = d17.uid 
   AND d12.section = '80U' 
WHERE 
    d.uid='$uid'";  
$query_deduction =mysqli_query($dbcon,$deduction); 
$row_deduction = mysqli_fetch_array($query_deduction); 
 
$itr1 .= '<UsrDeductUndChapVIA>'.PHP_EOL; 
$itr1 .= '<Section80C>'.$row_deduction['eightc_ded'].'</Section80C>'.PHP_EOL; 
$itr1 .= '<Section80CCC>'.$row_deduction['eightccc_ded'].'</Section80CCC>'.PHP_EOL; 
$itr1 .= '<Section80CCDEmployeeOrSE>'.$row_deduction['eightccd_ded'].'</Section80CCDEmployeeOrSE>'.PHP_EOL; 
$itr1 .= '<Section80CCD1B>'.$row_deduction['eightccd2_ded'].'</Section80CCD1B>'.PHP_EOL; 
$itr1 .= '<Section80CCDEmployer>'.$row_deduction['eightccd3_ded'].'</Section80CCDEmployer>'.PHP_EOL; 
 
if($row_computation['80d']!='') 
{ 
	$itr1 .= '<Section80DUsrType>'.$row_computation['80d'].'</Section80DUsrType>'.PHP_EOL; 
} 
$itr1 .= '<Section80D>'.$row_deduction['eightd_ded'].'</Section80D>'.PHP_EOL; 
$itr1 .= '<Section80DD>'.$row_deduction['eightdd_ded'].'</Section80DD>'.PHP_EOL; 
$itr1 .= '<Section80DDB>'.$row_deduction['eightddb_ded'].'</Section80DDB>'.PHP_EOL; 
$itr1 .= '<Section80E>'.$row_deduction['eighte_ded'].'</Section80E>'.PHP_EOL; 
$itr1 .= '<Section80EE>'.$row_deduction['eightee_ded'].'</Section80EE>'.PHP_EOL; 
$itr1 .= '<Section80G>'.$row_deduction['eightg_ded'].'</Section80G>'.PHP_EOL; 
$itr1 .= '<Section80GG>'.$row_deduction['eightgg_ded'].'</Section80GG>'.PHP_EOL; 
$itr1 .= '<Section80GGA>'.$row_deduction['eightgga_ded'].'</Section80GGA>'.PHP_EOL; 
$itr1 .= '<Section80GGC>'.$row_deduction['eightggc_ded'].'</Section80GGC>'.PHP_EOL; 
$itr1 .= '<Section80U>'.$row_deduction['eightu_ded'].'</Section80U>'.PHP_EOL; 
$itr1 .= '<Section80RRB>'.$row_deduction['eightrrb_ded'].'</Section80RRB>'.PHP_EOL; 
$itr1 .= '<Section80QQB>'.$row_deduction['eightqqb_ded'].'</Section80QQB>'.PHP_EOL; 
$itr1 .= '<Section80CCG>'.$row_deduction['eightccg_ded'].'</Section80CCG>'.PHP_EOL; 
$itr1 .= '<Section80TTA>'.$row_deduction['eighttta_ded'].'</Section80TTA>'.PHP_EOL; 
$payer_total_deduction = $row_computation['payer_total_deduction'] ? $row_computation['payer_total_deduction'] : '0'; 
$itr1 .= '<TotalChapVIADeductions>'.$payer_total_deduction.'</TotalChapVIADeductions>'.PHP_EOL; 
$itr1 .= '</UsrDeductUndChapVIA>'.PHP_EOL; 
$itr1 .= '<DeductUndChapVIA>'.PHP_EOL; 
$itr1 .= '<Section80C>'.$row_deduction['eightc_ifcalc'].'</Section80C>'.PHP_EOL; 
$itr1 .= '<Section80CCC>'.$row_deduction['eightccc_ifcalc'].'</Section80CCC>'.PHP_EOL; 
$itr1 .= '<Section80CCDEmployeeOrSE>'.$row_deduction['eightccd_ifcalc'].'</Section80CCDEmployeeOrSE>'.PHP_EOL; 
$itr1 .= '<Section80CCD1B>'.$row_deduction['eightccd2_ifcalc'].'</Section80CCD1B>'.PHP_EOL; 
$itr1 .= '<Section80CCDEmployer>'.$row_deduction['eightccd3_ifcalc'].'</Section80CCDEmployer>'.PHP_EOL; 
$itr1 .= '<Section80D>'.$row_deduction['eightd_ifcalc'].'</Section80D>'.PHP_EOL; 
$itr1 .= '<Section80DD>'.$row_deduction['eightdd_ifcalc'].'</Section80DD>'.PHP_EOL; 
$itr1 .= '<Section80DDB>'.$row_deduction['eightddb_ifcalc'].'</Section80DDB>'.PHP_EOL; 
$itr1 .= '<Section80E>'.$row_deduction['eighte_ifcalc'].'</Section80E>'.PHP_EOL; 
$itr1 .= '<Section80EE>'.$row_deduction['eightee_ifcalc'].'</Section80EE>'.PHP_EOL; 
$itr1 .= '<Section80G>'.$row_deduction['eightg_ifcalc'].'</Section80G>'.PHP_EOL; 
$itr1 .= '<Section80GG>'.$row_deduction['eightgg_ifcalc'].'</Section80GG>'.PHP_EOL; 
$itr1 .= '<Section80GGA>'.$row_deduction['eightgga_ifcalc'].'</Section80GGA>'.PHP_EOL; 
$itr1 .= '<Section80GGC>'.$row_deduction['eightggc_ifcalc'].'</Section80GGC>'.PHP_EOL; 
$itr1 .= '<Section80U>'.$row_deduction['eightu_ifcalc'].'</Section80U>'.PHP_EOL; 
$itr1 .= '<Section80RRB>'.$row_deduction['eightrrb_ifcalc'].'</Section80RRB>'.PHP_EOL; 
$itr1 .= '<Section80QQB>'.$row_deduction['eightqqb_ifcalc'].'</Section80QQB>'.PHP_EOL; 
$itr1 .= '<Section80CCG>'.$row_deduction['eightccg_ifcalc'].'</Section80CCG>'.PHP_EOL; 
$itr1 .= '<Section80TTA>'.$row_deduction['eighttta_ifcalc'].'</Section80TTA>'.PHP_EOL; 
$if_total_deduction = $row_computation['if_total_deduction'] ? $row_computation['if_total_deduction'] : '0'; 
$itr1 .= '<TotalChapVIADeductions>'.$if_total_deduction.'</TotalChapVIADeductions>'.PHP_EOL; 
$itr1 .= '</DeductUndChapVIA>'.PHP_EOL; 
$itr1 .= '<TotalIncome>'.$row_computation['taxable_income'].'</TotalIncome>'.PHP_EOL; 
$itr1 .= '</ITR1_IncomeDeductions>'.PHP_EOL; 
$itr1 .= '<ITR1_TaxComputation>'.PHP_EOL; 
$itr1 .= '<TotalTaxPayable>'.$row_computation['payable_tax'].'</TotalTaxPayable>'.PHP_EOL; 
$itr1 .= '<Rebate87A>'.$row_computation['rebate'].'</Rebate87A>'.PHP_EOL; 
$itr1 .= '<TaxPayableOnRebate>'.$row_computation['after_rebate'].'</TaxPayableOnRebate>'.PHP_EOL; 
$itr1 .= '<EducationCess>'.$row_computation['cess'].'</EducationCess>'.PHP_EOL; 
$itr1 .= '<GrossTaxLiability>'.$row_computation['total_tax_cess'].'</GrossTaxLiability>'.PHP_EOL; 
$itr1 .= '<Section89>'.$row_computation['section89'].'</Section89>'.PHP_EOL; 
$itr1 .= '<NetTaxLiability>'.$row_computation['balance_tax'].'</NetTaxLiability>'.PHP_EOL; 
$itr1 .= '<TotalIntrstPay>'.$row_computation['interest_payable'].'</TotalIntrstPay>'.PHP_EOL; 
$itr1 .= '<IntrstPay>'.PHP_EOL; 
$itr1 .= '<IntrstPayUs234A>'.$row_computation['interest_234a'].'</IntrstPayUs234A>'.PHP_EOL; 
$itr1 .= '<IntrstPayUs234B>'.$row_computation['interest_234b'].'</IntrstPayUs234B>'.PHP_EOL; 
$itr1 .= '<IntrstPayUs234C>'.$row_computation['interest_234c'].'</IntrstPayUs234C>'.PHP_EOL; 
$itr1 .= '</IntrstPay>'.PHP_EOL; 
$itr1 .= '<TotTaxPlusIntrstPay>'.$row_computation['total_tax_interest'].'</TotTaxPlusIntrstPay>'.PHP_EOL; 
$itr1 .= '</ITR1_TaxComputation>'.PHP_EOL; 
 
$itr1 .= '<TaxPaid>'.PHP_EOL; 
$itr1 .= '<TaxesPaid>'.PHP_EOL; 
                         /*   Select sum of tds deducted amount*/ 
	$selecttdsquery = mysqli_query($dbcon,"SELECT sum(tax_deducted) AS tds_deducted FROM it1_ay2018.salary WHERE uid='$uid' and status='1'"); 
	$tdsRow= mysqli_fetch_assoc($selecttdsquery); 
	$tds_amount = $tdsRow['tds_deducted']; 
	if($tds_amount>0) 
	{ 
		$tds_amount = $tds_amount; 
	} 
	else 
	{ 
		$tds_amount=0; 
	} 
 
                            /* Select sum of tds2 deducted amount */ 
	$selecttds2query = mysqli_query($dbcon,"SELECT sum(tax_deducted) AS tds2_deducted FROM it1_ay2018.other_tds WHERE uid='$uid' and status='1'"); 
	$tds2Row= mysqli_fetch_assoc($selecttds2query); 
	$tds2_amount = $tds2Row['tds2_deducted']; 
	if($tds2_amount>0) 
	{ 
		$tds2_amount = $tds2_amount; 
	} 
	else 
	{ 
		$tds2_amount = 0; 
	} 
	$total_tds = $tds_amount+$tds2_amount; 
                              /*   Select sum of tcs deducted amount*/ 
	$selecttcsquery = mysqli_query($dbcon,"SELECT sum(tax_collected) AS tcs_collected FROM it1_ay2018.tcs WHERE uid='$uid' and status='1'"); 
	$tcsRow= mysqli_fetch_assoc($selecttcsquery); 
	$tcs_amount = $tcsRow['tcs_collected']; 
	if($tcs_amount>0) 
	{ 
		$tcs_amount = $tcs_amount; 
	} 
	else 
	{ 
		$tcs_amount =0; 
	} 
	 
                             /*   Select sum of Advance tax deducted amount*/ 
	$selectatquery = mysqli_query($dbcon,"SELECT sum(tax_paid) AS total_advance_tax FROM it1_ay2018.tax_payed WHERE uid='$uid' and status='1'"); 
	$atRow= mysqli_fetch_assoc($selectatquery); 
	$total_advance_tax = $atRow['total_advance_tax']; 
	if($total_advance_tax>0) 
	{ 
		$total_advance_tax = $total_advance_tax; 
	} 
	else 
	{ 
		$total_advance_tax=0; 
	} 
$total_taxex_paid = $tds_amount + $tds2_amount + $tcs_amount + $total_advance_tax; 
 
$itr1 .= '<AdvanceTax>0</AdvanceTax>'.PHP_EOL; 
$itr1 .= '<TDS>'.$total_tds.'</TDS>'.PHP_EOL; 
$itr1 .= '<TCS>'.$tcs_amount.'</TCS>'.PHP_EOL; 
$itr1 .= '<SelfAssessmentTax>'.$total_advance_tax.'</SelfAssessmentTax>'.PHP_EOL; 
$itr1 .= '<TotalTaxesPaid>'.$total_taxex_paid.'</TotalTaxesPaid>'.PHP_EOL; 
$itr1 .= '<ExcIncSec1038>0</ExcIncSec1038>'.PHP_EOL; 
$itr1 .= '<ExcIncSec1034>0</ExcIncSec1034>'.PHP_EOL; 
$itr1 .= '</TaxesPaid>'.PHP_EOL; 
$amount_payable = $row_computation['amount_payable'] ? $row_computation['amount_payable'] : '0'; 
$itr1 .= '<BalTaxPayable>'.$amount_payable.'</BalTaxPayable>'.PHP_EOL; 
$itr1 .= '</TaxPaid>'.PHP_EOL; 
$itr1 .= '<Refund>'.PHP_EOL; 
$amount_refund = $row_computation['amount_refund'] ? $row_computation['amount_refund'] : '0'; 
$itr1 .= '<RefundDue>'.$amount_refund.'</RefundDue>'.PHP_EOL; 
$bankmain =mysqli_query($dbcon,"select * from it1_ay2018.bank where uid='$uid'"); 
$row_bankmain = mysqli_fetch_assoc($bankmain); 
if($row_bankmain['country_location']=='1') 
{ 
	$itr1 .= '<BankAccountDtls>'.PHP_EOL; 
	$itr1 .= '<BankDtlsFlag>Y</BankDtlsFlag>'.PHP_EOL; 
 
$bankmain =mysqli_query($dbcon,"select * from it1_ay2018.bank where uid='$uid' and main_account='1'"); 
$row_bankmain = mysqli_fetch_assoc($bankmain); 
$itr1 .= '<PriBankDetails>'.PHP_EOL; 
$itr1 .= '<IFSCCode>'.strtoupper($row_bankmain['ifsc_code']).'</IFSCCode>'.PHP_EOL; 
$itr1 .= '<BankName>'.strtoupper($row_bankmain['bank_name']).'</BankName>'.PHP_EOL; 
$itr1 .= '<BankAccountNo>'.$row_bankmain['account_number'].'</BankAccountNo>'.PHP_EOL; 
$itr1 .= '</PriBankDetails>'.PHP_EOL; 
$bankadditional =mysqli_query($dbcon,"select * from it1_ay2018.bank where uid='$uid' and main_account='0'"); 
while($row_additional = mysqli_fetch_assoc($bankadditional)) 
{ 
    $itr1 .= '<AddtnlBankDetails>'.PHP_EOL; 
    $itr1 .= '<IFSCCode>'.strtoupper($row_additional['ifsc_code']).'</IFSCCode>'.PHP_EOL; 
	$itr1 .= '<BankName>'.strtoupper($row_additional['bank_name']).'</BankName>'.PHP_EOL; 
	$itr1 .= '<BankAccountNo>'.$row_additional['account_number'].'</BankAccountNo>'.PHP_EOL; 
	$itr1 .= '</AddtnlBankDetails>'.PHP_EOL; 
} 
$itr1 .= '</BankAccountDtls>'.PHP_EOL; 
} 
elseif($row_bankmain['country_location']=='0') 
{ 
	$itr1 .= '<BankAccountDtls>'.PHP_EOL; 
    $itr1 .= '<BankDtlsFlag>N</BankDtlsFlag>'.PHP_EOL; 
          
$bankforiegn =mysqli_query($dbcon,"select * from it1_ay2018.bank where uid='$uid' and country_location='N'"); 
while($row_foriegn = mysqli_fetch_assoc($bankforiegn)) 
{ 
	$itr1 .= '<ForeignBankDetails>'.PHP_EOL; 
			$itr1 .= '<IBANSWIFTCode>'.strtoupper($row_foriegn['ifsc_code']).'</IBANSWIFTCode>'.PHP_EOL; 
			$itr1 .= '<BankName>'.strtoupper($row_foriegn['bank_name']).'</BankName>'.PHP_EOL; 
			$itr1 .= '<CountryCode>'.strtoupper($row_foriegn['branch_name']).'</CountryCode>'.PHP_EOL; 
			$itr1 .= '<BankAccountNo>'.$row_foriegn['account_number'].'</BankAccountNo>'.PHP_EOL; 
	$itr1 .= '</ForeignBankDetails>	'.PHP_EOL; 
}    
 $itr1 .= '</BankAccountDtls>'.PHP_EOL;         
} 
$itr1 .= '</Refund>'.PHP_EOL; 
 
$section80ded =mysqli_query($dbcon,"select * from it1_ay2018.section_80g where uid='$uid'"); 
$row_section80 = mysqli_fetch_assoc($section80ded); 
$num_section80 = mysqli_num_rows($section80ded); 
if($num_section80!='0') 
{ 
$itr1 .= '<Schedule80G>'.PHP_EOL;  
$tat100donation='0'; 
$eligible100donation='0'; 
$don100per =mysqli_query($dbcon,"select * from it1_ay2018.section_80g where uid='$uid' and qualifying_limit='1'"); 
$num_don100per = mysqli_num_rows($don100per); 
if($num_don100per>=1) 
{ 
      $itr1 .= '<Don100Percent>'.PHP_EOL;  
while($row_don100per = mysqli_fetch_assoc($don100per)) 
{ 
      $itr1 .= '<DoneeWithPan>'.PHP_EOL;  
      $itr1 .= ' <DoneeWithPanName>'.$row_don100per['donee_name'].'</DoneeWithPanName>'.PHP_EOL;  
      $itr1 .= ' <DoneePAN>'.$row_don100per['pan'].'</DoneePAN>'.PHP_EOL;  
      $itr1 .= ' <AddressDetail>'.PHP_EOL; 
      $itr1 .= '  <AddrDetail>'.$row_don100per['address'].'</AddrDetail>'.PHP_EOL;  
      $itr1 .= ' <CityOrTownOrDistrict>'.$row_don100per['city'].'</CityOrTownOrDistrict>'.PHP_EOL; 
      $itr1 .= ' <StateCode>'.$row_don100per['state_code'].'</StateCode>'.PHP_EOL; 
      $itr1 .= ' <PinCode>'.$row_don100per['pincode'].'</PinCode>'.PHP_EOL; 
      $itr1 .= ' </AddressDetail>'.PHP_EOL; 
      $itr1 .= ' <DonationAmt>'.$row_don100per['donation_amount'].'</DonationAmt>'.PHP_EOL; 
      $itr1 .= ' <EligibleDonationAmt>'.$row_don100per['eligible_amount'].'</EligibleDonationAmt>'.PHP_EOL; 
      $itr1 .= '</DoneeWithPan>'.PHP_EOL; 
      $tat100donation += $row_don100per['donation_amount']; 
	  $eligible100donation += $row_don100per['eligible_amount']; 
} 
      $itr1 .= '<TotEligibleDon100Percent>'.$tat100donation.'</TotEligibleDon100Percent>'.PHP_EOL; 
      $itr1 .= '<TotDon100Percent>'.$eligible100donation.'</TotDon100Percent>'.PHP_EOL; 
      $itr1 .= '</Don100Percent>'.PHP_EOL; 
} 
 
 
 
$tat50donation = '0'; 
$eligible50donation = '0'; 
$Don50PercentNoApprReqd =mysqli_query($dbcon,"select * from it1_ay2018.section_80g where uid='$uid' and qualifying_limit='2'"); 
$num_Don50PercentNoApprReqd = mysqli_num_rows($Don50PercentNoApprReqd); 
if($num_Don50PercentNoApprReqd>=1) 
{ 
         $itr1 .= '<Don50PercentNoApprReqd>'.PHP_EOL; 
while($row_don50noapp = mysqli_fetch_assoc($Don50PercentNoApprReqd)) 
{ 
 
          $itr1 .= '<DoneeWithPan>'.PHP_EOL; 
          $itr1 .= '<DoneeWithPanName>'.$row_don50noapp['donee_name'].'</DoneeWithPanName>'.PHP_EOL; 
          $itr1 .= '<DoneePAN>'.$row_don50noapp['pan'].'</DoneePAN>'.PHP_EOL; 
          $itr1 .= '<AddressDetail>'.PHP_EOL; 
          $itr1 .= '<AddrDetail>'.$row_don50noapp['address'].'</AddrDetail>'.PHP_EOL; 
          $itr1 .= '<CityOrTownOrDistrict>'.$row_don50noapp['city'].'</CityOrTownOrDistrict>'.PHP_EOL; 
          $itr1 .= '<StateCode>'.$row_don50noapp['state_code'].'</StateCode>'.PHP_EOL; 
          $itr1 .= '<PinCode>'.$row_don50noapp['pincode'].'</PinCode>'.PHP_EOL; 
          $itr1 .= '</AddressDetail>'.PHP_EOL; 
          $itr1 .= '<DonationAmt>'.$row_don50noapp['donation_amount'].'</DonationAmt>'.PHP_EOL; 
          $itr1 .= '<EligibleDonationAmt>'.$row_don50noapp['eligible_amount'].'</EligibleDonationAmt>'.PHP_EOL; 
          $itr1 .= '</DoneeWithPan>'.PHP_EOL; 
	     $tat50donation += $row_don50noapp['donation_amount']; 
	     $eligible50donation += $row_don50noapp['eligible_amount']; 
} 
 
        $itr1 .= '<TotEligibleDon50Percent>'.$tat50donation.'</TotEligibleDon50Percent>'.PHP_EOL; 
        $itr1 .= '<TotDon50PercentNoApprReqd>'.$eligible50donation.'</TotDon50PercentNoApprReqd>'.PHP_EOL; 
        $itr1 .= '</Don50PercentNoApprReqd>'.PHP_EOL; 
} 
$tat100donationapp = '0'; 
$eligible100donationapp = '0'; 
$don100perapp =mysqli_query($dbcon,"select * from it1_ay2018.section_80g where uid='$uid' and qualifying_limit='3'"); 
$num_don100perapp = mysqli_num_rows($don100perapp); 
if($num_don100perapp>=1) 
{ 
      $itr1 .= '<Don100PercentApprReqd>'.PHP_EOL; 
while($row_don100perapp = mysqli_fetch_assoc($don100perapp)) 
{ 
 
        $itr1 .= '<DoneeWithPan>'.PHP_EOL; 
          $itr1 .= '<DoneeWithPanName>'.$row_don100perapp['donee_name'].'</DoneeWithPanName>'.PHP_EOL; 
          $itr1 .= '<DoneePAN>'.$row_don100perapp['pan'].'</DoneePAN>'.PHP_EOL; 
          $itr1 .= '<AddressDetail>'.PHP_EOL; 
            $itr1 .= '<AddrDetail>'.$row_don100perapp['address'].'</AddrDetail>'.PHP_EOL; 
            $itr1 .= '<CityOrTownOrDistrict>'.$row_don100perapp['city'].'</CityOrTownOrDistrict>'.PHP_EOL; 
            $itr1 .= '<StateCode>'.$row_don100perapp['state_code'].'</StateCode>'.PHP_EOL; 
            $itr1 .= '<PinCode>'.$row_don100perapp['pincode'].'</PinCode>'.PHP_EOL; 
          $itr1 .= '</AddressDetail>'.PHP_EOL; 
          $itr1 .= '<DonationAmt>'.$row_don100perapp['donation_amount'].'</DonationAmt>'.PHP_EOL; 
          $itr1 .= '<EligibleDonationAmt>'.$row_don100perapp['eligible_amount'].'</EligibleDonationAmt>'.PHP_EOL; 
        $itr1 .= '</DoneeWithPan>'.PHP_EOL; 
		$tat100donationapp += $row_don100perapp['donation_amount']; 
	    $eligible100donationapp += $row_don100perapp['eligible_amount']; 
} 
 
        $itr1 .= '<TotEligibleDon100PercentApprReqd>'.$tat100donationapp.'</TotEligibleDon100PercentApprReqd>'.PHP_EOL; 
        $itr1 .= '<TotDon100PercentApprReqd>'.$eligible100donationapp.'</TotDon100PercentApprReqd>'.PHP_EOL; 
        $itr1 .= '</Don100PercentApprReqd>'.PHP_EOL; 
 
} 
$tat50donationapp = '0'; 
$eligible50donationapp = '0'; 
$don50perapp =mysqli_query($dbcon,"select * from it1_ay2018.section_80g where uid='$uid' and qualifying_limit='4'"); 
$num_don50perapp = mysqli_num_rows($don50perapp); 
if($num_don50perapp>=1) 
{ 
      $itr1 .= '<Don50PercentApprReqd>'.PHP_EOL; 
while($row_don50perapp = mysqli_fetch_assoc($don50perapp)) 
{ 
 
        $itr1 .= '<DoneeWithPan>'.PHP_EOL; 
          $itr1 .= '<DoneeWithPanName>'.$row_don50perapp['donee_name'].'</DoneeWithPanName>'.PHP_EOL; 
          $itr1 .= '<DoneePAN>'.$row_don50perapp['pan'].'</DoneePAN>'.PHP_EOL; 
          $itr1 .= '<AddressDetail>'.PHP_EOL; 
            $itr1 .= '<AddrDetail>'.$row_don50perapp['address'].'</AddrDetail>'.PHP_EOL; 
            $itr1 .= '<CityOrTownOrDistrict>'.$row_don50perapp['city'].'</CityOrTownOrDistrict>'.PHP_EOL; 
            $itr1 .= '<StateCode>'.$row_don50perapp['state_code'].'</StateCode>'.PHP_EOL; 
            $itr1 .= '<PinCode>'.$row_don50perapp['pincode'].'</PinCode>'.PHP_EOL; 
          $itr1 .= '</AddressDetail>'.PHP_EOL; 
          $itr1 .= '<DonationAmt>'.$row_don50perapp['donation_amount'].'</DonationAmt>'.PHP_EOL; 
          $itr1 .= '<EligibleDonationAmt>'.$row_don50perapp['eligible_amount'].'</EligibleDonationAmt>'.PHP_EOL; 
        $itr1 .= '</DoneeWithPan>'.PHP_EOL; 
		$tat50donationapp += $row_don50perapp['donation_amount']; 
	    $eligible50donationapp += $row_don50perapp['eligible_amount']; 
} 
 
        $itr1 .= '<TotEligibleDon50PercentApprReqd>'.$tat50donationapp.'</TotEligibleDon50PercentApprReqd>'.PHP_EOL; 
        $itr1 .= '<TotDon50PercentApprReqd>'.$eligible50donationapp.'</TotDon50PercentApprReqd>'.PHP_EOL; 
      $itr1 .= '</Don50PercentApprReqd>'.PHP_EOL; 
 
} 
 
$toteligible = $tat100donation + $tat50donation + $tat100donationapp + $tat50donationapp; 
$totaldonation = $eligible100donation + $eligible50donation + $eligible100donationapp + $eligible50donationapp; 
 
      $itr1 .= '<TotalEligibleDonationsUs80G>'.$toteligible.'</TotalEligibleDonationsUs80G>'.PHP_EOL; 
      $itr1 .= '<TotalDonationsUs80G>'.$totaldonation.'</TotalDonationsUs80G>'.PHP_EOL; 
    $itr1 .= '</Schedule80G>'.PHP_EOL; 
} 
 
 
 
 
$salary='0'; 
$query_sal =mysqli_query($dbcon,"select * from it1_ay2018.salary where uid='$uid' and status='1'"); 
$num_query_sal = mysqli_num_rows($query_sal); 
if($num_query_sal!='0') 
{ 
$itr1 .= '<TDSonSalaries>'.PHP_EOL; 
while($row_sal = mysqli_fetch_assoc($query_sal)) 
{ 
      $itr1 .= '<TDSonSalary>'.PHP_EOL; 
        $itr1 .= '<EmployerOrDeductorOrCollectDetl>'.PHP_EOL; 
          $itr1 .= '<TAN>'.$row_sal['tan'].'</TAN>'.PHP_EOL; 
          $itr1 .= '<EmployerOrDeductorOrCollecterName>'.$row_sal['deductor'].'</EmployerOrDeductorOrCollecterName>'.PHP_EOL; 
        $itr1 .= '</EmployerOrDeductorOrCollectDetl>'.PHP_EOL; 
        $itr1 .= '<IncChrgSal>'.$row_sal['income_charge'].'</IncChrgSal>'.PHP_EOL; 
        $itr1 .= '<TotalTDSSal>'.$row_sal['tax_deducted'].'</TotalTDSSal>'.PHP_EOL; 
      $itr1 .= '</TDSonSalary>'.PHP_EOL; 
	  $salary += $row_sal['tax_deducted']; 
} 
	   
    $itr1 .= '<TotalTDSonSalaries>'.$salary.'</TotalTDSonSalaries>'.PHP_EOL; 
    $itr1 .= '</TDSonSalaries>'.PHP_EOL; 
 
} 
 
 
$othersalary='0'; 
$query_othersal =mysqli_query($dbcon,"select * from it1_ay2018.tcs where uid='$uid' and status='1'"); 
$num_query_othersal = mysqli_num_rows($query_othersal); 
if($num_query_othersal!='0') 
{ 
$itr1 .= '<TDSonOthThanSals>'.PHP_EOL; 
 
while($row_othersal = mysqli_fetch_assoc($query_othersal)) 
{ 
$itr1 .= '<TDSonOthThanSal>'.PHP_EOL; 
        $itr1 .= '<EmployerOrDeductorOrCollectDetl>'.PHP_EOL; 
         $itr1 .= ' <TAN>'.$row_othersal['tan'].'</TAN>'.PHP_EOL; 
         $itr1 .= ' <EmployerOrDeductorOrCollecterName>'.$row_othersal['deductor'].'</EmployerOrDeductorOrCollecterName>'.PHP_EOL; 
       $itr1 .= ' </EmployerOrDeductorOrCollectDetl>'.PHP_EOL; 
         
         $itr1 .= '<AmtForTaxDeduct>'.$row_othersal['income_charge'].'</AmtForTaxDeduct>'.PHP_EOL; 
         $itr1 .= ' <DeductedYr>'.$row_othersal['deduction_year'].'</DeductedYr>'.PHP_EOL; 
       $itr1 .= ' <TotTDSOnAmtPaid>'.$row_othersal['tax_deducted'].'</TotTDSOnAmtPaid>'.PHP_EOL; 
       $itr1 .= ' <ClaimOutOfTotTDSOnAmtPaid>'.$row_othersal['claimed_amount'].'</ClaimOutOfTotTDSOnAmtPaid>'.PHP_EOL; 
		 
     $itr1 .= ' </TDSonOthThanSal>'.PHP_EOL; 
	 $othersalary += $row_othersal['claimed_amount']; 
} 
 
       $itr1 .= '<TotalTDSonOthThanSals>'.$othersalary.'</TotalTDSonOthThanSals>'.PHP_EOL; 
   $itr1 .= ' </TDSonOthThanSals>'.PHP_EOL; 
 
} 
 
$tcs='0'; 
$query_tcs =mysqli_query($dbcon,"select * from it1_ay2018.tcs where uid='$uid' and status='1'"); 
$num_query_tcs = mysqli_num_rows($query_tcs); 
if($num_query_tcs!='0') 
{ 
$itr1 .= '<ScheduleTCS>'.PHP_EOL; 
 
while($row_tcs = mysqli_fetch_assoc($query_tcs)) 
{ 
        $itr1 .= '<TCS>'.PHP_EOL; 
		$itr1 .= '<EmployerOrDeductorOrCollectDetl>'.PHP_EOL; 
	    $itr1 .= '<TAN>'.$row_tcs['tca_number'].'</TAN>'.PHP_EOL; 
		$itr1 .= '<EmployerOrDeductorOrCollecterName>'.$row_tcs['collector'].'</EmployerOrDeductorOrCollecterName>'.PHP_EOL; 
		$itr1 .= '</EmployerOrDeductorOrCollectDetl>'.PHP_EOL; 
		$itr1 .= '<AmtTaxCollected>'.$row_tcs['tax_collected'].'</AmtTaxCollected>'.PHP_EOL; 
        $itr1 .= '<CollectedYr>'.$row_tcs['year'].'</CollectedYr>'.PHP_EOL; 
		$itr1 .= '<TotalTCS>'.$row_tcs['tcs_amount'].'</TotalTCS>'.PHP_EOL; 
		$itr1 .= '<AmtTCSClaimedThisYear>'.$row_tcs['claimed_amount'].'</AmtTCSClaimedThisYear>'.PHP_EOL;	 
		$tcs += $row_tcs['claimed_amount']; 
$itr1 .= '</TCS>'.PHP_EOL;	 
}	    
$itr1 .= '<TotalSchTCS>'.$tcs.'</TotalSchTCS>'.PHP_EOL;		 
$itr1 .= '</ScheduleTCS> '.PHP_EOL;	 
 
} 
 
 
$taxsum='0'; 
$taxpayed =mysqli_query($dbcon,"select * from it1_ay2018.tax_payed where uid='$uid' and status='1'"); 
$num_query_taxpayed = mysqli_num_rows($taxpayed); 
if($num_query_taxpayed!='0') 
{ 
$itr1 .= '<TaxPayments>'.PHP_EOL; 
 
while($row_taxpayed = mysqli_fetch_assoc($taxpayed)) 
{ 
        $itr1 .= '<TaxPayment>'.PHP_EOL; 
        $itr1 .= '<BSRCode>'.$row_taxpayed['bsr_code'].'</BSRCode>'.PHP_EOL; 
        $itr1 .= '<DateDep>'.$row_taxpayed['deposit_date'].'</DateDep>'.PHP_EOL; 
        $itr1 .= '<SrlNoOfChaln>'.$row_taxpayed['challan_no'].'</SrlNoOfChaln>'.PHP_EOL; 
        $itr1 .= '<Amt>'.$row_taxpayed['tax_paid'].'</Amt>'.PHP_EOL; 
        $itr1 .= ' </TaxPayment>'.PHP_EOL;  
		$taxsum += $row_taxpayed['tax_paid']; 
} 
    $itr1 .= '<TotalTaxPayments>'.$taxsum.'</TotalTaxPayments>'.PHP_EOL; 
    $itr1 .= '</TaxPayments>'.PHP_EOL; 
} 
$itr1 .= '<ns2:TaxExmpIntInc>0</ns2:TaxExmpIntInc>'.PHP_EOL; 
 
 
$itr1 .= '<Verification>'.PHP_EOL; 
 
$itr1 .= '<Declaration>'.PHP_EOL; 
$itr1 .= '<AssesseeVerName>'.strtoupper($row_personal['first_name']).' '.strtoupper($row_personal['middle_name']).' '.strtoupper($row_personal['last_name']).'</AssesseeVerName>'.PHP_EOL; 
$itr1 .= '<FatherName>'.strtoupper($row_personal['father_name']).'</FatherName>'.PHP_EOL; 
$itr1 .= '<AssesseeVerPAN>'.strtoupper($row_personal['pan']).'</AssesseeVerPAN>'.PHP_EOL; 
$itr1 .= '</Declaration>'.PHP_EOL; 
 
$itr1 .= '<Place>CHENNAI</Place>'.PHP_EOL; 
$itr1 .= '<Date>'.date("Y-m-d").'</Date>'.PHP_EOL; 
 
$itr1 .= '</Verification>'.PHP_EOL; 
 
$itr1 .= '</ns2:ITR1>'.PHP_EOL; 
$itr1 .= '</ns3:ITR>'.PHP_EOL; 
 
$final_xml = $itr1; 
$str1 = str_replace('ns2:','',$final_xml); 
$str2 = str_replace('ns3:','',$str1); 
$final_xml_string = $str2; 
include "/var/www/html/aws/start.php"; 
 
$myFile = "/var/www/html/t/itr-1/uploads/AY-17-18-itr-1.xml"; 
$fh = fopen($myFile, 'w') or die("can't open file");  
fwrite($fh, $itr1); 
 
//echo $fileContents = file_get_contents($fh); 
//		$tempFile = file_put_contents($tempFilePath, $fileContents); 
$myFile = $myFile; 
$filename ="AY-17-18-itr-1.xml"; 
$engagement_id = base64_decode(urldecode($_REQUEST['engagement_id'])); 
$uid=base64_decode(urldecode($_REQUEST['uid'])); 
  $uploaded_by=$_SESSION['uid']; 
  $email=$_SESSION['email']; 
  $document_tag="ITR 1 XML"; 
  $engagement_type="Income Tax Return Filing - Individual"; 
  $uploaded_date=date('Y-m-d H:i:s'); 
   
  $tag_result=mysqli_query($dbcon1,"SELECT `id`,`visibility`,`status` FROM indiafilings.document_types WHERE `document_tag`='$document_tag' AND `engagement_type`='$engagement_type'"); 
  $documents_row=mysqli_fetch_assoc($tag_result); 
   
   mysqli_query($dbcon1,"INSERT INTO indiafilings.document_master (`uid`,`engagement_id`,`document_id`,`file_name`,`document_owner`,`visibility`,`status`,`client_uploaded_by`,`upload_time`) values('$uid','$engagement_id','".$documents_row['id']."','$filename','$uid','".$documents_row['visibility']."','".$documents_row['status']."','$uploaded_by','$uploaded_date')"); 
   
$company_name=$uid.''.substr($email, 0, 1);  
   try{ 
        $s3 -> putObject([ 
                        'Bucket' => 'indiafilings', 
                        'Key' => "{$company_name}/{$filename}", 
                        'Body' => fopen($myFile, 'rb'), 
						'ACL'    => 'private' 
                    ]); 
				 
    }catch (Exception $e){ 
        echo $e->getMessage(); 
    } 
   
 
 
forceDownLoad($myFile); 
 
function forceDownLoad($filename) 
 
{ 
 
 
 
    header("Pragma: public"); 
 
    header("Expires: 0"); // set expiration time 
 
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
	 
	header('Content-Type: application/xml; charset=utf-8'); 
 
 
 
    header("Content-Disposition: attachment; filename=".basename($filename).";"); 
 
    header("Content-Transfer-Encoding: binary"); 
 
    header("Content-Length: ".filesize($filename)); 
 
 
 
    @readfile($filename); 
 
    exit(0); 
 
} 
 
fclose($fh); 
?> 

Did this file decode correctly?

Original Code

<?php
include "db-connect.php";
//ini_set('display_errors','1');
//error_reporting(E_ALL);
session_start();
$uid=$_SESSION['uid'];

$query = "select * from it1_ay2018.personal p LEFT JOIN it1_ay2018.filing_status fs on p.uid = fs.uid where p.uid='$uid'";
$personal =mysqli_query($dbcon,$query);
$row_personal = mysqli_fetch_array($personal);
$itr1 .= '<?xml version="1.0" encoding="UTF-8"?><ns3:ITR xmlns:ns3="http://incometaxindiaefiling.gov.in/main" xmlns="http://incometaxindiaefiling.gov.in/master" xmlns:ns2="http://incometaxindiaefiling.gov.in/ITR1">'.PHP_EOL; 
 $itr1 .= "<ns2:ITR1>".PHP_EOL;
 $itr1 .="<CreationInfo>".PHP_EOL;
 $itr1 .= '<SWVersionNo>1.1</SWVersionNo>'.PHP_EOL;
 $itr1 .= '<SWCreatedBy>SW10001472</SWCreatedBy>'.PHP_EOL;
 $itr1 .= '<XMLCreatedBy>SW10001472</XMLCreatedBy>'.PHP_EOL;
 $itr1 .= '<XMLCreationDate>'.date("Y-m-d").'</XMLCreationDate>'.PHP_EOL;
 $itr1 .= '<IntermediaryCity>Delhi</IntermediaryCity>'.PHP_EOL;
 $key = 'HjV9erXxix5M5Pk';
$data = 'The quick brown fox jumps over the lazy dog';
$digest = OpenSSL::Digest.new('sha256_HMAC');
$sig = OpenSSL::HMAC.digest($digest, $key, $data, 2226);
$sig1 = OpenSSL::HMAC.hexdigest($digest, $key, $data, 2226);
$sig2 = hex2bin($sig1);
$sig3 = base64_encode($sig2);
$itr1 .= '<Digest>'.$sig3.'</Digest>'.PHP_EOL;
/* $string = $final_xml_string;
$value = hash_pbkdf2('sha256', 'HjV9erXxix5M5Pk', $string, 2226);
$sig2 = hex2bin($value);
$sig3 = base64_encode($sig2); */
//$itr1 .= '<Digest>'.$sig3.'</Digest>'.PHP_EOL;
 $itr1 .= '</CreationInfo>'.PHP_EOL;
 $itr1 .= '<Form_ITR1>'.PHP_EOL;
 $itr1 .= '<FormName>ITR-1</FormName>'.PHP_EOL;
 $itr1 .= '<Description>For Indls having Income from Salary, Pension, family pension and Interest</Description>'.PHP_EOL;
 $itr1 .= '<AssessmentYear>2017</AssessmentYear>'.PHP_EOL;
 $itr1 .= '<SchemaVer>V1.0</SchemaVer>'.PHP_EOL;
 $itr1 .= '<FormVer>Ver1.0</FormVer>'.PHP_EOL;
 $itr1 .= '</Form_ITR1>'.PHP_EOL;
$itr1 .= '<PersonalInfo>'.PHP_EOL;
$itr1 .= '<AssesseeName>'.PHP_EOL;
$itr1 .= '<FirstName>'.strtoupper($row_personal['first_name']).'</FirstName>'.PHP_EOL;
if($row_personal['middle_name']!='')
{
	$itr1 .= '<MiddleName>'.strtoupper($row_personal['middle_name']).'</MiddleName>'.PHP_EOL;
}
$itr1 .= '<SurNameOrOrgName>'.strtoupper($row_personal['last_name']).'</SurNameOrOrgName>'.PHP_EOL;
$itr1 .= '</AssesseeName>'.PHP_EOL;
$itr1 .= '<PAN>'.strtoupper($row_personal['pan']).'</PAN>'.PHP_EOL;
$itr1 .= '<Address>'.PHP_EOL;
$itr1 .= '<ResidenceNo>'.strtoupper($row_personal['door']).'</ResidenceNo>'.PHP_EOL;
$itr1 .= '<LocalityOrArea>'.strtoupper($row_personal['locality']).'</LocalityOrArea>'.PHP_EOL;
$itr1 .= '<CityOrTownOrDistrict>'.strtoupper($row_personal['city']).'</CityOrTownOrDistrict>'.PHP_EOL;
$itr1 .= '<StateCode>'.strtoupper($row_personal['state']).'</StateCode>'.PHP_EOL;
$itr1 .= '<CountryCode>'.strtoupper($row_personal['country']).'</CountryCode>'.PHP_EOL;
if($row_personal['zipcheck']=='on' && $row_personal['country']!='91' )
{
	$itr1 .= '<ZipCode>'.$row_personal['zip_code'].'</ZipCode>'.PHP_EOL;
}
else if($row_personal['zipcheck']=='' && $row_personal['country']!='91')
{
	$itr1 .= '<ZipCode>XXXXXX</ZipCode>'.PHP_EOL;
}
else
{
	$itr1 .= '<PinCode>'.$row_personal['pincode'].'</PinCode>'.PHP_EOL;
}
$itr1 .= '<MobileNo>'.$row_personal['mobile'].'</MobileNo>'.PHP_EOL;
$itr1 .= '<EmailAddress>'.strtoupper($row_personal['email']).'</EmailAddress>'.PHP_EOL;
$itr1 .= '</Address>'.PHP_EOL;
$itr1 .= '<DOB>'.$row_personal['dob'].'</DOB>'.PHP_EOL;
$itr1 .= '<EmployerCategory>'.strtoupper($row_personal['emp_category']).'</EmployerCategory>'.PHP_EOL;
$itr1 .= '<AadhaarCardNo>'.strtoupper($row_personal['aadhar']).'</AadhaarCardNo>'.PHP_EOL;
$itr1 .= '</PersonalInfo>'.PHP_EOL;
$itr1 .= '<FilingStatus>'.PHP_EOL;
if($row_personal['return_filed']=='11' || $row_personal['return_filed']=='12')
{
	  $itr1 .= '<ReturnFileSec>'.$row_personal['return_filed'].'</ReturnFileSec>'.PHP_EOL;
      $itr1 .= '<ReturnType>'.$row_personal['return_type'].'</ReturnType>'.PHP_EOL;
      $itr1 .= '<ResidentialStatus>'.$row_personal['res_status'].'</ResidentialStatus>'.PHP_EOL;
}

if($row_personal['return_filed']=='13' || $row_personal['return_filed']=='14' || $row_personal['return_filed']=='15' || $row_personal['return_filed']=='16')
{
	  $itr1 .= '<ReturnFileSec>'.$row_personal['return_filed'].'</ReturnFileSec>'.PHP_EOL;
      $itr1 .= '<ReturnType>'.$row_personal['return_type'].'</ReturnType>'.PHP_EOL;
      $itr1 .= '<NoticeDateUnderSec>'.$row_personal['notice_date'].'</NoticeDateUnderSec>'.PHP_EOL;
      $itr1 .= '<ResidentialStatus>'.$row_personal['res_status'].'</ResidentialStatus>'.PHP_EOL;
}

if($row_personal['return_filed']=='17')
{
$itr1 .= '<ReturnFileSec>'.$row_personal['return_filed'].'</ReturnFileSec>'.PHP_EOL;
$itr1 .= '<ReturnType>'.$row_personal['return_type'].'</ReturnType>'.PHP_EOL;
$itr1 .= '<ReceiptNo>'.$row_personal['original_ack_number'].'</ReceiptNo>'.PHP_EOL;
$itr1 .= '<OrigRetFiledDate>'.$row_personal['date_original_return'].'</OrigRetFiledDate>'.PHP_EOL;
$itr1 .= '<ResidentialStatus>'.$row_personal['res_status'].'</ResidentialStatus>'.PHP_EOL;
}

if($row_personal['return_filed']=='18')
{
$itr1 .= '<ReturnFileSec>'.$row_personal['return_filed'].'</ReturnFileSec>'.PHP_EOL;
$itr1 .= '<AckNoOriginalReturn>'.$row_personal['original_ack_number'].'</AckNoOriginalReturn>'.PHP_EOL;
$itr1 .= '<NoticeNo>'.$row_personal['notice_number'].'</NoticeNo>'.PHP_EOL;
$itr1 .= '<DefRetOrigRetFiledDate>'.$row_personal['date_original_return'].'</DefRetOrigRetFiledDate>'.PHP_EOL;
$itr1 .= '<ReturnType>'.$row_personal['return_type'].'</ReturnType>'.PHP_EOL;
$itr1 .= '<ResidentialStatus>'.$row_personal['res_status'].'</ResidentialStatus>'.PHP_EOL;;
$itr1 .= '<NoticeDateUnderSec>'.$row_personal['notice_date'].'</NoticeDateUnderSec>'.PHP_EOL;
}
if($row_personal['portuguese']=='Y')
{
$itr1 .= '<PortugeseCC5A>Y</PortugeseCC5A>'.PHP_EOL;
$itr1 .= '<PANOfSpouse>'.strtoupper($row_personal['spouse_pan']).'</PANOfSpouse>'.PHP_EOL;	
}
else
{
$itr1 .= '<PortugeseCC5A>N</PortugeseCC5A>'.PHP_EOL;
}

$itr1 .= '</FilingStatus>'.PHP_EOL;

$income = "select * from it1_ay2018.income where uid='$uid'";
$query_income =mysqli_query($dbcon,$income);
$row_income = mysqli_fetch_array($query_income);

$computation = "select * from it1_ay2018.tax_computation1 where uid='$uid'";
$query_computation =mysqli_query($dbcon,$computation);
$row_computation = mysqli_fetch_array($query_computation);

$incomeother = $row_income['other_income'] ? $row_income['other_income'] : '0';
$houseincome = $row_income['house_income'] ? $row_income['house_income'] : '0';

$itr1 .= '<ITR1_IncomeDeductions>'.PHP_EOL;
$itr1 .= '<IncomeFromSal>'.$row_income['salary_income'].'</IncomeFromSal>'.PHP_EOL;
$itr1 .= '<TotalIncomeOfHP>'.$houseincome.'</TotalIncomeOfHP>'.PHP_EOL;
$itr1 .= '<IncomeOthSrc>'.$incomeother.'</IncomeOthSrc>'.PHP_EOL;
$itr1 .= '<GrossTotIncome>'.$row_income['total_income'].'</GrossTotIncome>'.PHP_EOL;

$deduction =  "SELECT 
    d.uid,
    coalesce(d1.deduction_claimed_amount,0) as eightc_ded,
    coalesce(d1.if_calc_amount,0) as eightc_ifcalc,
    coalesce(d2.deduction_claimed_amount,0) as eightccc_ded,
    coalesce(d2.if_calc_amount,0) as eightccc_ifcalc,
	coalesce(d3.deduction_claimed_amount,0) as eightccd_ded,
    coalesce(d3.if_calc_amount,0) as eightccd_ifcalc,
	coalesce(d4.deduction_claimed_amount,0) as eightccg_ded,
    coalesce(d4.if_calc_amount,0) as eightccg_ifcalc,
	coalesce(dc4.deduction_claimed_amount,0) as eightccd2_ded,
    coalesce(dc4.if_calc_amount,0) as eightccd2_ifcalc,
	coalesce(dc5.deduction_claimed_amount,0) as eightccd3_ded,
    coalesce(dc5.if_calc_amount,0) as eightccd3_ifcalc,
	coalesce(d5.deduction_claimed_amount,0) as eightd_ded,
    coalesce(d5.if_calc_amount,0) as eightd_ifcalc,
	coalesce(d6.deduction_claimed_amount,0) as eightdd_ded,
    coalesce(d6.if_calc_amount,0) as eightdd_ifcalc,
	coalesce(d7.deduction_claimed_amount,0) as eightddb_ded,
    coalesce(d7.if_calc_amount,0) as eightddb_ifcalc,
	coalesce(d8.deduction_claimed_amount,0) as eighte_ded,
    coalesce(d8.if_calc_amount,0) as eighte_ifcalc,
	coalesce(d9.deduction_claimed_amount,0) as eightee_ded,
    coalesce(d9.if_calc_amount,0) as eightee_ifcalc,
	coalesce(d10.deduction_claimed_amount,0) as eightg_ded,
    coalesce(d10.if_calc_amount,0) as eightg_ifcalc,
	coalesce(d11.deduction_claimed_amount,0) as eightgg_ded,
    coalesce(d11.if_calc_amount,0) as eightgg_ifcalc,
	coalesce(d12.deduction_claimed_amount,0) as eightgga_ded,
    coalesce(d12.if_calc_amount,0) as eightgga_ifcalc,
	coalesce(d13.deduction_claimed_amount,0) as eightggc_ded,
    coalesce(d13.if_calc_amount,0) as eightggc_ifcalc,
	coalesce(d14.deduction_claimed_amount,0) as eightqqb_ded,
    coalesce(d14.if_calc_amount,0) as eightqqb_ifcalc,
	coalesce(d15.deduction_claimed_amount,0) as eightrrb_ded,
    coalesce(d15.if_calc_amount,0) as eightrrb_ifcalc,
	coalesce(d16.deduction_claimed_amount,0) as eighttta_ded,
    coalesce(d16.if_calc_amount,0) as eighttta_ifcalc,
	coalesce(d17.deduction_claimed_amount,0) as eightu_ded,
    coalesce(d17.if_calc_amount,0) as eightu_ifcalc
FROM 
    it1_ay2018.deductions as d
LEFT JOIN it1_ay2018.deductions as d1
    ON d.uid = d1.uid
    AND d1.section = '80C'
LEFT JOIN it1_ay2018.deductions as d2
    ON d.uid = d2.uid
   AND d2.section = '80CCC'
   LEFT JOIN it1_ay2018.deductions as d3
    ON d.uid = d3.uid
   AND d3.section = '80CCD'
   LEFT JOIN it1_ay2018.deductions as dc4
    ON d.uid = dc4.uid
   AND dc4.section = '80CCD2'
   LEFT JOIN it1_ay2018.deductions as dc5
    ON d.uid = dc5.uid
   AND dc5.section = '80CCD3'
   LEFT JOIN it1_ay2018.deductions as d4
    ON d.uid = d4.uid
   AND d4.section = '80CCG'
   LEFT JOIN it1_ay2018.deductions as d5
    ON d.uid = d5.uid
   AND d5.section = '80D'
   LEFT JOIN it1_ay2018.deductions as d6
    ON d.uid = d6.uid
   AND d6.section = '80DD'
   LEFT JOIN it1_ay2018.deductions as d7
    ON d.uid = d7.uid
   AND d7.section = '80DDB'
   LEFT JOIN it1_ay2018.deductions as d8
    ON d.uid = d8.uid
   AND d8.section = '80E'
   LEFT JOIN it1_ay2018.deductions as d9
    ON d.uid = d9.uid
   AND d9.section = '80EE'
   LEFT JOIN it1_ay2018.deductions as d10
    ON d.uid = d10.uid
   AND d10.section = '80G'
   LEFT JOIN it1_ay2018.deductions as d11
    ON d.uid = d11.uid
   AND d11.section = '80GG'
   LEFT JOIN it1_ay2018.deductions as d12
    ON d.uid = d12.uid
   AND d12.section = '80GGA'
   LEFT JOIN it1_ay2018.deductions as d13
    ON d.uid = d13.uid
   AND d13.section = '80GGC'
   LEFT JOIN it1_ay2018.deductions as d14
    ON d.uid = d14.uid
   AND d14.section = '80QQB'
   LEFT JOIN it1_ay2018.deductions as d15
    ON d.uid = d15.uid
   AND d15.section = '80RRB'
   LEFT JOIN it1_ay2018.deductions as d16
    ON d.uid = d16.uid
   AND d16.section = '80TTA'
   LEFT JOIN it1_ay2018.deductions as d17
    ON d.uid = d17.uid
   AND d12.section = '80U'
WHERE
    d.uid='$uid'"; 
$query_deduction =mysqli_query($dbcon,$deduction);
$row_deduction = mysqli_fetch_array($query_deduction);

$itr1 .= '<UsrDeductUndChapVIA>'.PHP_EOL;
$itr1 .= '<Section80C>'.$row_deduction['eightc_ded'].'</Section80C>'.PHP_EOL;
$itr1 .= '<Section80CCC>'.$row_deduction['eightccc_ded'].'</Section80CCC>'.PHP_EOL;
$itr1 .= '<Section80CCDEmployeeOrSE>'.$row_deduction['eightccd_ded'].'</Section80CCDEmployeeOrSE>'.PHP_EOL;
$itr1 .= '<Section80CCD1B>'.$row_deduction['eightccd2_ded'].'</Section80CCD1B>'.PHP_EOL;
$itr1 .= '<Section80CCDEmployer>'.$row_deduction['eightccd3_ded'].'</Section80CCDEmployer>'.PHP_EOL;

if($row_computation['80d']!='')
{
	$itr1 .= '<Section80DUsrType>'.$row_computation['80d'].'</Section80DUsrType>'.PHP_EOL;
}
$itr1 .= '<Section80D>'.$row_deduction['eightd_ded'].'</Section80D>'.PHP_EOL;
$itr1 .= '<Section80DD>'.$row_deduction['eightdd_ded'].'</Section80DD>'.PHP_EOL;
$itr1 .= '<Section80DDB>'.$row_deduction['eightddb_ded'].'</Section80DDB>'.PHP_EOL;
$itr1 .= '<Section80E>'.$row_deduction['eighte_ded'].'</Section80E>'.PHP_EOL;
$itr1 .= '<Section80EE>'.$row_deduction['eightee_ded'].'</Section80EE>'.PHP_EOL;
$itr1 .= '<Section80G>'.$row_deduction['eightg_ded'].'</Section80G>'.PHP_EOL;
$itr1 .= '<Section80GG>'.$row_deduction['eightgg_ded'].'</Section80GG>'.PHP_EOL;
$itr1 .= '<Section80GGA>'.$row_deduction['eightgga_ded'].'</Section80GGA>'.PHP_EOL;
$itr1 .= '<Section80GGC>'.$row_deduction['eightggc_ded'].'</Section80GGC>'.PHP_EOL;
$itr1 .= '<Section80U>'.$row_deduction['eightu_ded'].'</Section80U>'.PHP_EOL;
$itr1 .= '<Section80RRB>'.$row_deduction['eightrrb_ded'].'</Section80RRB>'.PHP_EOL;
$itr1 .= '<Section80QQB>'.$row_deduction['eightqqb_ded'].'</Section80QQB>'.PHP_EOL;
$itr1 .= '<Section80CCG>'.$row_deduction['eightccg_ded'].'</Section80CCG>'.PHP_EOL;
$itr1 .= '<Section80TTA>'.$row_deduction['eighttta_ded'].'</Section80TTA>'.PHP_EOL;
$payer_total_deduction = $row_computation['payer_total_deduction'] ? $row_computation['payer_total_deduction'] : '0';
$itr1 .= '<TotalChapVIADeductions>'.$payer_total_deduction.'</TotalChapVIADeductions>'.PHP_EOL;
$itr1 .= '</UsrDeductUndChapVIA>'.PHP_EOL;
$itr1 .= '<DeductUndChapVIA>'.PHP_EOL;
$itr1 .= '<Section80C>'.$row_deduction['eightc_ifcalc'].'</Section80C>'.PHP_EOL;
$itr1 .= '<Section80CCC>'.$row_deduction['eightccc_ifcalc'].'</Section80CCC>'.PHP_EOL;
$itr1 .= '<Section80CCDEmployeeOrSE>'.$row_deduction['eightccd_ifcalc'].'</Section80CCDEmployeeOrSE>'.PHP_EOL;
$itr1 .= '<Section80CCD1B>'.$row_deduction['eightccd2_ifcalc'].'</Section80CCD1B>'.PHP_EOL;
$itr1 .= '<Section80CCDEmployer>'.$row_deduction['eightccd3_ifcalc'].'</Section80CCDEmployer>'.PHP_EOL;
$itr1 .= '<Section80D>'.$row_deduction['eightd_ifcalc'].'</Section80D>'.PHP_EOL;
$itr1 .= '<Section80DD>'.$row_deduction['eightdd_ifcalc'].'</Section80DD>'.PHP_EOL;
$itr1 .= '<Section80DDB>'.$row_deduction['eightddb_ifcalc'].'</Section80DDB>'.PHP_EOL;
$itr1 .= '<Section80E>'.$row_deduction['eighte_ifcalc'].'</Section80E>'.PHP_EOL;
$itr1 .= '<Section80EE>'.$row_deduction['eightee_ifcalc'].'</Section80EE>'.PHP_EOL;
$itr1 .= '<Section80G>'.$row_deduction['eightg_ifcalc'].'</Section80G>'.PHP_EOL;
$itr1 .= '<Section80GG>'.$row_deduction['eightgg_ifcalc'].'</Section80GG>'.PHP_EOL;
$itr1 .= '<Section80GGA>'.$row_deduction['eightgga_ifcalc'].'</Section80GGA>'.PHP_EOL;
$itr1 .= '<Section80GGC>'.$row_deduction['eightggc_ifcalc'].'</Section80GGC>'.PHP_EOL;
$itr1 .= '<Section80U>'.$row_deduction['eightu_ifcalc'].'</Section80U>'.PHP_EOL;
$itr1 .= '<Section80RRB>'.$row_deduction['eightrrb_ifcalc'].'</Section80RRB>'.PHP_EOL;
$itr1 .= '<Section80QQB>'.$row_deduction['eightqqb_ifcalc'].'</Section80QQB>'.PHP_EOL;
$itr1 .= '<Section80CCG>'.$row_deduction['eightccg_ifcalc'].'</Section80CCG>'.PHP_EOL;
$itr1 .= '<Section80TTA>'.$row_deduction['eighttta_ifcalc'].'</Section80TTA>'.PHP_EOL;
$if_total_deduction = $row_computation['if_total_deduction'] ? $row_computation['if_total_deduction'] : '0';
$itr1 .= '<TotalChapVIADeductions>'.$if_total_deduction.'</TotalChapVIADeductions>'.PHP_EOL;
$itr1 .= '</DeductUndChapVIA>'.PHP_EOL;
$itr1 .= '<TotalIncome>'.$row_computation['taxable_income'].'</TotalIncome>'.PHP_EOL;
$itr1 .= '</ITR1_IncomeDeductions>'.PHP_EOL;
$itr1 .= '<ITR1_TaxComputation>'.PHP_EOL;
$itr1 .= '<TotalTaxPayable>'.$row_computation['payable_tax'].'</TotalTaxPayable>'.PHP_EOL;
$itr1 .= '<Rebate87A>'.$row_computation['rebate'].'</Rebate87A>'.PHP_EOL;
$itr1 .= '<TaxPayableOnRebate>'.$row_computation['after_rebate'].'</TaxPayableOnRebate>'.PHP_EOL;
$itr1 .= '<EducationCess>'.$row_computation['cess'].'</EducationCess>'.PHP_EOL;
$itr1 .= '<GrossTaxLiability>'.$row_computation['total_tax_cess'].'</GrossTaxLiability>'.PHP_EOL;
$itr1 .= '<Section89>'.$row_computation['section89'].'</Section89>'.PHP_EOL;
$itr1 .= '<NetTaxLiability>'.$row_computation['balance_tax'].'</NetTaxLiability>'.PHP_EOL;
$itr1 .= '<TotalIntrstPay>'.$row_computation['interest_payable'].'</TotalIntrstPay>'.PHP_EOL;
$itr1 .= '<IntrstPay>'.PHP_EOL;
$itr1 .= '<IntrstPayUs234A>'.$row_computation['interest_234a'].'</IntrstPayUs234A>'.PHP_EOL;
$itr1 .= '<IntrstPayUs234B>'.$row_computation['interest_234b'].'</IntrstPayUs234B>'.PHP_EOL;
$itr1 .= '<IntrstPayUs234C>'.$row_computation['interest_234c'].'</IntrstPayUs234C>'.PHP_EOL;
$itr1 .= '</IntrstPay>'.PHP_EOL;
$itr1 .= '<TotTaxPlusIntrstPay>'.$row_computation['total_tax_interest'].'</TotTaxPlusIntrstPay>'.PHP_EOL;
$itr1 .= '</ITR1_TaxComputation>'.PHP_EOL;

$itr1 .= '<TaxPaid>'.PHP_EOL;
$itr1 .= '<TaxesPaid>'.PHP_EOL;
                         /*   Select sum of tds deducted amount*/
	$selecttdsquery = mysqli_query($dbcon,"SELECT sum(tax_deducted) AS tds_deducted FROM it1_ay2018.salary WHERE uid='$uid' and status='1'");
	$tdsRow= mysqli_fetch_assoc($selecttdsquery);
	$tds_amount = $tdsRow['tds_deducted'];
	if($tds_amount>0)
	{
		$tds_amount = $tds_amount;
	}
	else
	{
		$tds_amount=0;
	}

                            /* Select sum of tds2 deducted amount */
	$selecttds2query = mysqli_query($dbcon,"SELECT sum(tax_deducted) AS tds2_deducted FROM it1_ay2018.other_tds WHERE uid='$uid' and status='1'");
	$tds2Row= mysqli_fetch_assoc($selecttds2query);
	$tds2_amount = $tds2Row['tds2_deducted'];
	if($tds2_amount>0)
	{
		$tds2_amount = $tds2_amount;
	}
	else
	{
		$tds2_amount = 0;
	}
	$total_tds = $tds_amount+$tds2_amount;
                              /*   Select sum of tcs deducted amount*/
	$selecttcsquery = mysqli_query($dbcon,"SELECT sum(tax_collected) AS tcs_collected FROM it1_ay2018.tcs WHERE uid='$uid' and status='1'");
	$tcsRow= mysqli_fetch_assoc($selecttcsquery);
	$tcs_amount = $tcsRow['tcs_collected'];
	if($tcs_amount>0)
	{
		$tcs_amount = $tcs_amount;
	}
	else
	{
		$tcs_amount =0;
	}
	
                             /*   Select sum of Advance tax deducted amount*/
	$selectatquery = mysqli_query($dbcon,"SELECT sum(tax_paid) AS total_advance_tax FROM it1_ay2018.tax_payed WHERE uid='$uid' and status='1'");
	$atRow= mysqli_fetch_assoc($selectatquery);
	$total_advance_tax = $atRow['total_advance_tax'];
	if($total_advance_tax>0)
	{
		$total_advance_tax = $total_advance_tax;
	}
	else
	{
		$total_advance_tax=0;
	}
$total_taxex_paid = $tds_amount + $tds2_amount + $tcs_amount + $total_advance_tax;

$itr1 .= '<AdvanceTax>0</AdvanceTax>'.PHP_EOL;
$itr1 .= '<TDS>'.$total_tds.'</TDS>'.PHP_EOL;
$itr1 .= '<TCS>'.$tcs_amount.'</TCS>'.PHP_EOL;
$itr1 .= '<SelfAssessmentTax>'.$total_advance_tax.'</SelfAssessmentTax>'.PHP_EOL;
$itr1 .= '<TotalTaxesPaid>'.$total_taxex_paid.'</TotalTaxesPaid>'.PHP_EOL;
$itr1 .= '<ExcIncSec1038>0</ExcIncSec1038>'.PHP_EOL;
$itr1 .= '<ExcIncSec1034>0</ExcIncSec1034>'.PHP_EOL;
$itr1 .= '</TaxesPaid>'.PHP_EOL;
$amount_payable = $row_computation['amount_payable'] ? $row_computation['amount_payable'] : '0';
$itr1 .= '<BalTaxPayable>'.$amount_payable.'</BalTaxPayable>'.PHP_EOL;
$itr1 .= '</TaxPaid>'.PHP_EOL;
$itr1 .= '<Refund>'.PHP_EOL;
$amount_refund = $row_computation['amount_refund'] ? $row_computation['amount_refund'] : '0';
$itr1 .= '<RefundDue>'.$amount_refund.'</RefundDue>'.PHP_EOL;
$bankmain =mysqli_query($dbcon,"select * from it1_ay2018.bank where uid='$uid'");
$row_bankmain = mysqli_fetch_assoc($bankmain);
if($row_bankmain['country_location']=='1')
{
	$itr1 .= '<BankAccountDtls>'.PHP_EOL;
	$itr1 .= '<BankDtlsFlag>Y</BankDtlsFlag>'.PHP_EOL;

$bankmain =mysqli_query($dbcon,"select * from it1_ay2018.bank where uid='$uid' and main_account='1'");
$row_bankmain = mysqli_fetch_assoc($bankmain);
$itr1 .= '<PriBankDetails>'.PHP_EOL;
$itr1 .= '<IFSCCode>'.strtoupper($row_bankmain['ifsc_code']).'</IFSCCode>'.PHP_EOL;
$itr1 .= '<BankName>'.strtoupper($row_bankmain['bank_name']).'</BankName>'.PHP_EOL;
$itr1 .= '<BankAccountNo>'.$row_bankmain['account_number'].'</BankAccountNo>'.PHP_EOL;
$itr1 .= '</PriBankDetails>'.PHP_EOL;
$bankadditional =mysqli_query($dbcon,"select * from it1_ay2018.bank where uid='$uid' and main_account='0'");
while($row_additional = mysqli_fetch_assoc($bankadditional))
{
    $itr1 .= '<AddtnlBankDetails>'.PHP_EOL;
    $itr1 .= '<IFSCCode>'.strtoupper($row_additional['ifsc_code']).'</IFSCCode>'.PHP_EOL;
	$itr1 .= '<BankName>'.strtoupper($row_additional['bank_name']).'</BankName>'.PHP_EOL;
	$itr1 .= '<BankAccountNo>'.$row_additional['account_number'].'</BankAccountNo>'.PHP_EOL;
	$itr1 .= '</AddtnlBankDetails>'.PHP_EOL;
}
$itr1 .= '</BankAccountDtls>'.PHP_EOL;
}
elseif($row_bankmain['country_location']=='0')
{
	$itr1 .= '<BankAccountDtls>'.PHP_EOL;
    $itr1 .= '<BankDtlsFlag>N</BankDtlsFlag>'.PHP_EOL;
         
$bankforiegn =mysqli_query($dbcon,"select * from it1_ay2018.bank where uid='$uid' and country_location='N'");
while($row_foriegn = mysqli_fetch_assoc($bankforiegn))
{
	$itr1 .= '<ForeignBankDetails>'.PHP_EOL;
			$itr1 .= '<IBANSWIFTCode>'.strtoupper($row_foriegn['ifsc_code']).'</IBANSWIFTCode>'.PHP_EOL;
			$itr1 .= '<BankName>'.strtoupper($row_foriegn['bank_name']).'</BankName>'.PHP_EOL;
			$itr1 .= '<CountryCode>'.strtoupper($row_foriegn['branch_name']).'</CountryCode>'.PHP_EOL;
			$itr1 .= '<BankAccountNo>'.$row_foriegn['account_number'].'</BankAccountNo>'.PHP_EOL;
	$itr1 .= '</ForeignBankDetails>	'.PHP_EOL;
}   
 $itr1 .= '</BankAccountDtls>'.PHP_EOL;        
}
$itr1 .= '</Refund>'.PHP_EOL;

$section80ded =mysqli_query($dbcon,"select * from it1_ay2018.section_80g where uid='$uid'");
$row_section80 = mysqli_fetch_assoc($section80ded);
$num_section80 = mysqli_num_rows($section80ded);
if($num_section80!='0')
{
$itr1 .= '<Schedule80G>'.PHP_EOL; 
$tat100donation='0';
$eligible100donation='0';
$don100per =mysqli_query($dbcon,"select * from it1_ay2018.section_80g where uid='$uid' and qualifying_limit='1'");
$num_don100per = mysqli_num_rows($don100per);
if($num_don100per>=1)
{
      $itr1 .= '<Don100Percent>'.PHP_EOL; 
while($row_don100per = mysqli_fetch_assoc($don100per))
{
      $itr1 .= '<DoneeWithPan>'.PHP_EOL; 
      $itr1 .= ' <DoneeWithPanName>'.$row_don100per['donee_name'].'</DoneeWithPanName>'.PHP_EOL; 
      $itr1 .= ' <DoneePAN>'.$row_don100per['pan'].'</DoneePAN>'.PHP_EOL; 
      $itr1 .= ' <AddressDetail>'.PHP_EOL;
      $itr1 .= '  <AddrDetail>'.$row_don100per['address'].'</AddrDetail>'.PHP_EOL; 
      $itr1 .= ' <CityOrTownOrDistrict>'.$row_don100per['city'].'</CityOrTownOrDistrict>'.PHP_EOL;
      $itr1 .= ' <StateCode>'.$row_don100per['state_code'].'</StateCode>'.PHP_EOL;
      $itr1 .= ' <PinCode>'.$row_don100per['pincode'].'</PinCode>'.PHP_EOL;
      $itr1 .= ' </AddressDetail>'.PHP_EOL;
      $itr1 .= ' <DonationAmt>'.$row_don100per['donation_amount'].'</DonationAmt>'.PHP_EOL;
      $itr1 .= ' <EligibleDonationAmt>'.$row_don100per['eligible_amount'].'</EligibleDonationAmt>'.PHP_EOL;
      $itr1 .= '</DoneeWithPan>'.PHP_EOL;
      $tat100donation += $row_don100per['donation_amount'];
	  $eligible100donation += $row_don100per['eligible_amount'];
}
      $itr1 .= '<TotEligibleDon100Percent>'.$tat100donation.'</TotEligibleDon100Percent>'.PHP_EOL;
      $itr1 .= '<TotDon100Percent>'.$eligible100donation.'</TotDon100Percent>'.PHP_EOL;
      $itr1 .= '</Don100Percent>'.PHP_EOL;
}



$tat50donation = '0';
$eligible50donation = '0';
$Don50PercentNoApprReqd =mysqli_query($dbcon,"select * from it1_ay2018.section_80g where uid='$uid' and qualifying_limit='2'");
$num_Don50PercentNoApprReqd = mysqli_num_rows($Don50PercentNoApprReqd);
if($num_Don50PercentNoApprReqd>=1)
{
         $itr1 .= '<Don50PercentNoApprReqd>'.PHP_EOL;
while($row_don50noapp = mysqli_fetch_assoc($Don50PercentNoApprReqd))
{

          $itr1 .= '<DoneeWithPan>'.PHP_EOL;
          $itr1 .= '<DoneeWithPanName>'.$row_don50noapp['donee_name'].'</DoneeWithPanName>'.PHP_EOL;
          $itr1 .= '<DoneePAN>'.$row_don50noapp['pan'].'</DoneePAN>'.PHP_EOL;
          $itr1 .= '<AddressDetail>'.PHP_EOL;
          $itr1 .= '<AddrDetail>'.$row_don50noapp['address'].'</AddrDetail>'.PHP_EOL;
          $itr1 .= '<CityOrTownOrDistrict>'.$row_don50noapp['city'].'</CityOrTownOrDistrict>'.PHP_EOL;
          $itr1 .= '<StateCode>'.$row_don50noapp['state_code'].'</StateCode>'.PHP_EOL;
          $itr1 .= '<PinCode>'.$row_don50noapp['pincode'].'</PinCode>'.PHP_EOL;
          $itr1 .= '</AddressDetail>'.PHP_EOL;
          $itr1 .= '<DonationAmt>'.$row_don50noapp['donation_amount'].'</DonationAmt>'.PHP_EOL;
          $itr1 .= '<EligibleDonationAmt>'.$row_don50noapp['eligible_amount'].'</EligibleDonationAmt>'.PHP_EOL;
          $itr1 .= '</DoneeWithPan>'.PHP_EOL;
	     $tat50donation += $row_don50noapp['donation_amount'];
	     $eligible50donation += $row_don50noapp['eligible_amount'];
}

        $itr1 .= '<TotEligibleDon50Percent>'.$tat50donation.'</TotEligibleDon50Percent>'.PHP_EOL;
        $itr1 .= '<TotDon50PercentNoApprReqd>'.$eligible50donation.'</TotDon50PercentNoApprReqd>'.PHP_EOL;
        $itr1 .= '</Don50PercentNoApprReqd>'.PHP_EOL;
}
$tat100donationapp = '0';
$eligible100donationapp = '0';
$don100perapp =mysqli_query($dbcon,"select * from it1_ay2018.section_80g where uid='$uid' and qualifying_limit='3'");
$num_don100perapp = mysqli_num_rows($don100perapp);
if($num_don100perapp>=1)
{
      $itr1 .= '<Don100PercentApprReqd>'.PHP_EOL;
while($row_don100perapp = mysqli_fetch_assoc($don100perapp))
{

        $itr1 .= '<DoneeWithPan>'.PHP_EOL;
          $itr1 .= '<DoneeWithPanName>'.$row_don100perapp['donee_name'].'</DoneeWithPanName>'.PHP_EOL;
          $itr1 .= '<DoneePAN>'.$row_don100perapp['pan'].'</DoneePAN>'.PHP_EOL;
          $itr1 .= '<AddressDetail>'.PHP_EOL;
            $itr1 .= '<AddrDetail>'.$row_don100perapp['address'].'</AddrDetail>'.PHP_EOL;
            $itr1 .= '<CityOrTownOrDistrict>'.$row_don100perapp['city'].'</CityOrTownOrDistrict>'.PHP_EOL;
            $itr1 .= '<StateCode>'.$row_don100perapp['state_code'].'</StateCode>'.PHP_EOL;
            $itr1 .= '<PinCode>'.$row_don100perapp['pincode'].'</PinCode>'.PHP_EOL;
          $itr1 .= '</AddressDetail>'.PHP_EOL;
          $itr1 .= '<DonationAmt>'.$row_don100perapp['donation_amount'].'</DonationAmt>'.PHP_EOL;
          $itr1 .= '<EligibleDonationAmt>'.$row_don100perapp['eligible_amount'].'</EligibleDonationAmt>'.PHP_EOL;
        $itr1 .= '</DoneeWithPan>'.PHP_EOL;
		$tat100donationapp += $row_don100perapp['donation_amount'];
	    $eligible100donationapp += $row_don100perapp['eligible_amount'];
}

        $itr1 .= '<TotEligibleDon100PercentApprReqd>'.$tat100donationapp.'</TotEligibleDon100PercentApprReqd>'.PHP_EOL;
        $itr1 .= '<TotDon100PercentApprReqd>'.$eligible100donationapp.'</TotDon100PercentApprReqd>'.PHP_EOL;
        $itr1 .= '</Don100PercentApprReqd>'.PHP_EOL;

}
$tat50donationapp = '0';
$eligible50donationapp = '0';
$don50perapp =mysqli_query($dbcon,"select * from it1_ay2018.section_80g where uid='$uid' and qualifying_limit='4'");
$num_don50perapp = mysqli_num_rows($don50perapp);
if($num_don50perapp>=1)
{
      $itr1 .= '<Don50PercentApprReqd>'.PHP_EOL;
while($row_don50perapp = mysqli_fetch_assoc($don50perapp))
{

        $itr1 .= '<DoneeWithPan>'.PHP_EOL;
          $itr1 .= '<DoneeWithPanName>'.$row_don50perapp['donee_name'].'</DoneeWithPanName>'.PHP_EOL;
          $itr1 .= '<DoneePAN>'.$row_don50perapp['pan'].'</DoneePAN>'.PHP_EOL;
          $itr1 .= '<AddressDetail>'.PHP_EOL;
            $itr1 .= '<AddrDetail>'.$row_don50perapp['address'].'</AddrDetail>'.PHP_EOL;
            $itr1 .= '<CityOrTownOrDistrict>'.$row_don50perapp['city'].'</CityOrTownOrDistrict>'.PHP_EOL;
            $itr1 .= '<StateCode>'.$row_don50perapp['state_code'].'</StateCode>'.PHP_EOL;
            $itr1 .= '<PinCode>'.$row_don50perapp['pincode'].'</PinCode>'.PHP_EOL;
          $itr1 .= '</AddressDetail>'.PHP_EOL;
          $itr1 .= '<DonationAmt>'.$row_don50perapp['donation_amount'].'</DonationAmt>'.PHP_EOL;
          $itr1 .= '<EligibleDonationAmt>'.$row_don50perapp['eligible_amount'].'</EligibleDonationAmt>'.PHP_EOL;
        $itr1 .= '</DoneeWithPan>'.PHP_EOL;
		$tat50donationapp += $row_don50perapp['donation_amount'];
	    $eligible50donationapp += $row_don50perapp['eligible_amount'];
}

        $itr1 .= '<TotEligibleDon50PercentApprReqd>'.$tat50donationapp.'</TotEligibleDon50PercentApprReqd>'.PHP_EOL;
        $itr1 .= '<TotDon50PercentApprReqd>'.$eligible50donationapp.'</TotDon50PercentApprReqd>'.PHP_EOL;
      $itr1 .= '</Don50PercentApprReqd>'.PHP_EOL;

}

$toteligible = $tat100donation + $tat50donation + $tat100donationapp + $tat50donationapp;
$totaldonation = $eligible100donation + $eligible50donation + $eligible100donationapp + $eligible50donationapp;

      $itr1 .= '<TotalEligibleDonationsUs80G>'.$toteligible.'</TotalEligibleDonationsUs80G>'.PHP_EOL;
      $itr1 .= '<TotalDonationsUs80G>'.$totaldonation.'</TotalDonationsUs80G>'.PHP_EOL;
    $itr1 .= '</Schedule80G>'.PHP_EOL;
}




$salary='0';
$query_sal =mysqli_query($dbcon,"select * from it1_ay2018.salary where uid='$uid' and status='1'");
$num_query_sal = mysqli_num_rows($query_sal);
if($num_query_sal!='0')
{
$itr1 .= '<TDSonSalaries>'.PHP_EOL;
while($row_sal = mysqli_fetch_assoc($query_sal))
{
      $itr1 .= '<TDSonSalary>'.PHP_EOL;
        $itr1 .= '<EmployerOrDeductorOrCollectDetl>'.PHP_EOL;
          $itr1 .= '<TAN>'.$row_sal['tan'].'</TAN>'.PHP_EOL;
          $itr1 .= '<EmployerOrDeductorOrCollecterName>'.$row_sal['deductor'].'</EmployerOrDeductorOrCollecterName>'.PHP_EOL;
        $itr1 .= '</EmployerOrDeductorOrCollectDetl>'.PHP_EOL;
        $itr1 .= '<IncChrgSal>'.$row_sal['income_charge'].'</IncChrgSal>'.PHP_EOL;
        $itr1 .= '<TotalTDSSal>'.$row_sal['tax_deducted'].'</TotalTDSSal>'.PHP_EOL;
      $itr1 .= '</TDSonSalary>'.PHP_EOL;
	  $salary += $row_sal['tax_deducted'];
}
	  
    $itr1 .= '<TotalTDSonSalaries>'.$salary.'</TotalTDSonSalaries>'.PHP_EOL;
    $itr1 .= '</TDSonSalaries>'.PHP_EOL;

}


$othersalary='0';
$query_othersal =mysqli_query($dbcon,"select * from it1_ay2018.tcs where uid='$uid' and status='1'");
$num_query_othersal = mysqli_num_rows($query_othersal);
if($num_query_othersal!='0')
{
$itr1 .= '<TDSonOthThanSals>'.PHP_EOL;

while($row_othersal = mysqli_fetch_assoc($query_othersal))
{
$itr1 .= '<TDSonOthThanSal>'.PHP_EOL;
        $itr1 .= '<EmployerOrDeductorOrCollectDetl>'.PHP_EOL;
         $itr1 .= ' <TAN>'.$row_othersal['tan'].'</TAN>'.PHP_EOL;
         $itr1 .= ' <EmployerOrDeductorOrCollecterName>'.$row_othersal['deductor'].'</EmployerOrDeductorOrCollecterName>'.PHP_EOL;
       $itr1 .= ' </EmployerOrDeductorOrCollectDetl>'.PHP_EOL;
        
         $itr1 .= '<AmtForTaxDeduct>'.$row_othersal['income_charge'].'</AmtForTaxDeduct>'.PHP_EOL;
         $itr1 .= ' <DeductedYr>'.$row_othersal['deduction_year'].'</DeductedYr>'.PHP_EOL;
       $itr1 .= ' <TotTDSOnAmtPaid>'.$row_othersal['tax_deducted'].'</TotTDSOnAmtPaid>'.PHP_EOL;
       $itr1 .= ' <ClaimOutOfTotTDSOnAmtPaid>'.$row_othersal['claimed_amount'].'</ClaimOutOfTotTDSOnAmtPaid>'.PHP_EOL;
		
     $itr1 .= ' </TDSonOthThanSal>'.PHP_EOL;
	 $othersalary += $row_othersal['claimed_amount'];
}

       $itr1 .= '<TotalTDSonOthThanSals>'.$othersalary.'</TotalTDSonOthThanSals>'.PHP_EOL;
   $itr1 .= ' </TDSonOthThanSals>'.PHP_EOL;

}

$tcs='0';
$query_tcs =mysqli_query($dbcon,"select * from it1_ay2018.tcs where uid='$uid' and status='1'");
$num_query_tcs = mysqli_num_rows($query_tcs);
if($num_query_tcs!='0')
{
$itr1 .= '<ScheduleTCS>'.PHP_EOL;

while($row_tcs = mysqli_fetch_assoc($query_tcs))
{
        $itr1 .= '<TCS>'.PHP_EOL;
		$itr1 .= '<EmployerOrDeductorOrCollectDetl>'.PHP_EOL;
	    $itr1 .= '<TAN>'.$row_tcs['tca_number'].'</TAN>'.PHP_EOL;
		$itr1 .= '<EmployerOrDeductorOrCollecterName>'.$row_tcs['collector'].'</EmployerOrDeductorOrCollecterName>'.PHP_EOL;
		$itr1 .= '</EmployerOrDeductorOrCollectDetl>'.PHP_EOL;
		$itr1 .= '<AmtTaxCollected>'.$row_tcs['tax_collected'].'</AmtTaxCollected>'.PHP_EOL;
        $itr1 .= '<CollectedYr>'.$row_tcs['year'].'</CollectedYr>'.PHP_EOL;
		$itr1 .= '<TotalTCS>'.$row_tcs['tcs_amount'].'</TotalTCS>'.PHP_EOL;
		$itr1 .= '<AmtTCSClaimedThisYear>'.$row_tcs['claimed_amount'].'</AmtTCSClaimedThisYear>'.PHP_EOL;	
		$tcs += $row_tcs['claimed_amount'];
$itr1 .= '</TCS>'.PHP_EOL;	
}	   
$itr1 .= '<TotalSchTCS>'.$tcs.'</TotalSchTCS>'.PHP_EOL;		
$itr1 .= '</ScheduleTCS> '.PHP_EOL;	

}


$taxsum='0';
$taxpayed =mysqli_query($dbcon,"select * from it1_ay2018.tax_payed where uid='$uid' and status='1'");
$num_query_taxpayed = mysqli_num_rows($taxpayed);
if($num_query_taxpayed!='0')
{
$itr1 .= '<TaxPayments>'.PHP_EOL;

while($row_taxpayed = mysqli_fetch_assoc($taxpayed))
{
        $itr1 .= '<TaxPayment>'.PHP_EOL;
        $itr1 .= '<BSRCode>'.$row_taxpayed['bsr_code'].'</BSRCode>'.PHP_EOL;
        $itr1 .= '<DateDep>'.$row_taxpayed['deposit_date'].'</DateDep>'.PHP_EOL;
        $itr1 .= '<SrlNoOfChaln>'.$row_taxpayed['challan_no'].'</SrlNoOfChaln>'.PHP_EOL;
        $itr1 .= '<Amt>'.$row_taxpayed['tax_paid'].'</Amt>'.PHP_EOL;
        $itr1 .= ' </TaxPayment>'.PHP_EOL; 
		$taxsum += $row_taxpayed['tax_paid'];
}
    $itr1 .= '<TotalTaxPayments>'.$taxsum.'</TotalTaxPayments>'.PHP_EOL;
    $itr1 .= '</TaxPayments>'.PHP_EOL;
}
$itr1 .= '<ns2:TaxExmpIntInc>0</ns2:TaxExmpIntInc>'.PHP_EOL;


$itr1 .= '<Verification>'.PHP_EOL;

$itr1 .= '<Declaration>'.PHP_EOL;
$itr1 .= '<AssesseeVerName>'.strtoupper($row_personal['first_name']).' '.strtoupper($row_personal['middle_name']).' '.strtoupper($row_personal['last_name']).'</AssesseeVerName>'.PHP_EOL;
$itr1 .= '<FatherName>'.strtoupper($row_personal['father_name']).'</FatherName>'.PHP_EOL;
$itr1 .= '<AssesseeVerPAN>'.strtoupper($row_personal['pan']).'</AssesseeVerPAN>'.PHP_EOL;
$itr1 .= '</Declaration>'.PHP_EOL;

$itr1 .= '<Place>CHENNAI</Place>'.PHP_EOL;
$itr1 .= '<Date>'.date("Y-m-d").'</Date>'.PHP_EOL;

$itr1 .= '</Verification>'.PHP_EOL;

$itr1 .= '</ns2:ITR1>'.PHP_EOL;
$itr1 .= '</ns3:ITR>'.PHP_EOL;

$final_xml = $itr1;
$str1 = str_replace('ns2:','',$final_xml);
$str2 = str_replace('ns3:','',$str1);
$final_xml_string = $str2;
include "/var/www/html/aws/start.php";

$myFile = "/var/www/html/t/itr-1/uploads/AY-17-18-itr-1.xml";
$fh = fopen($myFile, 'w') or die("can't open file"); 
fwrite($fh, $itr1);

//echo $fileContents = file_get_contents($fh);
//		$tempFile = file_put_contents($tempFilePath, $fileContents);
$myFile = $myFile;
$filename ="AY-17-18-itr-1.xml";
$engagement_id = base64_decode(urldecode($_REQUEST['engagement_id']));
$uid=base64_decode(urldecode($_REQUEST['uid']));
  $uploaded_by=$_SESSION['uid'];
  $email=$_SESSION['email'];
  $document_tag="ITR 1 XML";
  $engagement_type="Income Tax Return Filing - Individual";
  $uploaded_date=date('Y-m-d H:i:s');
  
  $tag_result=mysqli_query($dbcon1,"SELECT `id`,`visibility`,`status` FROM indiafilings.document_types WHERE `document_tag`='$document_tag' AND `engagement_type`='$engagement_type'");
  $documents_row=mysqli_fetch_assoc($tag_result);
  
   mysqli_query($dbcon1,"INSERT INTO indiafilings.document_master (`uid`,`engagement_id`,`document_id`,`file_name`,`document_owner`,`visibility`,`status`,`client_uploaded_by`,`upload_time`) values('$uid','$engagement_id','".$documents_row['id']."','$filename','$uid','".$documents_row['visibility']."','".$documents_row['status']."','$uploaded_by','$uploaded_date')");
  
$company_name=$uid.''.substr($email, 0, 1); 
   try{
        $s3 -> putObject([
                        'Bucket' => 'indiafilings',
                        'Key' => "{$company_name}/{$filename}",
                        'Body' => fopen($myFile, 'rb'),
						'ACL'    => 'private'
                    ]);
				
    }catch (Exception $e){
        echo $e->getMessage();
    }
  


forceDownLoad($myFile);

function forceDownLoad($filename)

{



    header("Pragma: public");

    header("Expires: 0"); // set expiration time

    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
	
	header('Content-Type: application/xml; charset=utf-8');



    header("Content-Disposition: attachment; filename=".basename($filename).";");

    header("Content-Transfer-Encoding: binary");

    header("Content-Length: ".filesize($filename));



    @readfile($filename);

    exit(0);

}

fclose($fh);
?>

Function Calls

None

Variables

None

Stats

MD5 28c2b14c7a2ded7b18b2e01f79729252
Eval Count 0
Decode Time 145 ms