Tuesday, 8 December 2009
Nominal Ledger None Taxable Receipt Example
Private Function NoneTaxableReceipt(ByVal oItem As ImportLine) As Boolean
Using oInstrument As Sage.Accounting.CashBook.BankReceiptJournalInstrument = Sage.Accounting.CashBook.BankReceiptJournalInstrumentFactory.Factory.CreateNew
Try
With oInstrument
.Bank = oItem.CashBookAccount
.InstrumentNo = _JournalInstrumentNo
.InstrumentDate = oItem.TransactionDate
.SecondReferenceNo = ""
.InstrumentItemNarrative = oItem.Narrative
If .NominalSettlementJournalInstrumentItems.Count = 0 Then
Dim oInstrumentItem As Sage.Accounting.NominalLedger.NominalSettlementJournalInstrumentItem = .CreateNewSettlementJournalInstrumentItem
oInstrumentItem.NominalSpecification = oItem.NominalCode.NominalSpecification
oInstrumentItem.NominalSpecification = oItem.NominalCode.NominalSpecification
oInstrumentItem.InstrumentDate = oItem.TransactionDate
oInstrumentItem.GrossAmount = oItem.DebitAmount
Else
.NominalSettlementJournalInstrumentItems(0).NominalSpecification = oItem.NominalCode.NominalSpecification
.NominalSettlementJournalInstrumentItems(0).NominalSpecification = oItem.NominalCode.NominalSpecification
.NominalSettlementJournalInstrumentItems(0).InstrumentDate = oItem.TransactionDate
.NominalSettlementJournalInstrumentItems(0).GrossAmount = oItem.DebitAmount
End If
'.ChequeGoodsValue = oItem.DebitAmount
.Validate()
.Update()
Return True
End With
Catch ex As Exception
Throw ex
End Try
End Using
End Function
Friday, 4 December 2009
Sage 200 Write Off Stock Example
Public Function WriteOffStock(ByVal oSale As StockExchange) As Boolean
Using oTran As New Sage.ObjectStore.PersistentObjectTransaction
Using oGoodsInMovment As New Sage.Accounting.Stock.StockWriteOffMovementActivity
'Dim x As Sage.Accounting.Stock.StockWriteOffMovementActivity
Try
Sage.Accounting.Application.AllowableWarnings.Add(oGoodsInMovment, oTypeMaxStockLevel)
Sage.Accounting.Application.AllowableWarnings.Add(oGoodsInMovment, oTypeMinStockLevel)
With oGoodsInMovment
Dim oStockItem As Sage.Accounting.Stock.StockItem = Nothing
oStockItem = ImportCSVInfomationFromMSI.StockItemLookup(oSale.SKU)
If oStockItem Is Nothing Then
oStockItem = ImportCSVInfomationFromMSI.StockItemLookup(oSale.WinPafArticleID)
End If
If oStockItem IsNot Nothing Then
.StockItem = oStockItem
.Location = ImportCSVInfomationFromMSI.BinItemLookup(oStockItem, oSale.FromStoreNumber, "")
.ActivityDate = oSale.DateOfInventory
.Quantity = Math.Abs(oSale.TransferQuantity)
.CostPrice = oStockItem.AverageBuyingPrice
.IssuePrice = oStockItem.AverageBuyingPrice
.SupplierBuyingPrice = oStockItem.AverageBuyingPrice
.Reference = oSale.SalesPersonID
.SecondReference = oSale.WinPafArticleID
.DefaultNarrative = oSale.WinPafArticleID + " " + oSale.SalesPersonID + " " + oSale.FromStoreNumber
.CalculateValues()
.Validate()
'.PLNominalCode = GetStockWriteOffNominalCode()
GetStockWriteOffNominalCode(oGoodsInMovment, oSale)
'.SourceAreaType = Sage.Accounting.SourceAreaTypeEnum.EnumSourceAreaTypeWriteOff
.Update()
oTran.Commit()
Return True
Else
LogFailedInformation(oSale.RawLine)
Throw New Exception("Invalid Stock Code or SKU for stock adjustment out.")
End If
End With
Catch ex As Exception
LogFailedInformation(oSale.RawLine)
LogException(New ImportExecption(ex))
Finally
Sage.Accounting.Application.AllowableWarnings.Delete(oGoodsInMovment, oTypeMaxStockLevel)
Sage.Accounting.Application.AllowableWarnings.Delete(oGoodsInMovment, oTypeMinStockLevel)
End Try
End Using
End Using
End Function
Tuesday, 27 October 2009
Planet X Nibiru - Planet X Video
If you are interested in planet X Nibiru please check out this video
Planet X Nibiru - Planet X Video
Planet X Nibiru - Planet X Video
Tuesday, 20 October 2009
Visual Studio code examples useful sites
Here are a few sites that you may find useful when looking for visual basic code examples.
MicroSoft's 101 code examples.
http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=87951cb9-5aeb-4f46-9bf0-2b3e3664be77&displaylang=en
VB .Net Heaven
http://www.vbdotnetheaven.com/
VB code Source
http://www.vbcodesource.com/
Free VB Code
http://www.freevbcode.com/
Code Guru
http://www.codeguru.com/
MicroSoft's 101 code examples.
http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=87951cb9-5aeb-4f46-9bf0-2b3e3664be77&displaylang=en
VB .Net Heaven
http://www.vbdotnetheaven.com/
VB code Source
http://www.vbcodesource.com/
Free VB Code
http://www.freevbcode.com/
Code Guru
http://www.codeguru.com/
Sage 200 Revalue Stock Item Example
This example is in Visual Basic
Public Function RevalueStockItem(ByVal oStockItem As Sage.Accounting.Stock.StockItem, _ ByVal NewAverageBuyingPrice As Decimal) As String
Using oRevalueItem As New Sage.Accounting.Stock.StockHoldingRevaluationAdjustment
Try
With oRevalueItem
'oStockItem.AverageBuyingPrice = NewAverageBuyingPrice
oStockItem.StandardCost = NewAverageBuyingPrice
oStockItem.Update()
Try
.StockItem = oStockItem
Catch ex As Sage.Accounting.Exceptions.BuyingPriceIsZeroException
Throw ex
Catch ex As Sage.Accounting.Exceptions.StockLevelTooLowToRevalueException
Throw ex
Catch ex As Exception
Throw ex
End Try
.NewPrice = NewAverageBuyingPrice
.Narrative = "Cost Price Update " + Date.Today.ToShortDateString '+ " " + Date.Today.ToShortTimeString
.AssetNominalCode = oStockItem.StockItemNominalCodes(NominalUsageTypeEnum.EnumNominalUsageStock).NominalCode
.IssuesNominalCode = oStockItem.StockItemNominalCodes(NominalUsageTypeEnum.EnumNominalUsageIssues).NominalCode
.Post()
Return String.Empty
End With
Catch ex As Exception
Return ex.Message
End Try
End Using
End Function
Public Function RevalueStockItem(ByVal oStockItem As Sage.Accounting.Stock.StockItem, _ ByVal NewAverageBuyingPrice As Decimal) As String
Using oRevalueItem As New Sage.Accounting.Stock.StockHoldingRevaluationAdjustment
Try
With oRevalueItem
'oStockItem.AverageBuyingPrice = NewAverageBuyingPrice
oStockItem.StandardCost = NewAverageBuyingPrice
oStockItem.Update()
Try
.StockItem = oStockItem
Catch ex As Sage.Accounting.Exceptions.BuyingPriceIsZeroException
Throw ex
Catch ex As Sage.Accounting.Exceptions.StockLevelTooLowToRevalueException
Throw ex
Catch ex As Exception
Throw ex
End Try
.NewPrice = NewAverageBuyingPrice
.Narrative = "Cost Price Update " + Date.Today.ToShortDateString '+ " " + Date.Today.ToShortTimeString
.AssetNominalCode = oStockItem.StockItemNominalCodes(NominalUsageTypeEnum.EnumNominalUsageStock).NominalCode
.IssuesNominalCode = oStockItem.StockItemNominalCodes(NominalUsageTypeEnum.EnumNominalUsageIssues).NominalCode
.Post()
Return String.Empty
End With
Catch ex As Exception
Return ex.Message
End Try
End Using
End Function
Monday, 19 October 2009
Post build Macro for Sage 200 2009
Plance this macro in your post build event in visual studio 2008.
The Macro is for Sage 200 2009
copy "$(TargetPath)" "c:\program files\sage\sage200\$(TargetFileName)"
When you are developing for sage 200 2009 make sure that you set the working directory, otherwise you may get errors when loading sage 200 2009 and debuging your application.
This Macro is for Sage 200 5.1 and earlier
copy "$(TargetPath)" "c:\program files\sage\MMS\$(TargetFileName)"
The Macro is for Sage 200 2009
copy "$(TargetPath)" "c:\program files\sage\sage200\$(TargetFileName)"
When you are developing for sage 200 2009 make sure that you set the working directory, otherwise you may get errors when loading sage 200 2009 and debuging your application.
This Macro is for Sage 200 5.1 and earlier
copy "$(TargetPath)" "c:\program files\sage\MMS\$(TargetFileName)"
Subscribe to:
Posts (Atom)