The SimpleInvoices forum has moved to Google Plus - this forum is now read-only
How to display Invoice customField on manage page
  • guowei0guowei0 December 2011

    Hi,I just found Simple Invoices,it's just great.
    But the only thing is I can't change the Invoice Number.As My previous invoice num is C2011XXX.
    I searched around and found I can use the customField to put in my Invoice Num.
    I also change the invoice template so It display the custome Invoice Field.
    Now the problem is,I can't see the custome Field in the manage page.
    I change the manage.js file,and put in a line:
    {display: '{/literal}{$invoice_cf1}{literal}', name : 'cf1_invoice_num', width : 10 * percentage_width, sortable : true, align: 'left'}

    But it doesn't pick up the customeField data.
    How to fix this?
    Many thanks!

  • modirmodir December 2011

    Did you define in Settings > Custom Fields what the label should be?

  • guowei0guowei0 December 2011

    I mean,in the invoice list, i can't see the CustomFiels,because it's custome invoice number,i want the custome invoice number to be display on the manage list as well.

  • modirmodir December 2011

    You need to change the code where the XML file is generated as well. I can't tell you where it is out of my head. But I had to change once something similar.

    Maybe my post from back then can help you:

    Else I have to look into it later.

  • guowei0guowei0 December 2011

    Thanks!I will have a look now.

  • guowei0guowei0 December 2011

    I can't make it work...please help...

  • guowei0guowei0 December 2011

    $xml .= ""; $xml .= "";
    $xml .= "";
    $xml .= "";
    $xml .= "";
    $xml .= "";
    $xml .= "";
    $xml .= "";
    $xml .= "";
    $xml .= "";

    I add $xml .= "";

    but it doesn't work.

  • guowei0guowei0 December 2011


  • guowei0guowei0 December 2011

    can't post the code here.

  • mattmatt December 2011

    To use custom fields you should NOT need to code.

    From the Main SI screen
    Settings >> custom fields >> Invoice Custom field #1 (through #4)

    The custom field will then be available in your invoice creation

    Mu understanding is though that these won't self increment - you will need to manually enter them each time.

    You can set a starting invoice number by changing the si_index ID to your current maximum invoice number, then the next one will be that +1
    Downside is that this is numeric only, no alpha characters.

    I believe that to add alpha characters you would need to change code.

    Outback Australia
  • guowei0guowei0 December 2011

    I understand that.
    I used a customer format invoice number.
    for production I use CXXXXX.for repair i use REPXXXXX.
    that's why i need custom invoice number.
    I use the custom field.and it shows on the invoice very well.
    But the thing is on the manage invoice page,i want to insert the custom invoice number filed,so i know which invoice it is.

    I change the xml file in the module/invoice path,but can't make it work.

  • modirmodir December 2011

    @Matt: He wants to have the invoice number on the page /index.php?module=invoices&view=manage

    So he will need to change the XML file that is sent to the browser and he needs to change the JavaScript code which is generating the table.

    Out of my head I could not help. But I can look at it tomorrow.

  • plumbcoolplumbcool December 2011

    To change the manage screen
    first edit modules/invoices/manage.js
    The code below will add the Header , I am using the field note as an example
    {display: '{/literal}{$LANG.note}{literal}', name : 'note', width :20 * percentage_width, sortable : true, align: 'left'},
    Then edit modules/invoices/xml.php
    the note data
    $xml .= (cell)(![CDATA[".$row['note']."]])(/cell)";
    I had to change the less than and greater than signs for display purposes here, leave then alone in the actual code
    You would change yours to 'custom_field whatever'

  • guowei0guowei0 December 2011

    Yes,You are right.I did 'note' it's working ,but when i use custom_field1,it doesn't pick up the real data.only shows a blank field.

  • sirdudsirdud August 2012

    @guwei0: Did you find out how it would work? Any hints?

  • santoshsantosh October 2012

    Can you please post code if you got it working ?

  • PapiMigasPapiMigas February 2013

    Hi everyone!

    I'm starting with SI and so far so good!
    I'm starting to customize SI to adapt it to my organization needs.
    I'm new with php and I stuck when tryed to put invoice_cf1 (customized field id 13) on "invoices" list in "money" tab. So far I've done:

    - On "manage.js.php" I added 1 column and on colModel added:
    "{display: '{/literal}{$LANG.custom_fieldf1}{literal}', name : 'custom_field1', width : 12 * percentage_width, sortable :$"

    - On "xml.php" at the bottom, I added:
    "$xml .= "(cell)(![CDATA[".$row['custom_field1']."]])(/cell)";

    Well, the column is there but no data... anyone can help me?

    Thanks in advance!

    PS: Where is "(" or ")" should be "less than" and "greater than" signs


  • PapiMigasPapiMigas February 2013

    OK, I figured how, got the solution :)
    My code was ok, just missing 2 lines on /include/class/invoice.php:
    on line 229 I added 'custom_field1' to the array;
    on the SELECT of line 304 and 341 I added "iv.custom_field1 AS custom_field1"

    OK, it's working! But the name of the table is "Custom Field 1"... to change that went back to "manage.js.php" and changed '{/literal}{$LANG.custom_field1}{literal}' to the name that I wanted to show. It's not well done but at least it works!

    Hope this can help someone!