locked
Issue in Create Sales Order Invoice RRS feed

  • Question

  • Hi All

    I have a requirement to create invoice of those products whose invoice has been not created.

    In sales section when I click orders its shows all the orders when I  open any order and then click "Create Invoice" its generate the invoice of all the products exist in the sales order.If I add some new product in the sales order and generate invoice,It takes all the product(new and old both).
    My concern is ,after clicking "Create Invoice" it only generate the invoice of those product who have been never invoiced (means generate invoice of  new product not the old products who have aready invoiced).

    Hope this make a sense.

    Kindly let me know how it will possible.

    Thanks

    Shipra
    Thursday, December 18, 2008 9:40 AM

Answers

  • You need to cutom create the button in ISV.config file.
    You can remove the default button using JavaScript.
    You will need to make a call to the MS CRM webservice to integrate the sales order and to create the new Invoice with the new items.

    Hassan.

    Friday, December 19, 2008 3:19 PM

All replies

  • Hi Shipra,
        Be default every time you click "Create Invoice" MS CRM generates a new invoice with all of the products in the order.
    This happens even if the previous invoice generated from the order has been invoiced. 

    There is no configruation or system setting you can do to change this behaviour. 

    Two possible work arrounds.
    1- Review current sales process. Create new order and invoice for all products requested  by the customer after the order has been "Fullfilled" and the Invoice "Paid". OR add new products to the existing invoice directly if the invoice is not "Paid".

    2- Disable the existing MS CRM "Create Invoice" button and write custom code that captures the event and creates the invoice based on your stated requirement.

    regards,
    Hasan.

    Thursday, December 18, 2008 10:23 AM
  • Hi Hasan,

    Thanks for your reply..

    As per second work around i.e 2- Disable the existing MS CRM "Create Invoice" button and write custom code that captures the event and creates the invoice based on your stated requirement..

    Could you please give me a brief idea how can I disable the 
    existing MS CRM "Create Invoice" button and how its possible to write custom code that captures the event and creates the invoice for the specified products as according to my previous post.




    Friday, December 19, 2008 11:27 AM
  • You need to cutom create the button in ISV.config file.
    You can remove the default button using JavaScript.
    You will need to make a call to the MS CRM webservice to integrate the sales order and to create the new Invoice with the new items.

    Hassan.

    Friday, December 19, 2008 3:19 PM
  • Hi

    Thanks a lot for your reply.

    I want to discuss the scenerio.In MS Dynamics CRM 4.0 what I analysed is ,whenever we create a new sales order it insert a record in salesOrder and correspondingly in SalesOrderdetail .SalesOrderDetail contains the product ids.
    When we select a sales order and click create invoice then perhaps it does ..

    1-  It fires a query perhaps to get all the  prices of the products  from salesorder,salesorderdetail and product tables to generate invoice
    2-  or It maps the sales order detail products to invoice product.(i.e Order Product-> Invoice Product)

    The new invoice insert a record in Invoice and InvoiceDetail ,InvoiceDetail contains the productids.

    ConvertSalesOrdertoInvoiceResponse in CRMService.Wsdl  takes salesorderid as input parameter.

    As you have written You will need to make a call to the MS CRM webservice to integrate the sales order and to create the new Invoice with the new items.

    How it possible Kindly let me know what is the way
    to make a call to the MS CRM webservice to integrate the sales order and to create the new Invoice with the new items..

    What I thought is to add a new field let it name IsProcessed  of boolean type in sales order detail .and sales orderdetail has product id ,if the invoice of that product is generated then IsProcessed set to true.

    And while creating new invoice of a salesorder it checks whether the products is processed or not if not processed then it will create invoice of those products.

    I can't pass the product ids to new invoice because it takes salesorderid
    invoice newInvoice = new invoice();
     newInvoice.salesorderid = CrmTypes.CreateLookup("salesorderid", salesOrdertId);


    But this approach was not helpful.

    Kindly suggest me what should I do for this..I am very thankful if you send me any sample code or article for this task if you have.

    Thanks
    Shipra








    Monday, December 22, 2008 10:23 AM