Remove Decimals from Quantity

Hello

Just registered and must say I am very impressed with this software.

Is there any way to remove the decimals against Quantity so it doesn’t show one item as 1.00?

For my situation, 1.00 on an invoice/quote for 1 electrical appliance looks funny.

Hope there is a way. If it involves rewriting a code, please guide me as I am not a professional web developer. Thanks.

I also having same issue. Found any solutions for this?

I found the way to remove decimals on qty.

  1. Change IP_invoice_items > item_quantity to ALTER TABLE ip_invoice_items CHANGE item_quantity item_quantity VARCHAR(100) NOT NULL;

2.in application/modules/invoices/views/partial_item_table.php line find <input type=“text” name=“item_quantity” class=“input-sm form-control” input-sm form-control value="<?php echo format_amount($item->item_quantity); ?> replace with <input type=“text” name=“item_quantity” class=""
value="<?php echo $item->item_quantity; ?>
3. in application/views/invoice_templates/pdf/Default-Invoice.php find <?php echo format_amount($item->item_quantity); ?> and replace with <?php echo $item->item_quantity; ?>

You should NEVER store amounts as a string!

Instead use
ALTER TABLE ip_invoice_items CHANGE item_quantity item_quantity INT(15) NOT NULL;

for Kovah’s and J_N’s suggestion, how do I apply that code? Is it just through MySQL Workbench as a query?

My item_quantity seems default at “decimal(10,2)” - would it not be simpler to change it to (10,0) or does it not work like that?

Sorry I am still learning.

Yes.

Would not work because the database would store the amounts as 5,00 and this would be displayed again on the quotes.

thanks, I will try that :smile:

Hello

So basically for Points 2 & 3, you’re saying that I have to remove the ‘format_amount’ on all my views and pdfs right? That’s after running the query.

Thats right.

2 Likes