Jump to content

Pro forma invoice for buying on account


Recommended Posts

My customers are usually big companies who need to process invoices through their finance departments before making a payment, i.e. online payment is out of the question.

My shop offers digital products, so what I need is a payment system which issues a Pro Forma invoice when the products have been "purchased" indicating the amount to be paid. Once they pay the invoice, they need to be issued with a normal invoice showing their payment.

Do any of the existing payment modules offer this sort of "buying on account" functionality? I've started hacking one together for myself, but surely there must be other people out there who have the same requirements?

Link to comment
Share on other sites

  • 6 months later...

I eventually wrote my own payment module to do what I wanted. I hope that this feature will be incorporated into Prestashop one day. I might tidy the module up soon and put it available for purchase somewhere, but it seems like there isn't a huge demand for it as this is the first reply to my post.

Link to comment
Share on other sites

  • 3 months later...
  • 1 year later...

I think, you can just print a proforma and then regular PDF invoice. Use some "dummy" payment module, say Bankwire, with changed text in FrontOffice and the name, of course.

 

You can issue the right invoice according to the order state with the M4 PDF Extensions module. The invoice would alter a part of text or the whole invoice layout pursuant to actual order state.

Link to comment
Share on other sites

I think, you can just print a proforma and then regular PDF invoice. Use some "dummy" payment module, say Bankwire, with changed text in FrontOffice and the name, of course.

 

You can issue the right invoice according to the order state with the M4 PDF Extensions module. The invoice would alter a part of text or the whole invoice layout pursuant to actual order state.

 

Thank you, i will take a look

Link to comment
Share on other sites

  • 1 year later...

I think, you can just print a proforma and then regular PDF invoice. Use some "dummy" payment module, say Bankwire, with changed text in FrontOffice and the name, of course.

 

You can issue the right invoice according to the order state with the M4 PDF Extensions module. The invoice would alter a part of text or the whole invoice layout pursuant to actual order state.

 

Hey, this sounds really good. I looked around at your website and tried the demo, but I'm not sure it can do exactly what I need to do.

I have three different cases:

 

1. Customer pays by PayPal. In this case I'd like an invoice to be sent, as standard Prestashop.

2. Customer pays by Bankwire. In this case a proforma gets sent. After I receive the payment, I input that in the order and can then send an invoice.

3. Same as 2. but I create the order from scratch in the BO. I choose bankwire and send a proforma. After payment I send the invoice.

 

Would this be possible with the M4 PDF Extension? Could you explain how to use the order status to switch between proforma and invoice?

Thanks! 

Link to comment
Share on other sites

Points 2 and 3 are the same. You just want to know the payment module and order history (not actual order state). Available data are $order[orders].module and $order[orders].order_history.

 

The template of invoice and proforma is the same as well. You just want to change some text according to state. Here is an example for switching between PROFORMA and INVOICE.

{if isset($order[orders].order_history)}
    {foreach from=$order[orders].order_history item=order_history name=cycle key=k}
        {if $order[orders].module|strpos:'bankwire' !== 0} {* bankwire module *}
            {if $order_history.id_order_state == 2} {* payment accepted *}
                {l s='INVOICE' mod='m4pdf'}
            {elseif $order_history.id_order_state == 4} {* shipped *}
                {l s='INVOICE' mod='m4pdf'}
            {elseif $order_history.id_order_state == 5} {* delivered *}
                {l s='INVOICE' mod='m4pdf'}
            {else}
                {l s='PROFORMA' mod='m4pdf'}
            {/if}
        {else}
            {l s='INVOICE' mod='m4pdf'}
        {/if}
    {/foreach}
{/if}
Edited by tuk66 (see edit history)
Link to comment
Share on other sites

Thanks for your reply!

I bought your module, seems to work quite well, but I haven't had time to try it out too much just yet.

I'm currently using the field $order_invoice->note in the standard template. It can be accessed through the little note icon next to the invoice in the BO, which is nice. Can I access that parameter in the M4 template in any way? I can't find it in the debug pdf anywhere, so I guess I have to start modding the modules code?

Heres the part from the standard invoice I'm after:

 

{if isset($order_invoice->note) && $order_invoice->note}
    <div style="line-height: 1pt"> </div>
    <table style="width: 100%">
     <tr>
     <td style="width: 15%"></td>
     <td style="width: 85%">{$order_invoice->note|nl2br}</td>
     </tr>
    </table>
{/if}

 

Thanks!

Edited by micke.teeling (see edit history)
Link to comment
Share on other sites

The "note" field is in the ps_order_invoice table. The module doesn't use this table and all data takes from the ps_order table (reasons would be a long story).

 

The same result can be achieved by using private/public order messages. I suggest to use a private message as private messages are displayed using the "Invoices" template, for example.

Link to comment
Share on other sites

Ah, I see. OK, yes, I guess it could be done with a private message. Would it be possible to "tag" a message for invoice so that not all messages end up on there? For example: "#INVOICE Here's the text or the invoice", or similar?

 

BTW - I bought and have been doing tests with the module. It's really nice and easy to work with, good work!

Link to comment
Share on other sites

There can be more private messages at once. This code will display this/these containing "#INVOICE" string only:

<!-- start private messages block -->
{if $order[orders].order_private_message}
    {section name=private_message loop=$order[orders].order_private_message}
        {if $order[orders].order_private_message[private_message].message|strpos:'#INVOICE' !== 0}
            <div class="clear">{$order[orders].order_private_message[private_message].message|escape:'htmlall':'UTF-8'}</div>
        {/if}
    {/section}
{/if}
<!-- end private messages block -->
Link to comment
Share on other sites

Thanks, got it working, very nice!

So I was just about to move the entire thing to my live shop, the installation works just fine but when I'm generating a pdf I get:

"There was an error

Enable debug mode for more information"

 

If I enable debug mode I just get "There was an error". I did look over the permissions (even 777:ed it all just to try).

Any idea what this could be?

Link to comment
Share on other sites

  • 2 months later...

 

There can be more private messages at once. This code will display this/these containing "#INVOICE" string only:

<!-- start private messages block -->
{if $order[orders].order_private_message}
    {section name=private_message loop=$order[orders].order_private_message}
        {if $order[orders].order_private_message[private_message].message|strpos:'#INVOICE' !== 0}
            <div class="clear">{$order[orders].order_private_message[private_message].message|escape:'htmlall':'UTF-8'}</div>
        {/if}
    {/section}
{/if}
<!-- end private messages block -->

 

Hi, this doesn't seem to work for me, could you help please? 

 

I have changed where it says #INVOICE to the word Please just to test this out as a customer had left the following message on an order "Please deliver between 09.00 - 17.00 Monday to Friday" thinking that this message would print out, but it doesnt, it only shows the AVS results for our payment gateway module.

 

Am I doing something wrong?

 

Tony

Link to comment
Share on other sites

Customer's message is not the private message. To filter customer's message (containing the word Please/please), use this snippet:

    {if $order[orders].message}
        {if $order[orders].message.message|stripos:'please' !== false}
           <div class="clear">{l s='Messages:' mod='m4pdf'}</div>
           <div class="clear">{$order[orders].message.message|escape:'htmlall':'UTF-8'}</div>
        {/if}
    {/if}
Link to comment
Share on other sites

 

Customer's message is not the private message. To filter customer's message (containing the word Please/please), use this snippet:

    {if $order[orders].message}
        {if $order[orders].message.message|stripos:'please' !== false}
           <div class="clear">{l s='Messages:' mod='m4pdf'}</div>
           <div class="clear">{$order[orders].message.message|escape:'htmlall':'UTF-8'}</div>
        {/if}
    {/if}

Thank you!

Link to comment
Share on other sites

  • 2 months later...

 

Points 2 and 3 are the same. You just want to know the payment module and order history (not actual order state). Available data are $order[orders].module and $order[orders].order_history.

 

The template of invoice and proforma is the same as well. You just want to change some text according to state. Here is an example for switching between PROFORMA and INVOICE.

{if isset($order[orders].order_history)}
    {foreach from=$order[orders].order_history item=order_history name=cycle key=k}
        {if $order[orders].module|strpos:'bankwire' !== 0} {* bankwire module *}
            {if $order_history.id_order_state == 2} {* payment accepted *}
                {l s='INVOICE' mod='m4pdf'}
            {elseif $order_history.id_order_state == 4} {* shipped *}
                {l s='INVOICE' mod='m4pdf'}
            {elseif $order_history.id_order_state == 5} {* delivered *}
                {l s='INVOICE' mod='m4pdf'}
            {else}
                {l s='PROFORMA' mod='m4pdf'}
            {/if}
        {else}
            {l s='INVOICE' mod='m4pdf'}
        {/if}
    {/foreach}
{/if}

I am interested in the proforma invoice generation but the proforma should be generated before the invoice number is generated. Ex - Proforma can be generated when order status is " order in preparation" and when status is changed to shipped, the invoice gets generated with a number. Is this possible?

Link to comment
Share on other sites

It depends on what exactly would be Proforma. In older PrestaShop, invoice and delivery slip was the number and date only.

 

You can create an extra proforma functionality (database and code patches needed) or you can just print the order with a header "PROFORMA".

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...