Add Discount % In AR Invoice

How can i add Discount% in AR Invoice Document.I had set the discount % in Document. But after Adding The discounted amount not correctly updated in The Invoice.How can i set.My code as follows.
Dim RetCode As Integer
Dim OInvoice As SAPbobsCOM.Documents
Dim TPrice As Double = 0
Dim Disc As Double
OInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
For Each row As DataGridViewRow In dgvitem.Rows
TPrice = TPrice + ((CType(row.Cells("Price").Value, Double) * CType(row.Cells("Quantity").Value, Double)))
Next
Disc = (TPrice * CType(txtper.Text, Double) / 100)
With OInvoice
.Series = My.Settings.Series
.CardCode = txtcustcode.Text
.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items
.DiscountPercent = CType(txtper.Text, Double)
.UserFields.Fields.Item("U_Mode").Value = "CA"
With .Lines
For Each row As DataGridViewRow In dgvitem.Rows
.ItemCode = row.Cells("PartNo").Value
.Quantity = CType(row.Cells("Quantity").Value, Double)
.WarehouseCode = My.Settings.MWhscode
.Add()
Next
End With
.DocTotal = TPrice - Disc
RetCode = .Add()
If RetCode <> 0 Then
MsgBox(oCompany.GetLastErrorDescription)
Return Nothing
Else
Return oCompany.GetNewObjectKey()
End If
End With
How can fix the error, Please help

Hi,
Try this:
Dim RetCode As Integer
Dim OInvoice As SAPbobsCOM.Documents
Dim TPrice As Double = 0
OInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
With OInvoice
  .Series = My.Settings.Series
  .CardCode = txtcustcode.Text
  .DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items
  .DiscountPercent = CType(txtper.Text, Double)
  .UserFields.Fields.Item("U_Mode").Value = "CA"
  With .Lines
  For Each row As DataGridViewRow In dgvitem.Rows
  .ItemCode = row.Cells("PartNo").Value
  .Quantity = CType(row.Cells("Quantity").Value, Double)
  .Price = CType(row.Cells("Price").Value, Double)
  .WarehouseCode = My.Settings.MWhscode
  .Add()
  Next
  End With
  RetCode = .Add()
  If RetCode <> 0 Then
  MsgBox(oCompany.GetLastErrorDescription)
  Return Nothing
  Else
  Return oCompany.GetNewObjectKey()
  End If
End With
Regards,
Csaba

Similar Messages

  • CASH DISCOUNT IN VENDOR INVOICE-F43

    Hi sap Gurus
    My client want to post the cash discount at the time of inoice in F-43,  My scenarious is like this
    amount is                            300000
    less cash disoucnt 1%          3000
                                net amt    297000
                           vat 12.5%      37125(297000*12.5/100)
                           freight             2000
                                              336125
    ENTRY SHOULD BE  LIKE
    INVENTORY               DR 300000
    FRIGHT                                2000
    TAX                                    37125
                         TO VENDOR ACCOUNT    33125
                               CASH DISCOUNT         3000
    In this case i can able to post the freight, and vat but where we have to maintain discount % and how to calcuate the vat on 297000 not the base amount.
    Thannks in advance
    KISHORE

    Hi Ravi
    I have maintained terms of payment i have activated allow discount for incoming invoice and gl accounts for cash discounts,
    Stills while simulating the document it is showing the vat calculation correctly but concern document for cash discount is not simulating
    Thanks

  • Discount on AR Invoices

    Hi all,
    Is there any way to change discount on AR invoices?  We need to process AR invoices and we would like to try without discount, but the system wonu2019t let us take the discount off?
    Any advice please?
    Edited by: Matthew Brigley on Oct 29, 2009 12:34 PM

    Hi....
    When he speaks off, to discount concerns? discount level of detail (per line) or discount for the document?
    The online discount can be modified whenever we have the authorization to do so and that the field is parameterized as an asset, while the total level of discount to understand that it can always be amended.
    Best regards,

  • Add discount for particular customer on delivery

    Hi,
    I need add discount for particular customer on delivery.
    Actually what i want;
    ABC as customer takes Goods quantity 100 pc rate 5 total=500 and VAT 15% of total =75 then gross total =575.
    and discount for this customer is 1.5% of base amount that is 500*1.5%= 7.5
    now amount due for the customer is
    Base amount=100 * 5    =500
    VAT15%      =500*15% =  75            
    Total                                 575
    -Discount 1.5%                 7.5
    Dues Total                        567.5
    This is the result will be shown.
    Please help regarding this
    Regards,
    Mizan

    Hi,
    Base Amount              500          
    VAT 15%                      75          
    Total                     575          
    (-) Discount 1.5%       7.5        On Base Amount     
    Balance             567.5
    Here is the calculation . Look VAT figure is the same after discount.
    Mizan

  • We are Not able to Add, approved A/P invoice - Error - Tax code Missing

    Dear Experts,
    In A/P -> A/P service Invoice
    When We are going to Add Approved Invoice ,system can not allow . This
    invoice is go through a approval process ,system can not allow to change any
    of document row during approval process or after approval process.
    we are unable to add tax or remove line item after approval.
    We are Not able to Add, approved A/P invoice - Error - Tax code Missing
    [A/p Invoice Row -Tax code] Line 3 [Message 3513-14]
    I think ,It should allow the system to edit the row tax or amount after or during
    approval process

    Don't worry,AP invoice is not get posted,it will be saved as draft only,
    Default tax code for purchase documents using tax code determination.
    Create new ap invoice with tax code and send it for approval.
    Orginator should ensure all mandatory fields in document are entered correctly before
    sending it for approval.

  • R12: Discount on Payables Invoice (Functional)

    Hi all,
    I have a scenario involving discount on the purchase of an Item. My invoice, as received as the supplier is as follows:
    $
    Item xxx 100
    Discount (10)
    Total 90
    VAT(15%) 15.50
    Net 103.50
    When I create an invoice in AP, I add a line with amount $100 and assign a tax of 15%
    The above create a total of $115 and i add this total as header amount in the invoice.
    AND in the Scheduled Payment tab at line level, I add a discount amount of $10 for the "First Discount" Info.
    When I make payment for the above invoice, a pop-up appears indicating discount will be applied. But the Payment amount is $105 (Invoice header amount minus discount).
    Is this the only way to treat discount in AP?
    I need the payment amount to be $103.50 after applying discount.
    Vik

    If I understand correctly, it seems like you are manually calculating the tax and entering it to the invoice amount. If you configure your taxes in Oracle, and then enter the invoice for the actual amount, then Oracle will know the true invoice amount which is the discount basis and create the tax line according to the configurations (the way you want it). What you are doing now is adding the tax outside Apps configuration and then expecting Apps to calculate the appropriate discount. If you want to use the standard functionality, you need to set up all dependent parts of that functionality. If tax calculation is a dependency of the discount basis, which is certainly a dependency of discount payment terms, then you need to set it up properly.

  • Change Discount Base in Invoice

    Dear Gurus,
    There is a posted invoice created using reference and as the Discount Base was not changed new documents got posted with the wrong Discount Base.
    How can I change the Discount Base, I tried using FB02, but it does not allow me to make any changes in that field.
    Please let me know the steps ASAP.
    Thanks in advance for your time and reply.
    regards,
    Raj

    Hi,
    Check whether field is allowed for change in configuration. The path is as under:
    <b>IMG> Financial Accounting > Financial Accounting Global Settings > Document > Line Item > Document Change Rules,line item.</b>
    If that field is not there, you can add it - make the required changes and revert the changes in configuration if you don't need it on an ongoing basis.
    Thanks
    Murali.

  • DI: Add Serialnumbers to AR Invoice Lines

    We are having a difficult time adding serialized items to AR invoices through the DI. It doesn't seem to be happy doing this no matter what we try. Probably a rookie mistake but I have tried several different ways of doing this with no luck. We get a 5002 error when trying to add the invoice if the serialized items are included on it. Works fine with just the non-serialized.
    Here is the current iteration of the code. The DB lookups work fine and return the desired values. The exact same serialized items can manually be added to an invoice without any issues. If anyone can offer some advice I would  greatly appreciate it.
    Thanks,
    Matt
    Dim EINV As SAPbobsCOM.Documents
    Dim SerialNumber As SAPbobsCOM.SerialNumbers
    Set EINV = Company.GetBusinessObject(oInvoices)
    'Snip
    'EINV setup and non-serialized items added
    'No problems until we try adding serialized items
    'All values return properly and can be added manually to an invoice.
    'Fails with a 5002 when EINV.Add is invoked after serialized items are added.
    'EINV.Add works fine with serialized code disabled.
    If SerialRS.RecordCount > 0 Then
       SerialRS.MoveFirst
       Do While SerialRS.EOF = False
        STech = SerialRS.Fields("TechNumber").Value
        SItemID = SerialRS.Fields("ItemID").Value
        SSerial = SerialRS.Fields("Serial").Value
        If STech = TechNo Then
          EINV.Lines.Add
          EINV.Lines.SetCurrentLine (EINV.Lines.Count - 1)
          EINV.Lines.ItemCode = RTrim(SItemID)
          EINV.Lines.Quantity = 1
          EINV.Lines.TaxCode = "ZERO"
          EINV.Lines.WarehouseCode = TechNo
          Set SerialNumber = EINV.Lines.SerialNumbers
          SerialNumber.SetCurrentLine (SerialNumber.Count - 1)
          Set RecSet3 = Company.GetBusinessObject(BoRecordset)
          RecSet3.DoQuery ("select top 1 sysserial from osri where intrserial = '" & SSerial & "'")
                                                                                    If RecSet3.RecordCount > 0 Then
              SerialNumber.InternalSerialNumber = SSerial
              SerialNumber.SystemSerialNumber = RecSet3.Fields("sysserial").Value
           End If
          End If
          SerialRS.MoveNext
        Loop
    End if
    Addresult = EINV.Add
    If (Addresult <> 0) Then
      Call Company.GetLastError(nErr, errMsg)
      If (0 <> nErr) Then
         MsgBox ("Found error:" + Str(nErr) + "," + errMsg)
      End If
    End If

    This is evidently an issue with adding non-serialized items to an invoice before adding serialized items through the DI. It looks like the DI was trying to add the serialnumbers to the non-serialized doclines despite our best efforts to add them to the appropriate items. Once we changed the order of our code and added the serialized items first it worked just fine.
    On a related note, if you add individual lines to an invoice for the same item (multiple lines of single quantity for the same item instead of a single line with a quantity > 1) the DI will only add serialnumbers to the first docline occurence of the item in question.

  • Cash discount calculation at invoice level not at sales order level

    Dear Friends
    while i am executing the sales cycle creten Cash discount conditions are calculating in the Invoice directly not in sales order.
    can you please let us know your views oin what basis iot calculating directly in the invoice, since payment terms is there in both sales order and invoice level. but discount is only appearing at invoice level, not in the sale order level..
    where these setting incurred in this process. i have verifies all the routies, there is no such kind of logic to calculate in a particular palce.
    treat this one as high priority and let me know.
    Thanks
    Raju.

    Hi
    while i am executing the sales cycle creten Cash discount conditions are calculating in the Invoice directly not in sales order.
    can you please let us know your views oin what basis iot calculating directly in the invoice, since payment terms is there in both sales order and invoice level. but discount is only appearing at invoice level, not in the sale order level..
    Please check your Pricing Procedure, whetehr against your Cash Discount Condition Type, Requirement 24 or 23 is maintained? If it is maintained remove these requirements and save. Then try to run the transaction.
    Regards,
    Amitesh Anand

  • DISCOUNT IN SALES INVOICE

    Hi All,
    I have one querry. What is the requirement of discount in row lavel as well as in Header lavel in sales invoice.How I will get the report of this discount.Because it is not generating any jurnal entry.only the net amount is posted in the JE.
    Thanks
    santosh

    Hi Santosh
    SAP Business One always posts the net value after discount. If you would like the gross amount posted to sales and the discount to a separate account, you can use Freight charges to achieve this. In the first Freight charge post a - (negative value) of the discount to a discount account and in the second a + (positve value) to the sales account. The effect is as follows:
    Price ........... Discount ................ Nett Price ............... Freight 1 ................. Freight 2 ........Doc Total
    100 ............. 10 ......................... 90 .......................... -10 .......................... 10 .................= 90
    CR Sales .... 90
    CR Sales .... 10
    DR Discount  10
    These freight charges can be linked with Formatted Searches so it will be automatically posted.
    Let me know if you would like to configure the above and I can send you some sample queries to use.
    Kind regards
    Peter Juby

  • No line item for Cash discount in customer invoice

    Hi Experts,
      Can anyone please suggest with configuration details for customising the customer invoice,  to display invoice with cash discount line item.  Currently i have assigned the customer master data with payment terms to include cash discount of 10% on for invoice with credit period of 20 days.
    Thanks in advance
    satish

    I think first thing you should be looking for is are you following net discount method or gross discount method . As that will define whether the posting of discount will be at invoice or when you post the payment document against that invoice. + you have to configure cash discount accounts before you can post in cash discount.
    Net: Cash discount clearing account and Cash discount loss/gain account (At the time of Invoice posting )
    Gross: Cash discount given and Cash discount recieved account (At the time of payment)

  • How To Add Freight Amount in Invoice Before the Invoice is Posted Through SDK

    Dear All,
    I have a requirement in SAP B1 9.0 where the user want to add the freight amount in the freight window based on an udf value automatically .
    So if there is an possibility of adding the freight amount based on an udf calculated value though SDK before the Invoice get added in the Database.
    Please suggest if this is possible through SDK or any work around for this scenario in SAP.
    Thanks & Regards,
    Amit

    Hi Amit,
    Here is a way to do it via UIAPI:
    Setting a Freight by the UI API ?
    If you need to do it via DIAPI, have a look here:
    How to update amount in freight column(INV3) of A|RInvoice through SDK
    DI Copy AP(AP Invoice) from PO(Purchase Order)
    Populating Freight Charges on Sales Order
    Freight in A/R Invoice
    Hope it helps.
    Thanks & Regards
    Ankit Chauhan

  • Add interest on ar invoice

    Dear expert,
    If our company want to do financing for our customer to buy our product (such credit card installment payment) how to apply on ar invoice?
    eg.
    our lcd set worth 1200 usd , customer x pay down payment 200 usd and make 10 times installment with 12% annual interest
    so our first invoice should 100 + (1000 * 1%) usd , second invoice should 100 + (900 * 1%) usd
    should we apply interest manually calculate or sap b1 has facility to add automatically
    Thanks

    Hi,
    I don't think there is a built-in function in B1 already. You may post a DRQ here:
    /community [original link is broken]
    Thanks,
    Gordon

  • Unable to add discount

    Hi Experts
    On the incoming payment screen trying to add a discount amount which is under 0.05 and as soon as you enter this it goes away. If you enter 0.05 or above it will remain. whats causeing this
    Thank you
    Regards
    Apsara

    Dear Apsara,
    Rahul suggestion is definitely perfect.
    but if you don't want to increase decimal so you can fill discount in amount filed in incoming payment.
    Regards
    Mangesh Pagdhare.

  • SRM 7 ECS : "Add contract item" to Invoice

    Hello,
    We are creating invoices that will be posted to ECC 6.
    Those are " contract call-off" invoices without PO reference.
    What config should be done to get the option "Add item/Contract item" working? Currently it desperately remains grey...
    Thanks in advance.

    Hi
    Can you elaborate a little bit? It is not clear what I could do regarding Acount Assignment types and they are mapped with ECC as a standard.
    I just need to use the shortcut in the portal to call the contract straight away instead of having to go into the item details.
    Thanks

Maybe you are looking for

  • How to load configuration using Cisco USB port???

    on USB-flush configuration there. I try to download it gives this: Switch#copy usbflash0: 3560-ST Source filename [3560-st]? Destination filename [3560-ST]? %Error opening usbflash0:3560-st (File not found) What is the Problem? flash formatted on mos

  • SQL Query + long execution time.

    Dear Gurus/masters/All, I request you all to help me in tuning the SQL query which is taking more time. DB Version : 10.2.0.4 SQL Query WHERE condition: select column1, column2, ......... FROM SIEBEL.S_ORG_EXT T1, SIEBEL.S_PROD_INT T2, SIEBEL.S_VOD T

  • Problem in sending IDOC

    Hi experts,                   i am trying to send customer number to other system..i am not getting no errors...but status 30 is coming in outbound idoc like "receiver exits,field conversion,filter exits....." this is warning... can any body tell me

  • NETworking Lightroom ... how I survive, and organize folders

    fyi: I am networking my data files in LRv1 on a NAS and a USB2 drive being shared on a WinXP Pro OS. My problem is we cannot "share" the Lightroom Database.lrdb file. (I do realize to do it right will be complicated ... if you wanted to share only "s

  • Having issue with update Adobe 11.0.06.  Error 1603.

    Having issue with update Adobe 11.0.06.  Error 1603.