SO Force Branch according to Warehouse  Topic is solved

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

SO Force Branch according to Warehouse

Postby 2can2 » Thu Jul 14, 2016 5:08 pm

Hi, I picked up from one of the previous posts how to force the SO branch according to which Warehouse the SO is in. I am checking on the Logical Warehouse Description but would far rather be checking against the PhysicalID or Physical.Description but can't seem to access either?
I also discovered another issue, If I create a New credit Note and if the previous SO showed a Branch other than Sydney it DOES NOT change the Branch to Sydney? However creating a New Invoice it forces the Branch correctly as per the code? Do I need to cater for Credit Notes separately? Thanks.
Code below.

Code: Select all
   Public Sub Setup(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.Setup
      Dim salesOrderForm As JiwaSalesUI.SalesOrder.SalesOrderEntryForm = DirectCast(JiwaForm, JiwaSalesUI.SalesOrder.SalesOrderEntryForm)
      AddHandler salesOrderForm.SalesOrder.CreateEnd, AddressOf CreateEnd
      AddHandler salesOrderForm.SalesOrder.SaveStart, AddressOf SaveStart
      AddHandler salesOrderForm.SalesOrder.ReadEnd, AddressOf ReadEnd
      AddHandler salesOrderForm.SalesOrder.PropertyChanged, AddressOf PropertyChanged
    End Sub

      Private Sub CreateEnd(sender As Object, e As System.EventArgs)
      Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaSales.SalesOrder.SalesOrder)      
      Dim salesOrderForm As JiwaSalesUI.SalesOrder.SalesOrderEntryForm = DirectCast(salesOrder.client, JiwaSalesUI.SalesOrder.SalesOrderEntryForm)
''   *** For Warehouse 'Alexandria, Branch = Sydney ** 14/07/16 DH    
''    msgbox (" salesOrder.Branch.Description = " & salesOrder.Branch.Description )
      If salesOrder.Warehouse.Description = "Alexandria" Then
          salesorder.Branch.ReadRecordFromDescription("Sydney")
      End If
   End Sub
   
   Private Sub SaveStart(sender As Object, e As System.EventArgs)
      Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaSales.SalesOrder.SalesOrder)      
''   *** NOT NEEDED - used CreateEnd ***
End Sub
   
   Private Sub ReadEnd(sender As Object, e As System.EventArgs)
      Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaSales.SalesOrder.SalesOrder)      
      Dim salesOrderForm As JiwaSalesUI.SalesOrder.SalesOrderEntryForm = DirectCast(salesOrder.client, JiwaSalesUI.SalesOrder.SalesOrderEntryForm)
' lock   
      salesOrderForm.BranchLookup.Enabled = False
      salesOrderForm.lblBranch.Enabled = False
   End Sub
   
   
   Private Sub PropertyChanged(sender As Object, e As System.EventArgs)      
      Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaSales.SalesOrder.SalesOrder)      
      Dim salesOrderForm As JiwaSalesUI.SalesOrder.SalesOrderEntryForm = DirectCast(salesOrder.client, JiwaSalesUI.SalesOrder.SalesOrderEntryForm)
' lock   
      salesOrderForm.BranchLookup.Enabled = False
      salesOrderForm.lblBranch.Enabled = False
   End Sub
End Class
2can2
Frequent Contributor
Frequent Contributor
 
Posts: 171
Joined: Tue Feb 26, 2008 10:24 am
Topics Solved: 25

Re: SO Force Branch according to Warehouse

Postby Mike.Sheen » Sun Jul 31, 2016 1:06 pm

Hi Doug,

2can2 wrote:I am checking on the Logical Warehouse Description but would far rather be checking against the PhysicalID or Physical.Description but can't seem to access either?


You can - in your code you supplied, you are doing the following:

Code: Select all
If salesOrder.Warehouse.Description = "Alexandria" Then
          salesorder.Branch.ReadRecordFromDescription("Sydney")
      End If


Just replace this with the following:

Code: Select all
If salesOrder.Warehouse.LogicalWarehouseCollection.PhysicalWarehouse.Description = "PlaceYourPhysicalWarehouseDescriptionHere" Then
          salesorder.Branch.ReadRecordFromDescription("Sydney")
      End If


2can2 wrote:I also discovered another issue, If I create a New credit Note and if the previous SO showed a Branch other than Sydney it DOES NOT change the Branch to Sydney? However creating a New Invoice it forces the Branch correctly as per the code? Do I need to cater for Credit Notes separately?


I didn't have this issue. My branch was correctly changed when I created a credit note. Can you provide a plugin which demonstrates the issue ?

Mike
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: SO Force Branch according to Warehouse  Topic is solved

Postby 2can2 » Thu Aug 04, 2016 6:29 pm

Thanks Mike, all good with your code.
2can2
Frequent Contributor
Frequent Contributor
 
Posts: 171
Joined: Tue Feb 26, 2008 10:24 am
Topics Solved: 25


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 0 guests