Sales order Cost Price

dileepvarmavdileepvarmav Member Posts: 11
edited 2009-10-08 in Dynamics AX
Hi all,

1)I am creating a sales order through code successfully, but unable to fill
the costprice for the respective sales Items. How to specify cost price
through code?

2) I am updating the sales order with status Invoice, Can i specify my own
invoice number and update a sales order. if so where and how to assign the
number as invoice number for a sales order.

Please help me out in resolving the above problems

Best regards,
dileep.

Comments

  • kapil4dynamicskapil4dynamics Member Posts: 591
    <EDIT> I did edit didn't notice it was for Ax and replied. :mrgreen:
    Kapil Khanna
  • dileepvarmavdileepvarmav Member Posts: 11
    Hello kapil,

    I am sorry to say, i dint understood your above reply .

    I am using Dynamics Ax 2009. i need help regarding the above two queries.

    Regards
    Dileep
  • kranthikranthi Member Posts: 72
    Hi,

    for the first query u can write this code and update the sales price with costprice.

    SalesLine.SalesPrice = decround(InventSum::find(SalesLine.ItemId,SalesLine.InventDimId).costPricePcs(),2);

    for the second query i need some clarification.
    how u are updating invoice and which tables u are updating?
    Kranthi
  • dileepvarmavdileepvarmav Member Posts: 11
    Hello Kranthi,

    Thanks for your reply.

    I need to create a sales order line through code and wanted to fill CostPrice field of Sales Line.

    I have used the below line
    SalesLine.CostPrice = InventSum::find(SalesLine.ItemId,SalesLine.InventDimId).costPricePcs();

    and found there is some difference in Sales line cost price between manual creation and the Through code. I will try to explore this furthur

    Regarding my second query..
    I am using AxsalesTable to create a sales order and SalesFormLetter class to update the Order to the status invoice.
    Invoice number is assigned by the system. I want to replace the Invocie number with my custom number through code.

    Regards
    Dileep.
  • kranthikranthi Member Posts: 72
    Hi,

    Actually the invoice number is generated by sytem.

    u can override the system generated number with u r customer reference number.

    In SalesFormLetter_Invoice class in the (initJournal) method the system will assign the
    generated sequence, there u can override the code and assign the number what ever u want.

    I think it would help u.
    Kranthi
  • kranthikranthi Member Posts: 72
    HI,

    Go through the class SalesFormLetter_Invoice (initJournal - method)
    Kranthi
Sign In or Register to comment.