Link to home
Start Free TrialLog in
Avatar of vishwaraj
vishwarajFlag for India

asked on

Method in Dll are missing in asp.net


Hi....
 I Am working on a web application in VS 2008. I am using "App.Logic.dll" and "Made4Net.Shared.dll". there are some methods in App.logic.dll which i am not able to use in the code. That class of DLL is not showing those methods, When I searched for those methods by using a software XenoCode . Then it is showing all those functions. When i add the reference of DLL and save them the errors also disappears but when I built the website. It again shows that those methods are not in that class of DLL. I have also cleared the temp folder on "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" location. and restarted the system. The same problem occurs. can anybody tell me what to do... I am stuck here.. can anybody show me the way what to do in such condition.. Thanx i advance....
Regards:

Vishwaraj Malik
Avatar of daveamour
daveamour
Flag of United Kingdom of Great Britain and Northern Ireland image

I would be tempted to have a look at your DLLs with reflector to see what is actually there which should shed some light.
http://www.red-gate.com/products/reflector/
 
Avatar of Nasir Razzaq
What are the accessors on those methods? I mean are they Public, Friend, Private?
To combine the above two posts and add a little more, how do you know that those methods are there in the dll or did you use a tool to peek into the dll itself or is there some kind of documentation for these dll's that you went through?

Either way, please post us the information on how you got to know those methods exist in the dll's.
Avatar of vishwaraj

ASKER

I have seen those function in Object Browser when I open that dll class. But when I rebuilt or built it shows that some methods are missing..

and also with the help of a software .... XenoCode
Vishwa, you have still not answered CodeCruiser's answer. Is this a public or private method?
ohhoo  I  was busy in some other work.....
 It is public...
I cant think of any reason for not being able to see the methods other than that they are either private or you are not referencing them properly with the proper name space etc.
i have checked all.... some other methods are showing from the same class but some methods are missing
I have also done al histry from temprory folder. when i add the dll till then all is fine.. no error but when i built it is shows  follwing error

'Reserve'  is not a member of 'App.Logic.OutboundDocDtl'.      

'OutboundStatus' is not a member of 'App.Logic.Item'.

but when i again add the same DLL all errors disappears but if i built again erros again appears.


wat to do..

i see no way....

::(
How are you referencing it in your code? Please post the code you're using. Also see if you can attach it to this issue. Just append '.txt' to the dll file and attach it here.
Do you copy the file to the bin folder? Can you post the lines from your web.config file where it references the DLL?
okay i am sending you the  web.config file and list  of erros and the page on which i am using the methods of DLL.

webconfig.txt
function-missing.txt
ExpenseEntryExec.txt
OutboundDocExec.txt
InventoryExec.txt
Cant see any reference to the DLLs you mentioned in this list.

			<assemblies>
				<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
				<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="CrystalDecisions.Shared, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="Microsoft.JScript, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
				<add assembly="System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
				<add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
				<add assembly="Accessibility, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
				<add assembly="System.Runtime.Serialization.Formatters.Soap, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>

Open in new window

yes  I am also seeing this. then what may be the problem..
but i am adding the DLL reference by right clickintg on BIN folder and the "Add reference"..

Am i doing somthing wrong..


Do you right click on the project and then click on Add Reference and select the DLL file?
I done it by  both ways by Right clicking on project  and by Right clicking on Bin.
can you tell me which is the best way...
Right clicking the website(2nd item in the list after solution), click on add reference, click on Browse tab, and then select the DLL file to add.
Yes i have also tried this way  but nothing happened.  The problem is the same...
Really strange.
Vishwa, if it possible, can you zip your solution and upload it somewhere where we can download it from?
yes i can upload on rapidshare.com  but what is the use of it.?
and which files i have to upload only code file or with bin and app_code folder
>>what is the use of it?
We are kinda stumped hearing this thing. Having a first-hand look at it might help.

You need to upload the entire solution folder (including all the dlls, aspx files and others in the root folder).
okay i am uplaoding it....   now let us see what happens.....
I have uploaded it but now speed is vry slow so i am able to download it ...I will download it later and then try to run it and let you know the result...
Dude.. send us the download link so we can have a look at it.
 ohhoo  this will be fine   this is the link...

http://rapidshare.com/files/217123841/App.zip.html

 and this is the link of all the DLLs that i have used in this.

http://rapidshare.com/files/217150784/new_DLL.zip.html


please hav a look and see what is the problem......


Thnx ..............
Vishwa, I just saw the first link. This seems like a huge project. Let me know where exactly is the error being caused (what class) and I'll see what I can do. But my suggestion would be for you to create a smaller / simpler web project, get the dll's to work there and then move the same logic into this large project.
This project was in asp 1.1 and now i have to change it to asp 3.5  

the list of  errors and the page with errors i have already posted in the post in which i have post 5 files

okay now i will try try to  use these DLL in a small project

That's good and do let me know how things work out for you.
i have used these DLL in a small project but here also some methods are missing.
When you say "missing", do you mean they do not show up in your intellisense?
yes Those methods are not in my intellisense help list..
Maybe they are implemented in that way by the developer. You can use Reflector mentioned earlier by another expert to reflect the dll and find the function that is hidden. If the function starts with this line:
EditorBrowsable(EditorBrowsableState.Never)
Then it means the function will be hidden from intellisense.
 
okay  I will check that and will let you know..
Thanks  for your help....
NO  it is not written .
I have used Reflector to open the DLL.

and function is starting like this.. as i have written in snippet
public PODtl CreateDetail(DataRow dr)
{
    PODtl d;
    DataInterface.BeginTransaction();
    try
    {
        d = PODtl.CreateNew(dr);
        d.HdrID = this.HdrID;
        if (d.DtlID < 1)
        {
            d.DtlID = this.GetNextLine();
        }
        d.Save();
        if (StringType.StrCmp(this.DocType, "R", false) == 0)
        {
            d.CreateInventoryItem(this, dr);
            d.Save();
        }
    }
    catch (Exception exception1)
    {
        ProjectData.SetProjectError(exception1);
        Exception ex = exception1;
        DataInterface.RollBackTransaction();
        throw new PODetailException("Error creating P/O detail.", ex);
        ProjectData.ClearProjectError();
    }
    DataInterface.CommitTransaction();
    return d;
}
 
 
 
 

Open in new window


Prairiedog , i havechecked that.
those methods are shown in intellisense help  until i rebuild the application after adding the reference of DLL... but as soon as i built it..  these methods disappears from the intellisense and the application shows errors.  thnxxxxxx  for ur suggestion...
Hi  all....

I am also sending you the image of my application before before and after building the website.  there are two jpg files.
In beforebuilding.jpg is teh image when i add the DLL and do not build it. You can see that a method "CreateDetail" is showing in Intellisense help these is no error as you can see in the image. but when  when I built it the method does not show in the help and Errors also pop up.  you can see the list of errors.

If any body wants to use this DLL   below are two links

 This is to download the application

http://rapidshare.com/files/217123841/App.zip.html
 and this is to download the DLL which I am using.

http://rapidshare.com/files/217150784/new_DLL.zip.html


can anybody tell me what to do in this case..

I am stuck here and its very urgent....


Imports App.Logic
Imports App.Logic.Integration
Imports Made4Net.WebControls
Imports Made4Net.DataAccess
Imports System.Xml
 
 
Namespace App.Web
 
 
Public Class BillExec
 
    Public Sub New(ByVal Sender As Object, ByVal CommandName As String, ByVal XMLSchema As String, ByVal XMLData As String, ByRef Message As String)
 
        Dim DS As DataSet = Made4Net.Shared.Conversion.Convert.XMLToDataSet(XMLSchema, XMLData)
        If DS.Tables.Count = 0 Then Exit Sub
 
        Dim DT As DataTable = DS.Tables(0)
        If DT.Rows.Count = 0 Then Exit Sub
 
        Dim DR As DataRow = DT.Rows(0)
 
        Select Case CommandName
 
            Case "AddFromMemoIn"
                'Add to the current bill from a Memo In
                AddFromMemoIn(DT)
 
            Case "AddFromPurchaseOrder"
                'Add to the current bill from a Purchase Order
                AddFromPurchaseOrder(DT)
            Case "AddFromReceipt"
                'Add to the current bill from a Purchase Order
                AddFromReceipt(DT)
            Case "CreateBillFromMemoIn"
                'Create a new bill or add to a bill 
                Throw New ApplicationException("Not in use. Use static CreateBill() method instead.")
 
            Case "CreateBillFromPO"
                'Create a new bill or add to a bill 
                Throw New ApplicationException("Not in use. Use static CreateBill() method instead.")
 
            Case "CreateBillFromReceipt"
                'Create a new bill or add to a bill 
                Throw New ApplicationException("Not in use. Use static CreateBill() method instead.")
 
            Case "CreateBillFromSO"
                'Create a new bill or add to a bill 
                CreateBillFromSO(DT)
 
            Case "InsertBill"
                'Create a new bill on screen
                SaveBill(DR, "i")
            Case "UpdateBill"
                'update bill 
                SaveBill(DR, "u")
            Case "InsertBillDtl"
                'Create a new bill on screen
                SaveBillDtl(DR, "i")
            Case "UpdateBillDtl"
                'update bill 
                SaveBillDtl(DR, "u")
            Case "ProcessTransaction"
                'send to accounting process
                ProcessTransaction(DT)
        End Select
 
    End Sub
 
    Private Sub ProcessTransaction(ByVal DT As DataTable)
        Dim b As BillHdr
        For Each Dr As DataRow In DT.Rows
            b = BillHdr.Load(Dr("BillID"))
            b.SendToAccountingSystem()
        Next
    End Sub
 
    Private Sub SaveBillDtl(ByVal DR As DataRow, ByVal Mode As String)
        Dim bd As BillDtl
        Dim bh As BillHdr
 
        bh = BillHdr.Load(DR("BillID"))
 
        If Mode = "i" Then
            bd = BillDtl.CreateNew()
        Else
            bd = BillDtl.Load(DR("BillID"), DR("BillLine"))
        End If
 
        bd.LoadDatafromDR(DR)
 
        If Mode = "i" Then
            bd("BillID") = DR("BillID")
            bd("BillLine") = bh.GetNextLine()
            bd("SourceDocType") = "L"
        End If
 
        bd.Save()
    End Sub
 
    Private Sub SaveBill(ByVal DR As DataRow, ByVal Mode As String)
        Dim bh As BillHdr
        Dim billid As Integer
        Dim today As Date = Date.Today()
 
        If Mode = "i" Then
            bh = BillHdr.CreateNew()
        Else
            bh = BillHdr.Load(DR("BillID"))
        End If
 
        bh.LoadDatafromDR(DR)
 
        If Mode = "i" Then
            billid = Made4Net.Shared.IDCounter.GetID("billid")
            bh("BillID") = billid
            bh("CreationDate") = today
            bh("Status") = "O"
 
        End If
 
        bh.Save()
        bh.UpdateTotals()
 
        Dim vals As New Specialized.NameValueCollection
        vals.Add("BillID", bh("BillID"))
        HttpContext.Current.Session("NewBillPK") = vals
 
    End Sub
 
    Private Sub AddFromMemoIn(ByVal DT As DataTable)
 
        Dim DR As DataRow
        Dim URL As String
        Dim BillID As String
        Dim VendorNum As Integer
 
        With HttpContext.Current
            DR = DT.Rows(0)
            BillID = DR("BillID")
            VendorNum = DR("VendorNum")
            URL = Made4Net.WebControls.ScreenList.GetScreenURL("MI")
            URL = Made4Net.Shared.Web.MapVirtualPath(URL)
            URL = Made4Net.Shared.Web.AddParamToURL(URL, "BillID", BillID)
            URL = Made4Net.Shared.Web.AddParamToURL(URL, "VendorNum", VendorNum)
            .Response.Redirect(URL)
        End With
    End Sub
 
    Private Sub AddFromPurchaseOrder(ByVal DT As DataTable)
 
        Dim DR As DataRow
        Dim URL As String
        Dim BillID As String
        Dim VendorNum As Integer
 
        With HttpContext.Current
            DR = DT.Rows(0)
            BillID = DR("BillID")
            VendorNum = DR("VendorNum")
            URL = Made4Net.WebControls.ScreenList.GetScreenURL("PO")
            URL = Made4Net.Shared.Web.MapVirtualPath(URL)
            URL = Made4Net.Shared.Web.AddParamToURL(URL, "BillID", BillID)
 
            Made4Net.WebControls.DOPresets.PresetManager.CreatePreset("PO", "TEPO", "VendorNum", VendorNum, True, True)
 
            .Response.Redirect(URL)
        End With
    End Sub
 
    Private Sub AddFromReceipt(ByVal DT As DataTable)
 
        Dim DR As DataRow
        Dim URL As String
        Dim BillID As String
        Dim VendorNum As Integer
 
        With HttpContext.Current
            DR = DT.Rows(0)
            BillID = DR("BillID")
            VendorNum = DR("VendorNum")
            URL = Made4Net.WebControls.ScreenList.GetScreenURL("RC")
            URL = Made4Net.Shared.Web.MapVirtualPath(URL)
            URL = Made4Net.Shared.Web.AddParamToURL(URL, "BillID", BillID)
 
            Made4Net.WebControls.DOPresets.PresetManager.CreatePreset("RC", "TEPO", "VendorNum", VendorNum, True, True)
 
            .Response.Redirect(URL)
        End With
    End Sub
 
    Public Shared Sub CreateBill(ByVal p As Made4Net.Shared.ExecutionParams)
        Dim xml As String = p.Arguments(0)
        xml = System.Web.HttpContext.Current.Server.UrlDecode(xml)
 
        Dim doc As XmlDocument = New XmlDocument
        doc.LoadXml(xml)
 
        Dim xn As XmlNode = doc.SelectSingleNode("//VendorNum")
        Dim vendorNum As String = xn.InnerText
 
        xn = doc.SelectSingleNode("//VendorInvoice")
        Dim vendorInvoice As String = xn.InnerText
 
        xn = doc.SelectSingleNode("//SendToAcct")
        Dim sendToAcct As Boolean = Made4Net.Shared.Conversion.Convert.ParseBoolean(xn.InnerText)
 
        'debug:
        'Throw New ApplicationException(vendorNum & " " & vendorInvoice)
 
        Select Case p.CommandName
            Case "CreateBillFromMemoIn"
                CreateBillFromMemoIn(p.GetDataTable(), vendorNum, vendorInvoice, sendToAcct)
            Case "CreateBillFromReceipt"
                CreateBillFromPO(p.GetDataTable(), "R", vendorNum, vendorInvoice, sendToAcct)
            Case "CreateBillFromPO"
                CreateBillFromPO(p.GetDataTable(), "P", vendorNum, vendorInvoice, sendToAcct)
        End Select
 
    End Sub
 
    Public Shared Sub CreateBillFromMemoIn(ByVal DT As DataTable, ByVal VendorNum As String, ByVal VendorInvoice As String, ByVal SendToAcct As Boolean)
 
        Dim WorkingBillID As Integer
        Dim mh As MemoInHdr
        Dim bh As BillHdr
        Dim bl As BillDtl
        Dim md As MemoInDetail
        Dim InputDR As DataRow
        Dim _billid As Integer
        Dim SQL As String
        Dim _date As Date = Date.Today
        Dim _newsplitid As Integer
        Dim _item As String
        Dim ReturnToBill As Boolean = False
        Dim URL As String
        Dim i As Item
        Dim j As Item
        Dim d, e As Diamond
        Dim g, h As Gem
        Dim v As Vendor
        Dim w, x As Jewel
        Dim CalcDate As String
        Dim Fraction As Decimal
        Dim m As MemoInDetail
        Dim ih As ItemHistoryClass
 
        If DT Is Nothing Then
            Throw New ArgumentNullException("DT")
        End If
 
        If DT.Rows.Count = 0 Then
            Throw New ApplicationException("No memo in details were selected.")
        End If
 
        DataInterface.BeginTransaction(Made4Net.Schema.CONNECTION_NAME)
        DataInterface.BeginTransaction()
 
        Try
 
            InputDR = DT.Rows(0)
            mh = MemoInHdr.Load(InputDR("MemoInID"))
            v = Vendor.Load(mh("VendorNum"))
            With HttpContext.Current
                If .Request.QueryString.Get("BillID") Is Nothing Then
                    WorkingBillID = 0
                Else
                    WorkingBillID = .Request.QueryString.Get("BillID")
                    ReturnToBill = True
                End If
            End With
 
            If WorkingBillID > 0 Then
                bh = BillHdr.Load(WorkingBillID)
                'Check vendor is compatible
                If Not bh("VendorNum") = mh("VendorNum") Then
                    Throw New ApplicationException("Cannot add to bill with a different vendor.")
                End If
            End If
 
            If bh Is Nothing Then
                'find bill id from VendorNum/VendorInvoice
                Try
                    bh = BillHdr.Load(VendorNum, VendorInvoice)
                    WorkingBillID = bh("BillID")
                Catch ex As Made4Net.Shared.DataClassRecordNotFoundException
                    'does not exist
                End Try
            End If
 
            'Check status is ok for billing
            For Each DR As DataRow In DT.Rows
                If DR.Item("Status") = "N" Then
                    Throw New ApplicationException(String.Format("Item (0) has been returned and cannot be billed", DR("ItemID")))
                End If
            Next
 
            'Create Bill if not exist
            If bh Is Nothing Then
                _billid = Made4Net.Shared.IDCounter.GetID("billid")
                bh = BillHdr.CreateNew()
                bh("BillID") = _billid
                bh("CreationDate") = _date
                bh("VendorNum") = mh("VendorNum")
                bh("VendorInvoice") = VendorInvoice
                bh("Status") = "O"
                bh("Terms") = v("Terms")
                CalcDate = ExpressionFunctions.CalculateDueDate(v("Terms"), Date.Today.ToString)
                If CalcDate.Length > 0 Then bh("DueDate") = Convert.ToDateTime(CalcDate)
                bh.Save()
            Else
                _billid = WorkingBillID
            End If
 
 
            For Each DR As DataRow In DT.Rows
 
                bl = BillDtl.CreateNew()
 
                'bl.LoadDatafromDR(DR)
 
                bl("BillID") = _billid
                bl("BillLine") = bh.GetNextLine()
                bl("SourceDocType") = "I"
                bl("SourceDocID") = DR.Item("MemoInID")
                bl("SourceDocLine") = DR.Item("MemoInDtlID")
                bl("ItemID") = DR.Item("ItemID")
                bl("ItemType") = DR.Item("ItemType")
                bl("Quantity") = DR.Item("bill_qty")
                bl("Units") = DR.Item("bill_units")
                bl("UOM") = DR.Item("ValueBasis")
                bl("Price") = DR.Item("Price")
                bl("Description") = DR.Item("Description")
                bl("VendorItemID") = DR.Item("VendorItemID")
                bl("Discount") = 0
 
                bl.Save()
 
                'Split Memo In Detail if necessary & update status to billed
 
                If Not DR("ValueMeasurement") = DR("bill_units") Then
                    'create new source line id 
                    SQL = "Select MAX(SplitID) FROM IAWMemoInDtl WHERE MemoInID = " & DR("MemoInID") & " AND MemoInDtlID = " & DR("MemoInDtlID")
                    _newsplitid = DataInterface.ExecuteScalar(SQL) + 1
 
                    md = MemoInDetail.CreateNew()
                    md.LoadDatafromDR(DR)
 
                    md("MemoInID") = DR("MemoInID")
                    md("MemoInDtlID") = DR("MemoInDtlID")
                    md("SplitID") = _newsplitid
                    md("ItemID") = DR.Item("ItemID") & "-" & _newsplitid
                    md("Quantity") = DR("Quantity") - DR("bill_qty")
                    md("ValueMeasurement") = DR("ValueMeasurement") - DR("bill_units")
                    md("TotalPrice") = md("Price") * md("ValueMeasurement")
                    md("TotalPrice") = Decimal.Round(md("TotalPrice"), 2)
                    md.Save()
 
                    'make new item and update values in new and old
                    i = Item.Load(DR("ItemID"))
                    i.CreateCopy(md("ItemID"))
                    i = Item.Load(DR("ItemID"))
                    i("Quantity") = DR("bill_qty")
                    i("QtyBilled") = i("Quantity")
                    i("QtyOnHand") = i("Quantity")
                    i("UOMSize") = DR("bill_units")
                    i("CaratOnHand") = i("UOMSize")
                    i("CaratBilled") = i("UOMSize")
                    i("PurchaseDate") = Date.Today
                    i("CostPriceTotal") = DR("bill_units") * md("Price")
                    i("InboundStatus") = "P"
                    i.Save()
 
                    'bill old item
                    ih = ItemHistoryClass.CreateNew()
                    ih.FillData(i("ItemID"), "Bill", _billid, i("Quantity"), i("Carat"), "Billed", bl("Price"), i("CostPriceTotal"), "Memo in dtl billed")
                    ih.Save()
 
                    j = Item.Load(md("ItemID"))
                    j("UOMSize") = md("ValueMeasurement")
                    j("CaratOnHand") = j("UOMSize")
                    j("Quantity") = md("Quantity")
                    j("QtyOnHand") = j("Quantity")
                    j("QtyBilled") = 0
                    j("CaratBilled") = 0
                    j("QtySold") = 0
                    j("QtyMemoOut") = 0
                    j("QuantityInJewel") = 0
                    j("Expenses") = 0
                    j("CostPriceTotal") = md("Price") * md("ValueMeasurement")
                    j.Save()
 
                    'create new item
                    ih = ItemHistoryClass.CreateNew()
                    ih.FillData(md("ItemID"), "MemoIn", md("MemoInID"), md("Quantity"), md("ValueMeasurement"), "Billed", md("Price"), md("TotalPrice"), "Created during billing split")
                    ih.Save()
 
                    If j("Type") = "D" Then
                        ' new diamond
                        d = Diamond.Load(md("ItemID"))
                        d("UOMSize") = j("UOMSize")
                        d("CaratOnHand") = d("UOMSize")
                        d("Quantity") = j("Quantity")
                        d("QtyBilled") = 0
                        d("CaratBilled") = 0
                        d("QtyOnHand") = d("Quantity")
                        d("TotalCost") = j("CostPriceTotal")
                        d.Save()
                        'old diamond
                        e = Diamond.Load(DR("ItemID"))
                        e("UOMSize") = i("UOMSize")
                        e("CaratOnHand") = e("UOMSize")
                        e("CaratBilled") = e("CaratOnHand")
                        e("QtyBilled") = i("Quantity")
                        e("Quantity") = i("Quantity")
                        e("QtyOnHand") = e("Quantity")
                        e("TotalCost") = i("CostPriceTotal")
                        e.Save()
 
                        'make sure the expenses are divided fairly
                        i = Item.Load(DR("ItemID"))
                        Fraction = e("UOMSize") / (d("UOMSize") + e("UOMSize"))
                        i.FixDiamondExpenses(Fraction)
                        j = Item.Load(md("ItemID"))
                        Fraction = d("UOMSize") / (d("UOMSize") + e("UOMSize"))
                        j.FixDiamondExpenses(Fraction)
                    ElseIf j("Type") = "G" Then
                        'new gem
                        g = Gem.Load(md("ItemID"))
                        g("UOMSize") = j("UOMSize")
                        g("CaratOnHand") = g("UOMSize")
                        g("CaratBilled") = 0
                        g("QtyBilled") = 0
                        g("Quantity") = j("Quantity")
                        g("QtyOnHand") = g("Quantity")
                        g("TotalCost") = j("CostPriceTotal")
                        g.Save()
                        'old gem
                        h = Gem.Load(DR("ItemID"))
                        h("UOMSize") = i("UOMSize")
                        h("CaratOnHand") = h("UOMSize")
                        h("Quantity") = i("Quantity")
                        h("CaratBilled") = h("UOMSize")
                        h("QtyBilled") = h("Quantity")
                        h("QtyOnHand") = h("Quantity")
                        h("TotalCost") = i("CostPriceTotal")
                        h.Save()
                    ElseIf j("Type") = "J" Then
                        'new jewel
                        w = Jewel.Load(md("ItemID"))
                        w("UOMSize") = j("UOMSize")
                        w("UnitsOnHand") = w("UOMSize")
                        w("Quantity") = j("Quantity")
                        w("QtyOnHand") = w("Quantity")
                        w("QtyBilled") = 0
                        w("UnitsBilled") = 0
                        w("TotalCost") = j("CostPriceTotal")
                        w.Save()
                        'old jewel
                        x = Jewel.Load(DR("ItemID"))
                        x("UOMSize") = i("UOMSize")
                        x("UnitsOnHand") = x("UOMSize")
                        x("Quantity") = i("Quantity")
                        x("QtyOnHand") = x("Quantity")
                        x("QtyBilled") = x("Quantity")
                        x("UnitsBilled") = x("UOMSize")
                        x("TotalCost") = i("CostPriceTotal")
                        x.Save()
                    End If
                    i = Item.Load(DR("ItemID"))
                    i.FixItemPrices(i("UOMSize"))
 
                    j = Item.Load(md("ItemID"))
                    j.FixItemPrices(j("UOMSize"))
                Else
                    i = Item.Load(DR("ItemID"))
                    i("QtyBilled") = i("Quantity")
                    i("CaratBilled") = i("UOMSize")
                    i.Save()
                    If i("Type") = "D" Then
                        d = Diamond.Load(DR("ItemID"))
                        d("QtyBilled") = d("Quantity")
                        d("CaratBilled") = d("UOMSize")
                        d.Save()
                    ElseIf i("Type") = "G" Then
                        g = Gem.Load(DR("ItemID"))
                        g("QtyBilled") = g("Quantity")
                        g("CaratBilled") = g("UOMSize")
                        g.Save()
                    ElseIf i("Type") = "J" Then
                        w = Jewel.Load(DR("ItemID"))
                        w("QtyBilled") = w("Quantity")
                        w("UnitsBilled") = w("UOMSize")
                        w.Save()
                    End If
                End If
 
                m = MemoInDetail.Load(DR("MemoInID"), DR("MemoInDtlID"), DR("SplitID"))
 
                If Not DR("ValueMeasurement") = DR("bill_units") Then
                    m("Quantity") = DR("bill_qty")
                    m("ValueMeasurement") = DR("bill_units")
                End If
                m("TotalPrice") = m("Price") * m("ValueMeasurement")
                m("TotalPrice") = Decimal.Round(m("TotalPrice"), 2)
                m("BillID") = _billid
                m("Status") = "B"
                m.Save()
 
                i = Item.Load(DR("ItemID"))
                i("InboundStatus") = "P"
                i("PurchaseDate") = Date.Today()
                i.Save()
 
                If DR("ValueMeasurement") = DR("bill_units") Then
                    ih = ItemHistoryClass.CreateNew()
                    ih.FillData(i("ItemID"), "Bill", _billid, i("Quantity"), i("Carat"), "Billed", bl("Price"), i("CostPriceTotal"), "Memo in dtl billed")
                    ih.Save()
                End If
            Next
 
        Catch ex As Exception
            DataInterface.RollBackTransaction(Made4Net.Schema.CONNECTION_NAME)
            DataInterface.RollBackTransaction()
            Throw New ApplicationException("Error while creating bill from memo in.", ex)
        End Try
 
        DataInterface.CommitTransaction(Made4Net.Schema.CONNECTION_NAME)
        DataInterface.CommitTransaction()
 
        If SendToAcct Then
            Try
                bh.SendToAccountingSystem()
            Catch ex As Exception
 
                Throw New ApplicationException(String.Format( _
                    "Bill # {0} was created/updateds successfully, but there was an error while sending the bill to the accounting system.", _
                    bh("BillID")), ex)
 
            End Try
        End If
 
        If ReturnToBill Then
            With HttpContext.Current
 
                URL = Made4Net.WebControls.ScreenList.GetScreenURL("BL")
                URL = Made4Net.Shared.Web.MapVirtualPath(URL)
                URL = Made4Net.Shared.Web.AddParamToURL(URL, "BillID", WorkingBillID)
 
                Made4Net.WebControls.DOPresets.PresetManager.CreatePreset("BL", "TEBillHdr", "BillID", WorkingBillID, True, True)
 
                .Response.Redirect(URL)
            End With
        Else
            With HttpContext.Current
 
                URL = Made4Net.WebControls.ScreenList.GetScreenURL("MI")
                URL = Made4Net.Shared.Web.MapVirtualPath(URL)
                URL = Made4Net.Shared.Web.AddParamToURL(URL, "MemoInID", InputDR("MemoInID"))
 
                Made4Net.WebControls.DOPresets.PresetManager.CreatePreset("MI", "TEMemoInHdr", "MemoInID", InputDR("MemoInID"), True, True)
                Made4Net.WebControls.DOPresets.PresetManager.CreatePreset("MI", "TEMemoInHdr", "Status", Nothing, True, True)
 
                .Response.Redirect(URL)
            End With
        End If
 
    End Sub
 
    'Doctype "R" = Receipt, "P" = PO
    Public Shared Sub CreateBillFromPO(ByVal DT As DataTable, ByVal DocType As String, ByVal VendorNum As String, ByVal VendorInvoice As String, ByVal sendToAcct As Boolean)
 
        Dim WorkingBillID As Integer
        Dim ph As POHdr
        Dim bh As BillHdr
        Dim bl As BillDtl
        Dim pd As PODtl
        Dim pd2 As PODtl
        Dim InputDR As DataRow
        Dim _billid As Integer
        Dim SQL As String
        Dim _date As Date = Date.Today
        Dim _newsplitid As Integer
        Dim ItemCount As Integer
        Dim i As Item
        Dim d As Diamond
        Dim j As Jewel
        Dim s As Integer
        Dim g As Gem
        Dim UnitCost As Decimal
        Dim ItemDT As New DataTable
        Dim ItemDR As DataRow
        Dim ReturnToBill As Boolean = False
        Dim URL As String
        Dim v As Vendor
        Dim CalcDate As String
        Dim ih As ItemHistoryClass
        Dim st As StyleClass
 
        If DT Is Nothing Then
            Throw New ArgumentNullException("DT")
        End If
 
        If DT.Rows.Count = 0 Then
            Throw New ApplicationException("No PO/Receipt details were selected.")
        End If
 
        DataInterface.BeginTransaction(Made4Net.Schema.CONNECTION_NAME)
        DataInterface.BeginTransaction()
 
        Try
            InputDR = DT.Rows(0)
            ph = POHdr.Load(InputDR("POHdrID"))
            v = Vendor.Load(ph("VendorNum"))
 
            With HttpContext.Current
                If .Request.QueryString.Get("BillID") Is Nothing Then
                    WorkingBillID = 0
                Else
                    WorkingBillID = .Request.QueryString.Get("BillID")
                    ReturnToBill = True
                End If
            End With
 
            If WorkingBillID > 0 Then
                bh = BillHdr.Load(WorkingBillID)
 
                'Check vendor is compatible
                If Not bh("VendorNum") = ph("VendorNum") Then
                    Throw New ApplicationException("Cannot add to bill with a different vendor.")
                End If
            End If
 
            If bh Is Nothing Then
                'find bill id from VendorNum/VendorInvoice
                Try
                    bh = BillHdr.Load(VendorNum, VendorInvoice)
                    WorkingBillID = bh("BillID")
                Catch ex As Made4Net.Shared.DataClassRecordNotFoundException
                    'does not exist
                End Try
            End If
 
            'Check status is ok for billing
            For Each DR As DataRow In DT.Rows
 
                If Not (DR.Item("Status") = "E" Or DR.Item("Status") = "R") Then
                    Throw New ApplicationException("Line items must be in EXPECTED or RECEIVING status for billing to proceed.")
                End If
 
                If DR.IsNull("ItemID") Then
                    Throw New ApplicationException(String.Format("For each PO line to be received, you must enter a valid Item #."))
                Else
                    Dim it As String = DR("ItemID")
                    If it.Length = 0 Then
                        Throw New ApplicationException(String.Format("For each PO line to be received, you must enter a valid Item #."))
                    End If
                End If
            Next
 
            'Create Bill if necessary
            If bh Is Nothing Then
                _billid = Made4Net.Shared.IDCounter.GetID("billid")
                bh = BillHdr.CreateNew()
                bh("BillID") = _billid
                bh("CreationDate") = _date
                bh("VendorNum") = ph("VendorNum")
                bh("VendorInvoice") = VendorInvoice
                bh("Status") = "O"
                bh("Terms") = v("Terms")
                CalcDate = ExpressionFunctions.CalculateDueDate(v("Terms"), Date.Today.ToString)
                If CalcDate.Length > 0 Then bh("DueDate") = Convert.ToDateTime(CalcDate)
                bh.Save()
            Else
                _billid = WorkingBillID
            End If
 
            For Each DR As DataRow In DT.Rows
 
                If ph("ReceiptDocType") = "P" Then
                    SQL = "SELECT count(*) FROM IAWItem Where  ItemID = '" & DR("ItemID") & "'"
                    ItemCount = DataInterface.ExecuteScalar(SQL)
 
                    If ItemCount > 0 Then
 
                        i = Item.Load(DR("ItemID"))
                            ' If Not i("Packaging") = Item.PACKAGING_PARCEL Then**********  comment bye me..  (  no more occurances find in the poroject)
                            '  Throw New ApplicationException(String.Format("Cannot merge with item {0} as it is not a parcel", DR("ItemID")))
                            'End If
 
                            If True Then
 
                            End If
 
                            i("Quantity") = i("Quantity") + DR("bill_qty")
 
                            i("QtyOnHand") = i("QtyOnHand") + DR("bill_qty")
                            i("UOMSize") = i("UOMSize") + DR("bill_units")
                            i("CaratOnHand") = i("CaratOnHand") = DR("bill_units")
                            i("QtyBilled") += DR("bill_qty")
                            i("CaratBilled") += DR("bill_units")
                            i.Save()
 
                            'Use original cost
                            If ph("MergeCostRule") = 1 Then
                                If DR("ItemType") = "D" Then
                                    d = Diamond.Load(DR("ItemID"))
                                    d("Quantity") = i("Quantity")
                                    d("QtyOnHand") = i("QtyOnHand")
                                    d("UOMSize") = i("UOMSize")
                                    d("CaratOnHand") = i("CaratOnHand")
                                    d("QtyBilled") = i("QtyBilled")
                                    d("CaratBilled") = i("CaratBilled")
                                    d.Save()
                                    UnitCost = d("DiamondCostPerUnit")
                                    d.UpdateCostPrice(0, d("DiamondCostPerUnit"), 0, d("RapPrice"))
 
                                ElseIf DR("ItemType") = "G" Then
                                    g = Gem.Load(DR("ItemID"))
                                    g("Quantity") = i("Quantity")
                                    g("QtyOnHand") = i("QtyOnHand")
                                    g("UOMSize") = i("UOMSize")
                                    g("QtyBilled") = i("QtyBilled")
                                    g("CaratBilled") = i("CaratBilled")
                                    g("CaratOnHand") = i("CaratOnHand")
                                    g("TotalCost") = g("CostPerUnit") * g("UOMSize")
                                    UnitCost = g("CostPerUnit")
                                    g.Save()
                                    i = Item.Load(DR("ItemID"))
                                    i("CostPriceTotal") = g("TotalCost")
                                    i.Save()
                                ElseIf DR("ItemType") = "J" Then
                                    j = Jewel.Load(DR("ItemID"))
                                    j("Quantity") = i("Quantity")
                                    j("QtyOnHand") = i("QtyOnHand")
                                    j("QtyBilled") = i("QtyBilled")
                                    j("UnitsBilled") = i("CaratBilled")
                                    j("UOMSize") = i("UOMSize")
                                    j("UnitsOnHand") = i("CaratOnHand")
                                    j("TotalCost") = j("CostPerUnit") * j("UOMSize")
                                    UnitCost = j("CostPerUnit")
                                    j.Save()
                                    i = Item.Load(DR("ItemID"))
                                    i("CostPriceTotal") = j("TotalCost")
                                    i.Save()
                                End If
                                pd = PODtl.Load(DR("POHdrID"), DR("PODtlID"), DR("SplitID"))
 
                                pd("Price") = UnitCost
                                pd("TotalPrice") = UnitCost * pd("Size")
                                pd.Save()
 
                                ih = ItemHistoryClass.CreateNew()
                                ih.FillData(i("ItemID"), "PO", DR("POHdrID"), i("Quantity"), i("UOMSize"), "Billed", pd("Price"), pd("TotalPrice"), "Adding to item from PO")
                                ih.Save()
 
                                ' Use average cost
                            Else
                                If DR("ItemType") = "D" Then
                                    d = Diamond.Load(DR("ItemID"))
                                    d("Quantity") = i("Quantity")
                                    d("UOMSize") = i("UOMSize")
                                    d("QtyOnHand") = i("QtyOnHand")
                                    d("CaratOnHand") = i("CaratOnHand")
                                    d("QtyBilled") = i("QtyBilled")
                                    d("CaratBilled") = i("CaratBilled")
                                    d.Save()
                                    d("TotalCost") = d("TotalCost") + (DR("Price") * DR("bill_units"))
                                    UnitCost = (d("TotalCost") / d("UOMSize")) - d("Expense")
                                    d.UpdateCostPrice(0, UnitCost, 0, d("RapPrice"))
 
                                ElseIf DR("ItemType") = "G" Then
                                    g = Gem.Load(DR("ItemID"))
                                    g("Quantity") = i("Quantity")
                                    g("UOMSize") = i("UOMSize")
                                    g("QtyOnHand") = i("QtyOnHand")
                                    g("CaratOnHand") = i("CaratOnHand")
                                    g("QtyBilled") = i("QtyBilled")
                                    g("CaratBilled") = i("CaratBilled")
                                    g("TotalCost") = g("TotalCost") + (DR("Price") * DR("bill_units"))
                                    g("CostPerUnit") = g("TotalCost") / g("UOMSize")
                                    g.Save()
                                    i = Item.Load(DR("ItemID"))
                                    i("CostPriceTotal") = g("TotalCost")
                                    i.Save()
                                ElseIf DR("ItemType") = "J" Then
                                    j = Jewel.Load(DR("ItemID"))
                                    j("Quantity") = i("Quantity")
                                    j("UOMSize") = i("UOMSize")
                                    j("QtyBilled") = i("QtyBilled")
                                    j("UnitsBilled") = i("CaratBilled")
                                    j("QtyOnHand") = i("QtyOnHand")
                                    j("UnitsOnHand") = i("CaratOnHand")
                                    j("TotalCost") = j("TotalCost") + (DR("Price") * DR("bill_units"))
                                    j("CostPerUnit") = j("TotalCost") / j("UOMSize")
                                    j.Save()
                                    i = Item.Load(DR("ItemID"))
                                    i("CostPriceTotal") = j("TotalCost")
                                    i.Save()
                                End If
 
                                ih = ItemHistoryClass.CreateNew()
 
                                Dim UnitPrice As Decimal
                                UnitPrice = Decimal.Round(i("CostPriceTotal") / i("UOMSize"), 2)
                                ih.FillData(i("ItemID"), "PO", DR("POHdrID"), i("Quantity"), i("UOMSize"), "Billed", UnitPrice, i("CostPriceTotal"), "Adding to item from PO")
                                ih.Save()
                            End If
                        Else
                            'i = Item.CreateNewFromPO(DR)
                            i = Item.CreateNewFromPO(ph, DR) '//'*****changed by  vicky
                            i = Item.Load(DR("ItemID"))
                            i("CostPriceTotal") = DR("Price") * DR("bill_units")
                            i("VendorNum") = ph("VendorNum")
                            i("PurchaseDate") = Date.Today
                            i("QtyBilled") = i("Quantity")
                            i("CaratBilled") = i("UOMSize")
                            i("InboundStatus") = "P"
                            i.Save()
 
                            ih = ItemHistoryClass.CreateNew()
                            ih.FillData(i("ItemID"), "PO", DR("POHdrID"), i("Quantity"), i("UOMSize"), "Billed", DR("Price"), i("CostPriceTotal"), "Adding to item from PO")
                            ih.Save()
 
                            If DR("ItemType") = "D" Then
                                d = Diamond.Load(DR("ItemID"))
                                d("TotalCost") = DR("Price") * DR("bill_units")
                                d("CostPerUnit") = DR("Price")
                                d("DiamondCostPerUnit") = DR("Price")
                                d("QtyBilled") = i("QtyBilled")
                                d("CaratBilled") = i("CaratBilled")
                                d.Save()
                            ElseIf DR("ItemType") = "G" Then
                                g = Gem.Load(DR("ItemID"))
                                g("TotalCost") = DR("Price") * DR("bill_units")
                                g("CostPerUnit") = DR("Price")
                                g("QtyBilled") = i("QtyBilled")
                                g("CaratBilled") = i("CaratBilled")
                                g.Save()
                            ElseIf DR("ItemType") = "J" Then
                                j = Jewel.Load(DR("ItemID"))
                                If Not DR.IsNull("StyleID") Then s = DR("StyleID")
                                j("StoreStyle") = DR("StyleID")
                                'j.SetStyleValues(DR("StyleID"))
                                st = StyleClass.Load(DR("StyleID"))
                                j("TotalCost") = DR("Price") * DR("bill_units")
                                j("CostPerUnit") = DR("Price")
                                j("AdjustAmount") = st("AdjustAmount")
                                j("AdjustPerCent") = st("AdjustPerCent")
                                ' cost changed on po or receipt
                                If Not DR("Price") = st("TotalCost") Then
                                    j("AdjustAmount") = DR("Price") - st("TotalCost")
                                    j("AdjustPerCent") = j("AdjustAmount") * 100 / j("SubTotal")
                                End If
                                j("QtyBilled") = i("QtyBilled")
                                'j("CaratBilled") = i("CaratBilled")
                                j.Save()
                            End If
 
                            If Not DR.IsNull("LayoutID") Then
                                Layout.AddItem(DR("LayoutID"), DR("LayoutType"), DR("bill_qty"), DR("ItemID"))
                            End If
                        End If
                    Else
                        i = Item.Load(DR("ItemID"))
                        i("PurchaseDate") = Date.Today
                        i("QtyBilled") = i("Quantity")
                        i("CaratBilled") = i("UOMSize")
                        i("InboundStatus") = "P"
                        i.Save()
                    End If
 
                    ph = POHdr.Load(DR("POHdrID"))
                    bl = BillDtl.CreateNew()
                    bl.LoadDatafromDR(DR)
 
                    bl("BillID") = _billid
                    bl("BillLine") = bh.GetNextLine()
                    If ph("ReceiptDocType") = "P" Then
                        bl("SourceDocType") = "P"
                    Else
                        bl("SourceDocType") = "L"
                    End If
 
                    bl("SourceDocID") = DR.Item("POHdrID")
                    bl("SourceDocLine") = DR.Item("PODtlID")
                    bl("Quantity") = DR.Item("bill_qty")
                    bl("Units") = DR.Item("bill_units")
                    bl("Discount") = 0
 
                    bl.Save()
 
                    'Split PO Detail if necessary & update status to billed
                    ' pd2 is the original
                    pd2 = PODtl.Load(DR("POHdrID"), DR("PODtlID"), DR("SplitID"))
 
                    If Not DR("Quantity") = DR("bill_qty") Then
                        'create new source line id 
                        SQL = "Select MAX(SplitID) FROM IAWPODtl WHERE POHdrID = " & DR("POHdrID") & " AND PODtlID = " & DR("PODtlID")
                        _newsplitid = DataInterface.ExecuteScalar(SQL) + 1
 
                        pd = ph.CreateDetail(DR)
 
                        pd("SplitID") = _newsplitid
                        pd("ItemID") = DR.Item("ItemID") & "_" & _newsplitid
                        pd("Status") = "E"
                        pd("Quantity") = DR("Quantity") - DR("bill_qty")
                        pd("Size") = DR("Size") - DR("bill_units")
 
                        pd.Save()
 
                    End If
 
                    ' update original
                    pd2("Quantity") = DR("bill_qty")
                    pd2("Size") = DR("bill_units")
                    pd2("ItemID") = DR("ItemID")
                    pd2("BillID") = _billid
                    pd2("Status") = "B"
                    pd2("TotalBilled") = pd2("Size") * pd2("Price")
                    pd2.Save()
 
                    i = Item.Load(DR("ItemID"))
                    i("InboundStatus") = "P"
                    i("PurchaseDate") = Date.Today
                    i.Save()
 
                Next
 
        Catch ex As Exception
            DataInterface.RollBackTransaction(Made4Net.Schema.CONNECTION_NAME)
            DataInterface.RollBackTransaction()
 
            Throw New BillHdrException("An error has occurred while trying to create the bill.", ex)
        End Try
 
        DataInterface.CommitTransaction(Made4Net.Schema.CONNECTION_NAME)
        DataInterface.CommitTransaction()
 
        If sendToAcct Then
            Try
                bh.SendToAccountingSystem()
            Catch ex As Exception
 
                Throw New ApplicationException(String.Format( _
                    "Bill # {0} was created/updateds successfully, but there was an error while sending the bill to the accounting system.", _
                    bh("BillID")), ex)
 
            End Try
        End If
 
        If ReturnToBill Then
            With HttpContext.Current
 
                URL = Made4Net.WebControls.ScreenList.GetScreenURL("BL")
                URL = Made4Net.Shared.Web.MapVirtualPath(URL)
                URL = Made4Net.Shared.Web.AddParamToURL(URL, "BillID", WorkingBillID)
 
                Made4Net.WebControls.DOPresets.PresetManager.CreatePreset("BL", "TEBillHdr", "BillID", WorkingBillID, True, True)
 
                .Response.Redirect(URL)
            End With
        ElseIf DocType = "P" Then
            With HttpContext.Current
 
                URL = Made4Net.WebControls.ScreenList.GetScreenURL("PO")
                URL = Made4Net.Shared.Web.MapVirtualPath(URL)
                URL = Made4Net.Shared.Web.AddParamToURL(URL, "POHdrID", InputDR("POHdrID"))
 
                Made4Net.WebControls.DOPresets.PresetManager.CreatePreset("PO", "TEPO", "POHdrID", InputDR("POHdrID"), True, True)
                Made4Net.WebControls.DOPresets.PresetManager.CreatePreset("PO", "TEPO", "Status", Nothing, True, True)
 
                .Response.Redirect(URL)
            End With
        ElseIf DocType = "R" Then
            With HttpContext.Current
 
                URL = Made4Net.WebControls.ScreenList.GetScreenURL("RC")
                URL = Made4Net.Shared.Web.MapVirtualPath(URL)
                URL = Made4Net.Shared.Web.AddParamToURL(URL, "POHdrID", InputDR("POHdrID"))
 
                Made4Net.WebControls.DOPresets.PresetManager.CreatePreset("RC", "TEPO", "POHdrID", InputDR("POHdrID"), True, True)
                Made4Net.WebControls.DOPresets.PresetManager.CreatePreset("RC", "TEPO", "Status", Nothing, True, True)
 
                .Response.Redirect(URL)
            End With
        End If
 
    End Sub
 
    Private Sub CreateBillFromSO(ByVal DT As DataTable)
 
        Dim WorkingBillID As Integer
        Dim sh As SOHdr
        Dim bh As BillHdr
        Dim bl As BillDtl
        Dim sd As SODtl
        Dim InputDR As DataRow
        Dim _billid As Integer
        Dim SQL As String
        Dim _date As Date = Date.Today
        Dim _newsplitid As Integer
        Dim _item As String
        Dim v As Vendor
 
 
        InputDR = DT.Rows(0)
        sh = SOHdr.Load(InputDR("SalesOrderID"))
        v = Vendor.Load(InputDR("VendorNum"))
 
        With HttpContext.Current
            If .Request.QueryString.Get("BillID") Is Nothing Then
                WorkingBillID = 0
            Else
                WorkingBillID = .Request.QueryString.Get("BillID")
            End If
        End With
 
        If WorkingBillID > 0 Then
            bh = BillHdr.Load(WorkingBillID)
 
            'Check vendor is compatible
            If Not bh("VendorNum") = sh("VendorNum") Then
                Throw New ApplicationException("Cannot add to bill with a different vendor.")
            End If
 
        End If
 
        'Check status is ok for billing
        For Each DR As DataRow In DT.Rows
            If Not DR.Item("Status") = "A" Then
                Throw New ApplicationException("Line items must be in AVAILABLE status before billing can proceed.")
            End If
        Next
 
        'Create Bill if necessary
        If WorkingBillID = 0 Then
            _billid = Made4Net.Shared.IDCounter.GetID("billid")
            bh = BillHdr.CreateNew()
            bh("BillID") = _billid
            bh("CreationDate") = _date
            bh("VendorNum") = sd("VendorNum")
            bh("Status") = "O"
            bh("Terms") = v("Terms")
            bh.Save()
 
            Else
 
                _billid = WorkingBillID
        End If
 
        For Each DR As DataRow In DT.Rows
 
            bl = BillDtl.CreateNew()
 
            bl("BillID") = _billid
            bl("BillLine") = bh.GetNextLine()
            bl("SourceDocType") = "I"
            bl("SourceDocID") = DR.Item("MemoInID")
            bl("SourceDocLine") = DR.Item("MemoInDtlID")
            bl("ItemID") = DR.Item("ItemID")
            bl("ItemType") = DR.Item("ItemType")
            bl("Quantity") = DR.Item("bill_qty")
            bl("Units") = DR.Item("bill_units")
            bl("UOM") = DR.Item("ValueBasis")
            bl("Price") = DR.Item("Price")
            bl("Description") = DR.Item("Description")
            bl("VendorItemID") = DR.Item("VendorItemID")
 
            bl.Save()
 
            'Split Memo In Detail if necessary & update status to billed
            If Not DR("Quantity") = DR("bill_qty") Then
                'create new source line id 
                SQL = "Select MAX(SplitID) FROM IAWMemoInDtl WHERE MemoInID = " & DR("MemoInID") & " AND MemoInDtlID = " & DR("MemoInDtlID")
                _newsplitid = DataInterface.ExecuteScalar(SQL) + 1
 
                sd = SODtl.CreateNew()
                sd("SalesOrderID") = DR("SalesOrderID")
                sd("Line") = DR("Line")
                sd("SplitID") = _newsplitid
                sd("ItemID") = DR.Item("ItemID")
                sd("ItemType") = DR.Item("ItemType")
                sd("Price") = DR.Item("Price")
                sd("Description") = DR.Item("Description")
                sd("VendorItemID") = DR.Item("VendorItemID")
                sd("Status") = DR.Item("Status")
                sd("Quantity") = DR("Quantity") - DR("bill_qty")
                sd("Size") = DR("Size") - DR("bill_units")
                sd("UOM") = DR("UOM")
                sd("Packaging") = DR("Packaging")
                'sd("ContainerID") = DR("ContainerID")
 
                sd.Save()
 
            End If
 
            sd = SODtl.Load(DR("SalesOrderID"), DR("Line"), DR("SplitID"))
 
            If Not DR("Quantity") = DR("bill_qty") Then
                sd("Quantity") = DR("bill_qty")
                sd("Size") = DR("bill_units")
            End If
            sd("BillID") = _billid
            sd("Status") = "B"
            sd.Save()
 
        Next
 
 
    End Sub
 
End Class
 
End Namespace

Open in new window

Before-building.JPG
After-building.jpg
This error:
Name 'ExpenseEntryDetail' is not declared on line 56 and 58  in ExpenseEntryExec.vb which is

Private Shared Sub SaveDetail(ByVal params As ExecutionParams, ByVal mode As String)
            Dim h As ExpenseEntryDetail
            Dim str As Int16
        Dim dr As DataRow = params.GetFirstDataRow()
        If mode = "I" Then
                h = ExpenseEntryDetail.CreateNew()
        Else
            h = ExpenseEntryDetail.Load(dr("ItemID"), dr("Line"))
        End If
        h.LoadRowData(dr)
        h.Save()
    End Sub
Unless CreateNew is a shared function or Sub, you cannot call CreateNew() like that.
No It is already  being used like this.
This application was in asp 1.1 and now i have to change it to asp 3.5 i have send the snippet only to show that  there is no error now.  you please have a look on the images that i send in the attachment what can be  the reason that it is showing in intellisense help before building it.. i have also deleted
everything from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

The class is place in App_Code, what is the build action for the class? Click the class and check the build action in Properties window.
I see only two properties in the property window of a class file in the App_Code  
Filename   and File path......  i dont see  Build action  in the property window
Oh, it's a web site project.
Honestly, I am out of ideas. You can try some low level, non-technical approaches and if they don't help either, then I am afraid I can't help you further.
1. Reboot you computer.
2. Right click your solution and select "Clean Solution". After clean solution, rebuild it.
yes..  I have mentioned it in the first live of the very first Question.

 Anyway..its okay..  Thanks for your time.  :-)

I have tried all this.  but i m not able to understand why this is happening.
I  reboot it one more time....

But i dont see any "Clean Solution" option when i Right Click in the solution explorer.
Click Build menu, then select "Clean Solution"
There are following options in Build menu :----

Build Solution
Rebuild Solution
Build website
Re build website
Publish website
Build page
Batch Build
Configuration manager
Did you try opening this solution on some other computer? Give it a try.
yes i have tried but  nothing happened.. it is behaving the same way......
hi  all....

thanks  for  your replies but nothing has worked for me yet..
ASKER CERTIFIED SOLUTION
Avatar of vishwaraj
vishwaraj
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial