Jump to content
  • 0

Add Call Charge To Monthly Generating Invoice


AllToolKits.com

Question

Assume that customer bought a packgae of  cost $40 per month. Using cron we are generating monthly invoice for this package.

But we need to add  some extra amount to this. We have to check cdr table and see cost of calls in the current month.

 

If it's $12 in the last month, the invoice should show total as   $40 + $12 = $52.

 

How i can  do that ?

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

I tried below code, but it's not working. any idea why it's so?

    Loader::loadModels($this, array("Invoices"));
    $params = $event->getParams();
    $invoice_id = $params['invoice_id'];

    
    $vars = array(
        "client_id"  => "1501",
        "lines" => array(
            array(
                "description" => "test item",
                "qty" => "1",
                "amount" => "10"
                
            )
        )
        
    );
    $this->Invoices->edit($invoice_id, $vars);

The item with cost 10 is not added to that invoice, any idea how we can add the row?

Link to comment
Share on other sites

  • 0

I think the Invalid client ID error is encountered because you're probably using the client ID number rather than the system-level client ID. The number shown in the client profile is the client ID number, e.g. "Client #1501". However, the ID that you must use is unrelated to that number. If you look in the URL when you view a client's profile, the number at the end is the ID you want to use.

 

e.g. The client ID in this example would be "2":

/admin/clients/view/2/
    $vars = array(
        "client_id"  => 2,
        "lines" => array(
            array(
                "description" => "test item",
                "qty" => "1",
                "amount" => "10"
                
            )
        )
        
    );
    $this->Invoices->edit($invoice_id, $vars);
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...