Forum Discussion

LF2017's avatar
LF2017
Cover User
3 years ago

Code : System.DivideByZeroException

Hi,

 

I cannot process a asales order without my system wanting to shut down. There are no discounts and they are all different products. All other orders are working fine. The error message is as per below:

AccountRight Application Error Report
=====================================
Application Version: 2022.1.24.5785
Application File Version: 2022.1.24.5955
Incident Id: bd421ed1-8af4-40e7-ab0d-336a7b2d29a0
Time: Monday, 14 March 2022 10:42:04 AM

Code:
System.DivideByZeroException


Message:
Attempted to divide by zero.


Stack Trace
----------------------------------------
1 : System.DivideByZeroException
----------------------------------------
System.DivideByZeroException: Attempted to divide by zero.
at mscorlib!0x0600572c!System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +0x27
at mscorlib!0x06005737!System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +0x1b3
at Huxley.Service.Gateway!0x06001a01!MYOB.Huxley.Service.Gateway.API.IGatewayService.Dispatch(String name, Object[] arguments)
at Huxley.Service.Proxy!0x060017c8!MYOB.Huxley.Service.Proxy.Services.ProxySaleContainerService.ProcessContainerWithNegativeInventoryCheck(ISaleContainer container, Int32 saleEventId, Boolean isNew, List`1 saleItemLines, IEnumerable`1& results, Int32& savedSaleId, Guid& savedSaleUId, Int32& savedCardId, String& savedEventId, IEnumerable`1& backOrderList) +0x0
at Huxley.UI.Decorators!0x06002ef1!MYOB.Huxley.UI.Decorators.Services.DecoratorServiceMYOBHuxleyApplicationServicesContainerAPIISaleContainerService.MYOB.Huxley.ApplicationServices.Container.API.ISaleContainerService.ProcessContainerWithNegativeInventoryCheck(ISaleContainer container, Int32 saleEventId, Boolean isNew, List`1 saleItemLines, IEnumerable`1& results, Int32& savedSaleId, Guid& savedSaleUId, Int32& savedCardId, String& savedEventId, IEnumerable`1& backOrderList) +0x70
at Huxley.UI.Model!0x060039e4!MYOB.Huxley.UI.Model.Context.EnterSaleContext.ProcessContainerWithNegativeInventoryCheck(ISaleContainer container, IEnumerable`1& results) +0x0
at Huxley.UI.Model!0x060039e1!MYOB.Huxley.UI.Model.Context.EnterSaleContext.ExecuteProcessContainerWithValidation(ISaleContainer container, List`1 validationResults) +0x2a
at Huxley.UI.Model!0x06003ac8!MYOB.Huxley.UI.Model.Context.Base.UIContextProcessContainer`2.InvokeContainerUpdate() +0x3a
at Huxley.UI.Model!0x06003ac4!MYOB.Huxley.UI.Model.Context.Base.UIContextProcessContainer`2.ProcessContainerObject() +0x12
at Huxley.UI.Controllers!0x060013d8!MYOB.Huxley.UI.Controllers.Base.BaseControllerBusinessObject`5.SaveObjectContainer() +0x19
at Huxley.UI.Controllers!0x060013bf!MYOB.Huxley.UI.Controllers.Base.BaseControllerBusinessObject`5.SaveChanges(IEnumerable`1 entitiesToSave) +0x1a
at Huxley.UI.Forms!0x0600266a!MYOB.Huxley.UI.Forms.BaseForms.BaseViewBusinessObject.SaveChanges(IEnumerable`1 entitiesToSave) +0x52
at Huxley.UI.Forms!0x06002668!MYOB.Huxley.UI.Forms.BaseForms.BaseViewBusinessObject.SaveChanges(IUIObject objectToSave) +0x10
at Huxley.UI.Forms!0x060031b1!MYOB.Huxley.UI.Forms.Sales.EnterSalesBase.OnCustomRight1Clicked(ButtonClickedArgs args) +0x2b1
at Huxley.UI.Forms!0x0600327d!MYOB.Huxley.UI.Forms.Sales.EnterSales.OnCustomRight1Clicked(ButtonClickedArgs args) +0x33
at Huxley.UI.Forms!0x060023f8!MYOB.Huxley.UI.Forms.BaseForms.BaseViewForm.CallButtonClicked(Action`1 execute, ButtonClickedArgs args, String buttonText) +0x12
at Huxley.UI.Forms!0x06002374!MYOB.Huxley.UI.Forms.BaseForms.BaseViewForm.btnCustom1_Click(Object sender, EventArgs e) +0x30
at System.Windows.Forms!0x06000e18!System.Windows.Forms.Control.OnClick(EventArgs e) +0x19
at DevExpress.XtraEditors.v17.1!0x06000d4f!DevExpress.XtraEditors.BaseButton.OnClick(EventArgs e) +0x2e
at DevExpress.XtraEditors.v17.1!0x06000d48!DevExpress.XtraEditors.BaseButton.OnMouseUp(MouseEventArgs e) +0x1d
at System.Windows.Forms!0x06000eff!System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) +0x184
at System.Windows.Forms!0x06000f0f!System.Windows.Forms.Control.WndProc(Message& m) +0x62c
at DevExpress.Utils.v17.1!0x06002708!DevExpress.Utils.Controls.ControlBase.WndProc(Message& m) +0x2e
at DevExpress.XtraEditors.v17.1!0x06000256!DevExpress.XtraEditors.BaseControl.WndProc(Message& msg) +0x0
at System.Windows.Forms!0x06005720!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) +0x0
at System.Windows.Forms!0x06005723!System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) +0x8e
at System.Windows.Forms!0x06002ded!System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) +0x25
==========
MODULE: DevExpress.Utils.v17.1 => DevExpress.Utils.v17.1, Version=17.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a; G:b8c34c059b804930811d5f6d50999b6c; A:1
MODULE: DevExpress.XtraEditors.v17.1 => DevExpress.XtraEditors.v17.1, Version=17.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a; G:6df94e55f5bd4444b910d4b2a37076a4; A:1
MODULE: Huxley.Service.Gateway => Huxley.Service.Gateway, Version=2022.1.24.5785, Culture=neutral, PublicKeyToken=947f70fecdd4159f; G:61c3fc4998774f65814e1044d27e3cdd; A:1
MODULE: Huxley.Service.Proxy => Huxley.Service.Proxy, Version=2022.1.24.5785, Culture=neutral, PublicKeyToken=947f70fecdd4159f; G:39b2db3eea2249d58d24994dc4e68f69; A:1
MODULE: Huxley.UI.Controllers => Huxley.UI.Controllers, Version=2022.1.24.5785, Culture=neutral, PublicKeyToken=947f70fecdd4159f; G:4ccb4be4eea14415b45a9e9a7226852b; A:1
MODULE: Huxley.UI.Decorators => Huxley.UI.Decorators, Version=2022.1.24.5785, Culture=neutral, PublicKeyToken=947f70fecdd4159f; G:e76ac317bf464ecfb92c8264d5ebb106; A:1
MODULE: Huxley.UI.Forms => Huxley.UI.Forms, Version=2022.1.24.5785, Culture=neutral, PublicKeyToken=947f70fecdd4159f; G:327cab031e444eccab641d69af850ad5; A:1
MODULE: Huxley.UI.Model => Huxley.UI.Model, Version=2022.1.24.5785, Culture=neutral, PublicKeyToken=947f70fecdd4159f; G:2d3acb2efd1645559de3be4c963559e8; A:1
MODULE: mscorlib => mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089; G:3580705f3f48422abfe7262f8586dcb8; A:2
MODULE: System.Windows.Forms => System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089; G:098daa586c564b1ab756109f800f14ff; A:1

----------------------------------------

 

Please provide a solution. 

1 Reply

Replies have been turned off for this discussion
  • Komal_S's avatar
    Komal_S
    MYOB Moderator

    Hi LF2017 

     

    This generally happens if  the same item is used more than once on order as shown : 

     

    Another reason could be if an item is discounted by 100% on an order and that order is then converted to an invoice. In order to resolve it, if you have selected to discount an item by 100%, you would want to remove that discount, convert the order to an invoice and then re-add that discount once the transaction has been saved as an invoice/bill.


    If it still doesn't help, combine the order to have both items on 1 line.

     

    Let us know how you go on.