News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Edit Order Taxes?

Started by bpos, May 28, 2020, 23:48:52 PM

Previous topic - Next topic

bpos

 I am using joomla 3.9.18 and VM 3.8.2.  Up to date as of this posting. I have read numerous posts on something similar to this but not exactly?

When a customer puts in an order everything on the front end works great. Taxes calculated and Grand total works as it should. Then submits the order all is ok at this point. But if the customer wants to add an additional product after the order is submitted the admin can do this on the backend?

Well so I thought.  If I (admin) put in the additional items and try to re calculate the total things dont go as planned. The item gets added but the tax row does not work at all. In fact now that the order has changed the tax is eliminated from the entire order. Is there a way or a hack that can be used to get the tax row working in the backend?

Its like the original order is a snapshot and the backend is just a way to add product but not calculate a new total with tax? Invoice creation and print version do update but with no tax as well.
Pics attached show original order and after adding additional items.

Please advise
Thanks

jenkinhill

In my view you should create a new order for the extra product, not modify an existing contract (order).
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

bpos

#2
Whats the point of being able to add or edit the invoice if you cant get the total with tax correct?

pinochico

What's the point of editing an order?

I don't see any sense and I don't use this function (I don't like it), precisely because of the problems of correct calculation.

I inform customers that we do not edit the order and create a new one.
Then everything works.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

jenkinhill

In some countries it is illegal to change an invoice once an order is confirmed, and against the rules of some payment providers.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

AH

Of course you should be able to edit an order in ADMIN

If no invoice exists or payment has not been made

If you cannot think of any scenarios where this is a valid business process - I suggest you go and spend more time with clients
Regards
A

Joomla 4.4.5
php 8.1

bpos

I use this invoice system to merely make invoices. Not to run a detailed cost analysis report for the tax lawyer. I do not do transactions online. Its illegal in our area.
I use a POS system (store front) that is designed for this. Even the POS system has a way to add/edit orders to get the correct pricing at a later time.

Secondly whats the point of having "shopper confirmed" and "confirmed?"  If a invoice is "shopper confirmed" its not admin approved "confirmed" until the shop owner says its confirmed? All orders are just shopper confirmed so at that point no transaction has occurred so why wouldn`t you want to get an order correct before finishing a transaction?

For instance in my case. The customer orders 35 items and has looked around on my site for 30 minutes to compose this list of items. They want a total. "shopper confirmed".  Then email me and say can you add something I forgot. I have a choice. Either say " Can you go back and add what you want to another invoice?"  Or perhaps say "Can you just start over and get your order right?"  It might make someone frustrated and say "you know what" forget it. Too much trouble...   They still have the choice of saying I dont want what you added and say cancel or void the order.

Honestly if you are worried about keeping the taxes (books) correct then I would rely on something other than this system. For instance pay pal has all the details for any transactions made if your customer used VM to make the purchase?

Going back to the original question. Is it really that big of a deal to be able to calculate the order correctly (taxes) on the backend of an unfinished order?
After all there is a spot to add additional product?

No one is changing an order after its been processed by a payment provider.  Why would you?

pinochico

QuoteNo one is changing an order after its been processed by a payment provider.  Why would you?

It's just a wish.

If there is an option to edit an order in the administration, none of the administrators will distinguish whether it is paid or not and will edit it because the customer will call.

Why?

Because it works (in VirtueMart or using additional applications).

And after the e-shop (VirtueMart), he will then request the correction of his mistake so that he is not penalized by the payment gateway.

Who decides when another paid order can be edited and when not?
Until when is it possible to edit an order and from when not?
Administrator?
E-shop creator?
VirtueMart?

I don't know if there will ever be the right way.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

bpos

I can understand why it is set up the way it is.

I just think VM can be more versatile than that.  If one never uses this with a payment gateway then there is no need to worry about what gets edited? (crazy idea I know)

As I mention I am just using it as a invoicing system only. There are plenty of times where I receive an invoice from places only to tell the vendor to add to it before I say ok lets pay for it? Then they call to take payment.

Just seems odd that there is an edit button to add a product but no way of calculating correctly? While I am complaining about the invoice section.. the invoice deletion could be helpful in the midst of this. If you want the customer to put in another order (add to the order) then why not just delete the invoice and let them create a new one? It is very difficult to figure out how all this invoicing system should be setup and how it looks and such in the beginning. I must have made 20 invoices that are stuck in limbo on my orders section doing nothing all because I cant delete them?
Again I understand the reasoning why it is the way it is. But perhaps just the superadmin can edit these things?

If anyone is editing there is obviously a invoice status that lets you know if you should do any editing? How about shopper confirmed means we can still talk about it. And confirmed means its to late to do anything?

I can see how this would be difficult if your were using this as a full on shop with payment gateway since the shopper would complete the transaction at the time of ordering. But I am speaking of those who might not set up a transaction (payment gateway) ?

Just some thoughts..


AH

#9
Bpos

VM allows orders to be edited, when you do it is completely irrelevant to the functionality that is supported.  The WHEN becomes a business decision with all the associated risks and responsibilities.

There is some control in VM now to stop invoiced orders being edited - that is NOT the issue here and is a moot point.

Pinocchio - the right way,  that is what the business decides meets their needs - let the business decide what is legal for the country within which their operations are based.

So back to the real problem.

The tax should be correct, it looks to be a fault

To provide input to the team - could you create 2 orders exactly the same - then use the edit function WITHOUT MAKING CHANGES  and just save the first order

Then compare the database table entries for the 2 orders
orders
order item details

Then if both the order table entries are the same (ie saving after changing nothing is fine) you can go to the next part of the test.

Add an order item and compare again

Please can you do this and provide a result??
Regards
A

Joomla 4.4.5
php 8.1

bpos

#10
 You are correct that the tax is the fault. 

I didnt have to check the database to see what happened but its the same in the database.

The tax on the edited version skips the calculation.  The subtotal is the same as the grand total.

The order subtotal is changed in the orders table.

So for some reason in the cart I am adding the final price to get the subtotal and in the orders BE it looks like it wants to try and calculate the cost column instead?

Now that I look at this let me explain some things.

In a normal "simple" order invoice we use 4 basic rows.
 
Final price
Subtotal
tax
Total

Thats it.

There is no need for VAT or Discount or any other muddled numbers that dont come to the exact conclusion of price.

I would like to add a few things that seem confusing to me. Which might contribute to why this thing is not calculating correctly?
In my world "cost" means cost of goods (which would NEVER be shown to customer) I would say it should be lower than the sales or final price???
                   "base price" ? I Have no idea why this is needed. I understand its used as currency conversion but has no use to me.
                    "final price" Well normally this is the sales price of an item where I come from.
                    "override"? ??? No idea why you need this. maybe for discounts?
                     overwrite final ? and overwrite final to be taxed? OK..

So on the front end in products I have this set where it shows for some odd reason the base price slashed out then gives the final price under that with a nice little message saying "you save x amount"
In the backend I have my products set up with a fictitious cost price (which should be cheaper than the sales price but is not in this case) and a final price that is overwritten to be taxed?
It looks good I suppose for the customer shopping thinking that they are saving with all this showing. I am aware all of this can be hidden.
Moving on to the actual cart. I have removed all of the garble... discount heading, tax heading, slashed price (cost price) and instead have the 4 simple rows that are the real sales prices and taxes and totals

Billing/Shipping and payment method not used for me. So its gone in the cart.

In the backend I have no idea why there would be a cost price and a base price with tax, total discount then another column with tax then show the cost price slashed in the total? I assume all this is needed across the pond?

Anywho Im guessing this system does not configure simple tax on to a final price then come up with the total in this manner?

I have attached a before and after edit order and the cart setup.

Honestly at the end of the day I am just looking for a solution that works for me.

Thanks

AH

Ok - I have given you a possible fix and also tried to suggest other things relating to general VM setup.

QuoteThere is no need for VAT or Discount or any other muddled numbers that dont come to the exact conclusion of price.

These are base VM data elements they may or may not be populated - but they always show in admin.  You can do invoice and cart overrides to prevent them from showing (I certainly do for discount etc)


QuoteI would like to add a few things that seem confusing to me. Which might contribute to why this thing is not calculating correctly?

I think I have a "fix" for you - even with this fix I would still consider my observations below the fix.

So to try a fix:

in admin/models/orders.php
see this line:
`order_subtotal`=(SELECT sum(ROUND(product_item_price, '. $rounding .')*product_quantity) /*+ product_subtotal_discount*/ FROM #__virtuemart_order_items where `virtuemart_order_id`='.$ordid.'), ';

change it to

`order_subtotal`=(SELECT sum(ROUND(product_item_price, '. $rounding .')*product_quantity)+product_subtotal_discount FROM #__virtuemart_order_items where `virtuemart_order_id`='.$ordid.'), ';

Then do the order test again.



QuoteIn my world "cost" means cost of goods (which would NEVER be shown to customer) I would say it should be lower than the sales or final price???
                   "base price" ? I Have no idea why this is needed. I understand its used as currency conversion but has no use to me.
                    "final price" Well normally this is the sales price of an item where I come from.
                    "override"? ??? No idea why you need this. maybe for discounts?
                     overwrite final ? and overwrite final to be taxed? OK..


If you are tax per bill - I would suggest you just put your retail price as the "Cost price" leave everything else alone.  You will not then have all that discount stuff (if you do, then config of taxes may need looking at)

Some stores put in the cost of goods price from the supplier in this field and use VM's capability to uplift these cost prices with a "margin" to automatically calculate a Final price.

For me I never put the supplier cost of the goods in VM - the value i put in the cost price is the "net sales price" in the store (vm then calculates the final price as we use VAT tax in Europe - which is line item based and not bill total.)
I think you use tax per bill so can ignore that.


QuoteSo on the front end in products I have this set where it shows for some odd reason the base price slashed out then gives the final price under that with a nice little message saying "you save x amount"
In the backend I have my products set up with a fictitious cost price (which should be cheaper than the sales price but is not in this case) and a final price that is overwritten to be taxed?
It looks good I suppose for the customer shopping thinking that they are saving with all this showing. I am aware all of this can be hidden.

And that is not what you should be achieving - because every item looks discounted - which it is not.I would need to see a product price page and tax setup in your site to determine exactly your config, but that is my best guess so far.

QuoteMoving on to the actual cart. I have removed all of the garble... discount heading, tax heading, slashed price (cost price) and instead have the 4 simple rows that are the real sales prices and taxes and totals

Yes - you can show what is required for your country

The problem you are having currently with order edit is that (for me and not for the VM team I see a bug in the order save calculation relating to order_subtotal when there are discount items in the order)

Regards
A

Joomla 4.4.5
php 8.1

bpos

AH Thank you.

You are pretty much spot on with all of this.

The code didnt make any difference for me. BUT

I did however try another template that had pre-configured examples of products with "VAT tax per product" configured for all its items. ( I presume the correct way to configure product pricing?) I noticed that there was no row for tax per bill in the edit order.
VAT tax per product has no real function in the calculation of the final total so there is no extra calculation needed. It simply drops the subtotal down to the total.
Once I switched to "tax per bill" I then got the same tax row that I use now. I tried to "edit the order" and just re saved and the same result happened that I am currently having. It skipped right over the VAT tax per bill and used the subtotal once again.

So perhaps you are right. There is a bug in the arithmetic operation for "tax per bill"

My guess is it doesnt exist.

Pic 1 shows vat per product. There no row used for this from what I can tell?
Pic 2 show vat per bill and the row for this appears. But does nothing.

Thoughts?

AH

Quote
You are pretty much spot on with all of this.

I have my moments (few and far between)

I am not sure what you mean by template and preconfigured

Unfortunately - I have never used tax per bill so am not familiar with the nuances (VAT tax per product is all I know)
Consequently I am not able to debug your issue or provide a possible solution - as this area of the system is way too complicated for me to unpick for another tax method.

Firstly - you might configure the items as I suggested -
put your net price in the cost price and let that flow through to the final price (which in your country, I believe, will be the same - as tax per bill is applied only at checkout as a bill total only and not by line item?)

I sort of remember this kind of discussion in other threads regarding tax per bill - you may be able to find some thoughts in one of the more recent ones.

Because of my lack of knowledge with tax per bill I may be sending you down a dead end - so please consider looking at other posts - you will not bet the only person using tax per bill
Regards
A

Joomla 4.4.5
php 8.1

bpos

Yep I have seen a few posts with somewhat similar issues which I did not see any solution to.

My point about the template was that I have a few joomla templates that are done by someone else and have VM added in them. The one I tried has products and pricing set as a few examples. I figure its safe to assume that me and whoever created another template couldnt both have the same problem and product pricing configured in 2 different ways?

Maybe Milbo or one of the other experts can take a peek into the calculation method on the order sheet and see if "tax per bill" is configured correctly?

Thanks