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

Wrong number recorded #52

Closed
rtfmfm opened this issue Dec 13, 2017 · 2 comments
Closed

Wrong number recorded #52

rtfmfm opened this issue Dec 13, 2017 · 2 comments

Comments

@rtfmfm
Copy link

rtfmfm commented Dec 13, 2017

Hi! I have the following problem.
This is my sql database table:

| id | record_id | from | num | qty | qty2 | to |
| 150 | 34 | 111 | 200006 | 555.000 | 5550.000 | 222 |

When I try to write this data in dbf the value of the column qty2 is inserted as 5.000. The problem is present when the value is more than 999.000 (has 4 numbers before the decimal). If the value is 9000.000 it is written as 9.000. The script is taking only the first digit of the number. The header (with type) of the dbf colum qty2 is qty,N,14,3

I'm using this code to write the dbf:

$table = new WritableTable($files_path.'/file.dbf', null, 'CP1251');
$table->openWrite();
$lines = Records::all();
foreach ($lines as $line) {
$record = $table->appendRecord();
$record->from = $line->from;
$record->num = $line->num;
$record->qty = $line->qty;
$record->qty2 = $line->qty2;
$record->to = $line->to;
$table->writeRecord();
}
$table->close();

Any advice on how to solve this will be much appreciated. Thank you!

@rtfmfm
Copy link
Author

rtfmfm commented Dec 13, 2017

I found something. I opened the dbf with linux dbfviewer and found that the numbers are written but there is an comma sign which is dividing thousands. The number is written as 5,550.000 instead of 5555.000 and the software (windows client and Libreoffice in Linux) is showing it as 5,000

Can you tell me where to change this thousands separator, please?

@rtfmfm
Copy link
Author

rtfmfm commented Dec 14, 2017

Nevermind... found it.

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