Updated EXETEL billing CSV import

This commit is contained in:
Deon George 2016-04-18 20:53:33 +10:00
parent f1fae0c28c
commit 08bd2a2810

View File

@ -110,12 +110,12 @@ class ADSL_Billing_Exetelvisp {
if (! count($record) >= 7) if (! count($record) >= 7)
throw HTTP_Exception::factory(501,'Format of CSV file changed? (:record)',array(':record'=>$record)); throw HTTP_Exception::factory(501,'Format of CSV file changed? (:record)',array(':record'=>$record));
if (preg_match('/Monthly Internet Charge On Plan /',$record[3])) { if (preg_match('/Monthly Internet Charge On Plan /',$record[4])) {
list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[3]))); list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[4])));
$result[$service]['cost'] = str_replace('$','',$record[6]); $result[$service]['cost'] = str_replace('$','',$record[6]);
} elseif (preg_match('/([0-9]+)\s+-\s+Monthly Charge On Plan /',$record[3])) { } elseif (preg_match('/([0-9]+)\s+-\s+Monthly Internet Charge On Plan /',$record[4])) {
list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[3]))); list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[4])));
$result[$service]['cost'] = str_replace('$','',$record[6]); $result[$service]['cost'] = str_replace('$','',$record[6]);
$result[$service]['info'] = 'Other Service'; $result[$service]['info'] = 'Other Service';
@ -124,12 +124,12 @@ class ADSL_Billing_Exetelvisp {
$result[$service]['cost'] = str_replace('$','',$record[6]); $result[$service]['cost'] = str_replace('$','',$record[6]);
$result[$service]['info'] = 'VOIP Service'; $result[$service]['info'] = 'VOIP Service';
} elseif (preg_match('/VISP Credit/',$record[3])) { } elseif (preg_match('/VISP Credit/',$record[4])) {
list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[3]))); list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[4])));
$result[$service]['credit'] = str_replace('$','',$record[6]); $result[$service]['credit'] = str_replace('$','',$record[6]);
} elseif (preg_match('/Excess usage charges/',$record[3])) { } elseif (preg_match('/Excess usage charges/',$record[4])) {
list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[3]))); list($service,$description) = explode(':',(preg_replace('/([0-9]+)\s+-\s+(.*)$/',"$1:$2",$record[4])));
$result[$service]['excess'] = str_replace('$','',$record[7]); $result[$service]['excess'] = str_replace('$','',$record[7]);
// Ignore Payment For Invoice lines // Ignore Payment For Invoice lines