Commit 2d5a79f7 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

* Fixed floating point format

parent 7a167a61
......@@ -280,7 +280,7 @@ Note:
+========+===========================================+===========+========+========+============+============+=============+==============+
END
foreach my $item (@{$res->{'Data'}}) {
print swrite(<<'END', $item->{'ID'}, $item->{'Description'}, $item->{'InventoryID'}, defined($item->{'Unit'}) ? $item->{'Unit'} : '-', $item->{'Quantity'}, $item->{'UnitPrice'}, $item->{'Price'}, $item->{'TaxAmount'}, $item->{'TotalPrice'});
print swrite(<<'END', $item->{'ID'}, $item->{'Description'}, $item->{'InventoryID'}, defined($item->{'Unit'}) ? $item->{'Unit'} : '-', $item->{'Quantity'}, $item->{'UnitPrice'}, $item->{'Price'}, sprintf('%.2f',$item->{'TaxAmount'}), sprintf('%.2f',$item->{'TotalPrice'}));
| @<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @<<<<<<<< | @||||| | @||||| | @>>>>>>>>> | @>>>>>>>>> | @>>>>>>>>>> | @>>>>>>>>>>> |
END
$subTotal->badd($item->{'Price'});
......@@ -408,12 +408,12 @@ END
$extraInfo = sprintf("Credit note '%s'",$item->{'CreditNote'}->{'Number'});
}
print swrite(<<'END', $item->{'ID'}, $extraInfo, $item->{'Amount'});
print swrite(<<'END', $item->{'ID'}, $extraInfo, sprintf('%.2f',$item->{'Amount'}));
| @<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @>>>>>>>>>>> |
END
}
print swrite(<<'END',$transBalance->bstr(),$invoice->{'Total'},$balance->bstr());
print swrite(<<'END',sprintf('%.2f',$transBalance->bstr()),sprintf('%.2f',$invoice->{'Total'}),sprintf('%.2f',$balance->bstr()));
+========+===================================================+==============+
| Transaction Balance | @>>>>>>>>>>> |
+------------------------------------------------------------+--------------+
......
......@@ -181,7 +181,7 @@ Payment list
END
foreach my $payment (@{$res->{'Data'}}) {
print swrite(<<'END', $payment->{'ID'}, $payment->{'SupplierCode'}, $payment->{'GLAccountNumber'}, $payment->{'Number'}, $payment->{'TransactionDate'}, $payment->{'Reference'}, $payment->{'Amount'});
print swrite(<<'END', $payment->{'ID'}, $payment->{'SupplierCode'}, $payment->{'GLAccountNumber'}, $payment->{'Number'}, $payment->{'TransactionDate'}, $payment->{'Reference'}, sprintf('%.2f',$payment->{'Amount'}));
| @<<<<<< | @<<<<<< | @<<<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<< | @<<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @>>>>>>>>> |
END
}
......@@ -337,7 +337,7 @@ END
foreach my $alloc (@{$allocs}) {
$balance->badd($alloc->{'Amount'}) if ($alloc->{'Posted'});
$unposted->badd($alloc->{'Amount'}) if (!$alloc->{'Posted'});
print swrite(<<'END', $alloc->{'ID'}, $alloc->{'SupplierInvoiceNumber'}, $alloc->{'Amount'}, $alloc->{'Posted'}, $alloc->{'Posted'} ? $balance->bstr() : '');
print swrite(<<'END', $alloc->{'ID'}, $alloc->{'SupplierInvoiceNumber'}, sprintf('%.2f',$alloc->{'Amount'}), $alloc->{'Posted'}, $alloc->{'Posted'} ? $balance->bstr() : '');
| @<<<< | @<<<<<<<<<<<<<<<< | @>>>>>>>>>>> | @||||| | @>>>>>>>>>>> |
END
}
......@@ -348,7 +348,7 @@ END
$balance->bmul(-1);
print swrite(<<'END',$payment->{'Amount'},$balance->bstr(),$unposted->bstr(),$available->bstr());
print swrite(<<'END',sprintf('%.2f',$payment->{'Amount'}),sprintf('%.2f',$balance->bstr()),sprintf('%.2f',$unposted->bstr()),sprintf('%.2f',$available->bstr()));
+=======+===================+==============+========+==============+
| Payment Amount | @>>>>>>>>>>> |
| Allocated Funds | @>>>>>>>>>>> |
......
......@@ -372,14 +372,14 @@ END
}
print swrite(<<'END', $item->{'ID'}, $item->{'Description'}, $ref, defined($item->{'Unit'}) ? $item->{'Unit'} : '-', $item->{'Quantity'}, $item->{'UnitPrice'}, $item->{'Price'}, $item->{'TaxAmount'}, $item->{'Total'});
print swrite(<<'END', $item->{'ID'}, $item->{'Description'}, $ref, defined($item->{'Unit'}) ? $item->{'Unit'} : '-', $item->{'Quantity'}, sprintf('%.2f',$item->{'UnitPrice'}), sprintf('%.2f',$item->{'Price'}), sprintf('%.2f',$item->{'TaxAmount'}), sprintf('%.2f',$item->{'Total'}));
| @<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @<<<<<<<< | @||||| | @||||| | @>>>>>>>>> | @>>>>>>>>> | @>>>>>>>>>> | @>>>>>>>>>>> |
END
$subTotal->badd($item->{'Price'});
$taxTotal->badd($item->{'TaxAmount'});
$invTotal->badd($item->{'Total'});
}
print swrite(<<'END', $subTotal->bstr(), $taxTotal->bstr(), $invTotal->bstr());
print swrite(<<'END', sprintf('%.2f',$subTotal->bstr()), sprintf('%.2f',$taxTotal->bstr()), sprintf('%.2f',$invTotal->bstr()));
+========+===========================================+===========+========+========+============+============+=============+==============+
| | @>>>>>>>>> | @>>>>>>>>>> | @>>>>>>>>>>> |
+===============================================================================================+============+=============+==============+
......@@ -446,7 +446,7 @@ END
$extraInfo = sprintf("Credit note '%s'",$item->{'SupplierCreditNote'}->{'Number'});
}
print swrite(<<'END', $item->{'ID'}, $extraInfo, $item->{'Amount'});
print swrite(<<'END', $item->{'ID'}, $extraInfo, sprintf('%.2f',$item->{'Amount'}));
| @<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @>>>>>>>>>>> |
END
}
......
......@@ -187,7 +187,7 @@ Receipt list
END
foreach my $receipt (@{$res->{'Data'}}) {
print swrite(<<'END', $receipt->{'ID'}, $receipt->{'ClientCode'}, $receipt->{'GLAccountNumber'}, $receipt->{'Number'}, $receipt->{'TransactionDate'}, $receipt->{'Reference'}, $receipt->{'Amount'});
print swrite(<<'END', $receipt->{'ID'}, $receipt->{'ClientCode'}, $receipt->{'GLAccountNumber'}, $receipt->{'Number'}, $receipt->{'TransactionDate'}, $receipt->{'Reference'}, sprintf('%.2f',$receipt->{'Amount'}));
| @<<<<< | @<<<<<<<<< | @<<<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<< | @<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @>>>>>>>>> |
END
}
......@@ -344,7 +344,7 @@ END
foreach my $alloc (@{$allocs}) {
$balance->badd($alloc->{'Amount'}) if ($alloc->{'Posted'});
$unposted->badd($alloc->{'Amount'}) if (!$alloc->{'Posted'});
print swrite(<<'END', $alloc->{'ID'}, $alloc->{'InvoiceNumber'}, $alloc->{'Amount'}, $alloc->{'Posted'}, $alloc->{'Posted'} ? $balance->bstr() : '');
print swrite(<<'END', $alloc->{'ID'}, $alloc->{'InvoiceNumber'}, sprintf('%.2f',$alloc->{'Amount'}), $alloc->{'Posted'}, $alloc->{'Posted'} ? $balance->bstr() : '');
| @<<<< | @<<<<<<<<<<<<<<<<<< | @>>>>>>>>>>> | @||||| | @>>>>>>>>>>> |
END
}
......@@ -354,7 +354,7 @@ END
$balance->bmul(-1);
print swrite(<<'END',$receipt->{'Amount'},$balance->bstr(),$unposted->bstr(),$available->bstr());
print swrite(<<'END',sprintf('%.2f',$receipt->{'Amount'}),sprintf('%.2f',$balance->bstr()),sprintf('%.2f',$unposted->bstr()),sprintf('%.2f',$available->bstr()));
+=======+=====================+==============+========+==============+
| Receipt Amount | @>>>>>>>>>>> |
| Allocated Funds | @>>>>>>>>>>> |
......
......@@ -96,7 +96,7 @@ END
# Resolve children up to 'levels' print blank amounts for parents
print swrite(<<'END', $entry->{'Number'}, $entry->{'Name'}, defined($entry->{'DebitAmount'}) ? sprintf('%8.2f',$entry->{'DebitAmount'}) : '', defined($entry->{'CreditAmount'}) ? sprintf('%8.2f',$entry->{'CreditAmount'}) : '');
print swrite(<<'END', $entry->{'Number'}, $entry->{'Name'}, defined($entry->{'DebitAmount'}) ? sprintf('%.2f',$entry->{'DebitAmount'}) : '', defined($entry->{'CreditAmount'}) ? sprintf('%.2f',$entry->{'CreditAmount'}) : '');
| @<<<<<<<<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @>>>>>>>>>>>>> | @>>>>>>>>>>>>> |
END
}
......@@ -111,7 +111,7 @@ END
foreach my $entry (@{$byRwCat{'20'}}) {
$debit->badd($entry->{'DebitAmount'});
$credit->badd($entry->{'CreditAmount'});
print swrite(<<'END', $entry->{'Number'}, $entry->{'Name'}, defined($entry->{'DebitAmount'}) ? sprintf('%8.2f',$entry->{'DebitAmount'}) : '', defined($entry->{'CreditAmount'}) ? sprintf('%8.2f',$entry->{'CreditAmount'}) : '');
print swrite(<<'END', $entry->{'Number'}, $entry->{'Name'}, defined($entry->{'DebitAmount'}) ? sprintf('%.2f',$entry->{'DebitAmount'}) : '', defined($entry->{'CreditAmount'}) ? sprintf('%.2f',$entry->{'CreditAmount'}) : '');
| @<<<<<<<<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @>>>>>>>>>>>>> | @>>>>>>>>>>>>> |
END
}
......@@ -122,7 +122,7 @@ END
foreach my $entry (@{$byRwCat{'60'}}) {
$debit->badd($entry->{'DebitAmount'});
$credit->badd($entry->{'CreditAmount'});
print swrite(<<'END', $entry->{'Number'}, $entry->{'Name'}, defined($entry->{'DebitAmount'}) ? sprintf('%8.2f',$entry->{'DebitAmount'}) : '', defined($entry->{'CreditAmount'}) ? sprintf('%8.2f',$entry->{'CreditAmount'}) : '');
print swrite(<<'END', $entry->{'Number'}, $entry->{'Name'}, defined($entry->{'DebitAmount'}) ? sprintf('%.2f',$entry->{'DebitAmount'}) : '', defined($entry->{'CreditAmount'}) ? sprintf('%.2f',$entry->{'CreditAmount'}) : '');
| @<<<<<<<<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @>>>>>>>>>>>>> | @>>>>>>>>>>>>> |
END
}
......@@ -133,7 +133,7 @@ END
foreach my $entry (@{$byRwCat{'80'}}) {
$debit->badd($entry->{'DebitAmount'});
$credit->badd($entry->{'CreditAmount'});
print swrite(<<'END', $entry->{'Number'}, $entry->{'Name'}, defined($entry->{'DebitAmount'}) ? sprintf('%8.2f',$entry->{'DebitAmount'}) : '', defined($entry->{'CreditAmount'}) ? sprintf('%8.2f',$entry->{'CreditAmount'}) : '');
print swrite(<<'END', $entry->{'Number'}, $entry->{'Name'}, defined($entry->{'DebitAmount'}) ? sprintf('%.2f',$entry->{'DebitAmount'}) : '', defined($entry->{'CreditAmount'}) ? sprintf('%.2f',$entry->{'CreditAmount'}) : '');
| @<<<<<<<<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @>>>>>>>>>>>>> | @>>>>>>>>>>>>> |
END
}
......
......@@ -98,7 +98,7 @@ END
foreach my $entry (@{$res->{'Data'}}) {
$balance->badd($entry->{'Amount'});
print swrite(<<'END', $entry->{'ID'}, $entry->{'TransactionDate'}, $entry->{'Reference'} ? $entry->{'Reference'} : $entry->{'TransactionReference'}, sprintf('%8.2f',$entry->{'Amount'}),sprintf('%8.2f',$balance));
print swrite(<<'END', $entry->{'ID'}, $entry->{'TransactionDate'}, $entry->{'Reference'} ? $entry->{'Reference'} : $entry->{'TransactionReference'}, sprintf('%.2f',$entry->{'Amount'}),sprintf('%.2f',$balance));
| @<<<<<<<< | @<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @>>>>>>>>>>> | @>>>>>>>>>>>>> |
END
}
......
......@@ -328,7 +328,7 @@ END
$ref = "G:".$item->{'GLAccountNumber'};
}
print swrite(<<'END', $item->{'ID'}, $item->{'Description'}, $ref, defined($item->{'Unit'}) ? $item->{'Unit'} : '-', $item->{'Quantity'}, $item->{'UnitPrice'}, $item->{'Price'}, $item->{'TaxAmount'}, $item->{'TotalPrice'});
print swrite(<<'END', $item->{'ID'}, $item->{'Description'}, $ref, defined($item->{'Unit'}) ? $item->{'Unit'} : '-', $item->{'Quantity'}, sprintf('%.2f',$item->{'UnitPrice'}), sprintf('%.2f',$item->{'Price'}), sprintf('%.2f',$item->{'TaxAmount'}), sprintf('%.2f',$item->{'TotalPrice'}));
| @<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @<<<<<<<< | @||||| | @||||| | @>>>>>>>>> | @>>>>>>>>> | @>>>>>>>>>> | @>>>>>>>>>>> |
END
$subTotal->badd($item->{'Price'});
......@@ -402,7 +402,7 @@ END
$extraInfo = sprintf("Supplier invoice transaction '%s'",$item->{'SupplierInvoiceTransactionID'});
}
print swrite(<<'END', $item->{'ID'}, $extraInfo, $item->{'Amount'});
print swrite(<<'END', $item->{'ID'}, $extraInfo, sprintf('%.2f',$item->{'Amount'}));
| @<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @>>>>>>>>>>> |
END
}
......
......@@ -187,7 +187,7 @@ Receipt list
END
foreach my $receipt (@{$res->{'Data'}}) {
print swrite(<<'END', $receipt->{'ID'}, $receipt->{'SupplierCode'}, $receipt->{'GLAccountNumber'}, $receipt->{'Number'}, $receipt->{'TransactionDate'}, $receipt->{'Reference'}, $receipt->{'Amount'});
print swrite(<<'END', $receipt->{'ID'}, $receipt->{'SupplierCode'}, $receipt->{'GLAccountNumber'}, $receipt->{'Number'}, $receipt->{'TransactionDate'}, $receipt->{'Reference'}, sprintf('%.2f',$receipt->{'Amount'}));
| @<<<<< | @<<<<<<<<< | @<<<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<< | @<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @>>>>>>>>> |
END
}
......@@ -344,7 +344,7 @@ END
foreach my $alloc (@{$allocs}) {
$balance->badd($alloc->{'Amount'}) if ($alloc->{'Posted'});
$unposted->badd($alloc->{'Amount'}) if (!$alloc->{'Posted'});
print swrite(<<'END', $alloc->{'ID'}, $alloc->{'SupplierCreditNoteNumber'}, $alloc->{'Amount'}, $alloc->{'Posted'}, $alloc->{'Posted'} ? $balance->bstr() : '');
print swrite(<<'END', $alloc->{'ID'}, $alloc->{'SupplierCreditNoteNumber'}, sprintf('%.2f',$alloc->{'Amount'}), $alloc->{'Posted'}, $alloc->{'Posted'} ? sprintf('%.2f',$balance->bstr()) : '');
| @<<<< | @<<<<<<<<<<<<<<<<<< | @>>>>>>>>>>> | @||||| | @>>>>>>>>>>> |
END
}
......@@ -354,7 +354,7 @@ END
$balance->bmul(-1);
print swrite(<<'END',$receipt->{'Amount'},$balance->bstr(),$unposted->bstr(),$available->bstr());
print swrite(<<'END',sprintf('%.2f',$receipt->{'Amount'}),sprintf('%.2f',$balance->bstr()),sprintf('%.2f',$unposted->bstr()),sprintf('%.2f',$available->bstr()));
+=======+=====================+==============+========+==============+
| Receipt Amount | @>>>>>>>>>>> |
| Allocated Funds | @>>>>>>>>>>> |
......
......@@ -391,7 +391,7 @@ END
foreach my $entry (@sorted) {
$balance->badd($entry->{'Amount'});
print $OUT swrite(<<'END', $entry->{'ID'}, $entry->{'TransactionDate'}, $entry->{'Reference'} ? $entry->{'Reference'} : $entry->{'TransactionReference'}, sprintf('%8.2f',$entry->{'Amount'}),sprintf('%8.2f',$balance));
print $OUT swrite(<<'END', $entry->{'ID'}, $entry->{'TransactionDate'}, $entry->{'Reference'} ? $entry->{'Reference'} : $entry->{'TransactionReference'}, sprintf('%.2f',$entry->{'Amount'}),sprintf('%.2f',$balance));
| @<<<<<<<< | @<<<<<<<<< | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | @>>>>>>>>>>> | @>>>>>>>>>>>>> |
END
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment