Exemplo n.º 1
0
function parse_line_to_array($line)
{
    if (!is_numeric($line[0])) {
        return null;
    }
    DLOG("line1={$line}");
    $line = convert_seperator($line);
    DLOG("line2={$line}");
    $cells = explode("|", $line);
    $cells[0] = parse_time($cells[0]);
    $cells[2] = parse_amount($cells[2]);
    $cells[3] = parse_description($cells[3]);
    return $cells;
}
Exemplo n.º 2
0
            $duplicated_count = 0;
        }
        $row_string .= "<td>" . date('d-m-Y H:i:s', $time) . "</td>";
        // Category
        $category = $cells[1];
        $row_string .= "<td>" . $category . "</td>";
        $category_id = "&nbsp;";
        foreach ($cate_list as $cate) {
            if ($cate['Name'] == $category) {
                $category_id = $cate['Id'];
                break;
            }
        }
        $row_string .= "<td>" . $category_id . "</td>";
        // Amount
        $amount = parse_amount($cells[2]);
        $row_string .= "<td>" . $amount . "</td>";
        // Description
        $description = parse_description($cells[3]);
        $row_string .= "<td>" . $description . "&nbsp;</td>";
        // Insert into database
        add_data($conn, $config, $category_id, $description, $time, $amount, "");
    }
    $row_string .= "</tr>";
    echo $row_string;
}
echo "</table>";
fclose($file);
echo "Added rows from " . ($added_row_count + 1) . " to " . $row_count . "<br/>";
$added_row_count = $row_count;
?>