Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Currency format #45

Closed
alexjeen opened this issue Jun 2, 2017 · 3 comments
Closed

Currency format #45

alexjeen opened this issue Jun 2, 2017 · 3 comments

Comments

@alexjeen
Copy link

alexjeen commented Jun 2, 2017

You can easily add currency format, this works for us:

const DBFFIELD_TYPE_CURRENCY = 'Y';    // Currency

public function getCurrency($columnName)
{
    $s = $this->choppedData[$columnName];

    $s = unpack('q', $s);

    if ($s) {
        return $s[1] / 10000;
    }

    return 0;
}
@alexjeen
Copy link
Author

alexjeen commented Jun 2, 2017

You can also use:

$s = unpack('l', $s);

It results in the same.

@luads
Copy link
Owner

luads commented Jun 4, 2017

Do you have it working @alexjeen? Would you mind opening a PR?

@alexjeen
Copy link
Author

alexjeen commented Jun 5, 2017

Hi there @Hisamu, yes we've verified that it works. However we only use the reading part of this library.

I don't have time to make a PR in the coming weeks for the writing part (and to do some testing for the writing part).

This is the test file we have used to check if it actually works, its a table with a single column and row.

test.dbf.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants