protected function pipeToArray($pipe_delim){
$lines = explode("\n", str_replace("\r\n","\n",$pipe_delim));
//Subsets of each statement
$statement = array(
'statement' => array(),
'client' => array(),
'guarantor' => array(),
'patient' => array(),
'unrolled_data' => array(),
'rolled_data' => array(),
'paymentplan_options' => array(),
'paymentplan' =>array()
);
//Loop through the lines
foreach ($lines as $raw_line) {
//Split into cells
$line = explode("|",$raw_line);
switch ($line[0]) {
case 'N6' :
//Unrolled Account Information
$index = count($statement['unrolled_data']);
foreach($statement['unrolled_data'] as $i => $enc){
if($enc['encounterid'] === $line[1]) {
$index = $i;
continue;
}
}
$statement['unrolled_data'][$index]['txns'][] = array(
//'encounterid' => $line[1],
//'provider_name' => $line[2],
'date' => $line[3],
'type' => $line[4],
'description' => $line[5],
'amount' => $line[6]
//'left_to_pay' => $line[7]
);
break;
case 'A6' :
//Rolled Account Information
$statement['rolled_data'][] = array(
'encounterid' => $line[1],
'provider' => $line[2],
'description' => $line[3],
'date' => $line[4],
'charged' => $line[5],
'adjustments' => $line[6],
'payments' => $line[7],
'left_to_pay' => $line[8]
);
break;
}
}
return $statement;
}
/**
* Return the pdf buffer string
* @return String pdf buffer
* @todo THESE ARE BEING HARDCODED TO TEMPLATEIDS... THIS SHOULD BE DONE ELSEWHERE, IN A BUILDER/FACTORY PERHAPS.
*/
protected function toPDF(){
if($this->statement_data['statement']['templateid'] == 4) {
$image = new StandardStatementPDFGenerator($this);
} else if ($this->statement_data['statement']['templateid'] == 9) {
$image = new LetterStatementPDFGenerator($this);
} else {
//This is a "Fail Gracefully" measure. We haven't generated a statement
//without a templateid since July 2013, so we shouldn't hit this moving
//forward.
$image = new StandardStatementPDFGenerator($this);
}
return $image->getStream();
}
//Unrolled Account Information
$index = count($statement['unrolled_data']);
foreach($statement['unrolled_data'] as $i => $enc){
if($enc['encounterid'] === $line[1]) {
$index = $i;
continue;
}
}
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.