Esempio 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;
}
Esempio n. 2
0
$row_count = 0;
echo "Added rows:<br/>";
echo "<table border='1' cellspacing='0'>";
while (!feof($file)) {
    $line = fgets($file);
    $row_count++;
    if ($row_count <= $added_row_count) {
        continue;
    }
    if ($row_count - $added_row_count > 200) {
        $row_count--;
        break;
    }
    $row_string = "<tr>";
    if (is_numeric($line[0])) {
        $line = convert_seperator($line);
        $cells = explode("|", $line);
        // Date & Time
        $time = parse_time($cells[0]);
        if ($time == $last_time) {
            $duplicated_count++;
            $time += $duplicated_count * 60 * 60;
        } else {
            $last_time = $time;
            $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;";