Jump to content

[SOLVED] Update VAT


Schlo_50

Recommended Posts

Hi guys,

 

I need to update a price list to comply with the VAT rate at 15%. Unfortunately for me the price list is stored in a flat file database so updating it isn't as easy as a MySQL one.

 

Could someone point me in the right direction to updating the price using the code I have so far please?

 

<?php
$Lines = file("priceList.DAT");

foreach($Lines as $Key => $Val) { 

  $Data[$Key] = explode("|", $Val);
  
	 $one = $Data[$Key][0];
 $two = $Data[$Key][1];
 $three = $Data[$Key][2];
 $four = $Data[$Key][3];
 $five = $Data[$Key][4];
 $six = $Data[$Key][5];
   
   $newVAT = $five / 47 * 46;
   round($newVAT, 2);
   
//Need to replace $five with $newVAT here..

}
?>

 

Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/135154-solved-update-vat/
Share on other sites

Don't reduce your VAT. You'll make more profit!

 

Then when it goes back up in Jan 2010 (UK), complain to your customers how you have had to put prices up because the government have just put VAT back up.

 

They'll never remember that you never dropped it in the first place.

 

At least this is what a lot of companies are doing!

 

Although if you deal B2B then this is irrelevant.

Link to comment
https://forums.phpfreaks.com/topic/135154-solved-update-vat/#findComment-703937
Share on other sites

<?php
$Lines = file("priceList.DAT");

foreach($Lines as $Key => $Val) { 

  $Data[$Key] = explode("|", $Val);
  
   $newVAT = $Data[$Key][4] / 47 * 46;
   round($newVAT, 2);

$Data[$Key][4] = $newVAT;   //I forgot about this 
$newline = implode("|",$Data[$Key]);
$newData[] = $newline;
echo $newline;
}

// now you just need to save $newData to a file

?>

 

[edit]

 

Forgot one important line ;)

Link to comment
https://forums.phpfreaks.com/topic/135154-solved-update-vat/#findComment-704213
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.