question on InvoiceTotal from salesOder object  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

question on InvoiceTotal from salesOder object

Postby indikad » Thu Jun 24, 2021 11:41 pm

Jiwa 7.2.1
I have this bit of code where I am expecting the MessageBox to display the Ordered (Inc GST ) Value on sales order window ( bottom right )
However it displays the This Del, (Inc GST ) value.

What am I doing wrong ? Am I using the incorrect property for the Ordered Total ?


Code: Select all
 Public Sub Setup(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.Setup
      If TypeOf JiwaForm Is JiwaSalesUI.SalesOrder.SalesOrderEntryForm  Then         
            Dim SalesOrdForm As JiwaSalesUI.SalesOrder.SalesOrderEntryForm = DirectCast(JiwaForm, JiwaApplication.IJiwaForm)
         _SalesOrderForm = DirectCast(JiwaForm, JiwaSalesUI.SalesOrder.SalesOrderEntryForm)
         AddHandler  SalesOrdForm.SalesOrder.SaveEnding  , AddressOf SalesOrderSaveEnding
        End If
    End Sub
   
   Private Sub SalesOrderSaveEnding( sender As Object ,  e As System.EventArgs )   
      Dim oSalesOrder As JiwaSales.SalesOrder.SalesOrder   = DirectCast( sender , JiwaSales.SalesOrder.SalesOrder )
               MessageBox.Show( "oSalesOrder.InvoiceTotal  = " +  oSalesOrder.InvoiceTotal.ToString() )
Attachments
New Bitmap Image.jpg
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: question on InvoiceTotal from salesOder object

Postby SBarnes » Fri Jun 25, 2021 8:56 am

Try


Code: Select all
            decimal DolarsThisDel = 0;   
            foreach(SalesOrderLine line in salesorder.SalesOrderLines)
            {
               DolarsThisDel += line.DiscountedPrice * line.QuantityThisDelivery;
            }         
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: question on InvoiceTotal from salesOder object

Postby indikad » Fri Jun 25, 2021 10:32 am

Hi Staurt ,
I was thinking of that however , I am trying to avoid looping to save delays at "Save Ending" event. If I cannot obtain this from a footer level property I'm afraid I may have to do just that.
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: question on InvoiceTotal from salesOder object  Topic is solved

Postby Mike.Sheen » Fri Jun 25, 2021 10:57 am

Try the SalesOrderLines.OrderedExGSTTotal. There is also OrderedGSTTotal if you need the inc (ex + tax = inc).
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: question on InvoiceTotal from salesOder object

Postby indikad » Fri Jun 25, 2021 12:06 pm

Many thanks Mike. I will try that and update.
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: question on InvoiceTotal from salesOder object

Postby indikad » Tue Jun 29, 2021 11:27 am

Updating:

Code: Select all
SalesOrder.SalesOrderLines.OrderedExGSTTotal

gives me the correct value.

As a side question ; I need to obtain the << This Del. (Inc GST) >> value from the footer.
Currently the the most logical place seems to be the property below.
Code: Select all
SalesOrderForm.DeliveredTotalNumericEditor.Value


Is there another property in the <<SalesOrder.SalesOrderLines>> object for this value ? (<< This Del. (Inc GST) >>)
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: question on InvoiceTotal from salesOder object

Postby nsbandara » Tue Jun 29, 2021 12:37 pm

You can get sales order livered total by adding freight charge to sales order line delivered total

Code: Select all
decimal deliveredTotalIncGst = SalesOrder.SalesOrderLines.IncGSTTotal ;
if( SalesOrder.OrderType != SalesOrder.SalesOrderOrderTypes.e_SalesOrderOrderTypeForwardOrder &&   SalesOrder.SalesOrderLines.TotalDeliveredQuantity > 0/* if not a forward order and delivery quantity > 0 then add freight charges */)
{
     var history = SalesOrder.SalesOrderHistorys[SalesOrder.SelectedHistoryNo];
     deliveredTotalIncGst = deliveredTotalIncGst + history.CartageCharge1.IncGSTAmount + history.CartageCharge2.IncGSTAmount + history.CartageCharge3.IncGSTAmount
}
User avatar
nsbandara
Occasional Contributor
Occasional Contributor
 
Posts: 43
Joined: Tue Jul 16, 2013 5:02 pm
Location: Sri Lanka
Topics Solved: 11

Re: question on InvoiceTotal from salesOder object

Postby Mike.Sheen » Tue Jun 29, 2021 1:01 pm

nsbandara wrote:You can get sales order livered total by adding freight charge to sales order line delivered total

Code: Select all
decimal deliveredTotalIncGst = SalesOrder.SalesOrderLines.IncGSTTotal ;
if( SalesOrder.OrderType != SalesOrder.SalesOrderOrderTypes.e_SalesOrderOrderTypeForwardOrder &&   SalesOrder.SalesOrderLines.TotalDeliveredQuantity > 0/* if not a forward order and delivery quantity > 0 then add freight charges */)
{
     var history = SalesOrder.SalesOrderHistorys[SalesOrder.SelectedHistoryNo];
     deliveredTotalIncGst = deliveredTotalIncGst + history.CartageCharge1.IncGSTAmount + history.CartageCharge2.IncGSTAmount + history.CartageCharge3.IncGSTAmount
}


Yep - this is exactly how the UI displays the delivered Inc-GST in the totals grid.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests