Register    Login    Forum    Search    FAQ

Board index » General Usage » Other




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: custom fields
 Post Posted: Tue Feb 07, 2012 4:28 am 
Offline

Joined: Mon Jan 30, 2012 6:17 am
Posts: 3
Hello gents,

I am trying to setup PhreeBooks (3.3RC1) and I have some questions:

1. How can I define extra fields required for Company (for instance, a second gov_id number or Bank account / Bank name) ?
2. How can I use those fields in reports ? like printing on invoice.


Thanks,
S


Top 
 Profile  
 
 Post subject: Re: custom fields
 Post Posted: Tue Feb 07, 2012 9:41 pm 
Offline

Joined: Wed Nov 21, 2007 10:30 am
Posts: 571
Sorry there is not much howto documention for this system. You will have some learning to do. Here is a start: viewtopic.php?f=3&t=1711
http://www.phreesoft.com/?page_id=453

_________________
Alvin


Top 
 Profile  
 
 Post subject: Re: custom fields
 Post Posted: Wed Feb 08, 2012 3:36 pm 
Offline

Joined: Fri Oct 26, 2007 3:55 pm
Posts: 3499
Location: Colorado, US
1. Go to Company -> Module Administration -> Contacts (Properties Icon)
2. Click on Custom Tabs tab.
3. Click the New icon on the secondary toolbar.
4. Enter a tab name and description, click Save.
5. Click on Custom Fields tab.
6. Click on the New icon on the secondary toolbar.
7. Enter a field name (database friendly a-z,A-Z, and _ work well) and the rest of the information of the new field. For most things you will want them to be a text field, press Save.
8. Your new tab and fields should show up under the appropriate Contacts detail page.

To get them o n a report, you will need to edit (or create) an existing report and select the Fields tab. Your new field should show up on the pull down to select the field.

Dave


Top 
 Profile  
 
 Post subject: Re: custom fields
 Post Posted: Wed Oct 03, 2012 5:28 am 
Offline

Joined: Mon Feb 14, 2011 5:14 am
Posts: 28
dave wrote:
1. Go to Company -> Module Administration -> Contacts (Properties Icon)
2. Click on Custom Tabs tab.
3. Click the New icon on the secondary toolbar.
4. Enter a tab name and description, click Save.
5. Click on Custom Fields tab.
6. Click on the New icon on the secondary toolbar.
7. Enter a field name (database friendly a-z,A-Z, and _ work well) and the rest of the information of the new field. For most things you will want them to be a text field, press Save.
8. Your new tab and fields should show up under the appropriate Contacts detail page.

To get them o n a report, you will need to edit (or create) an existing report and select the Fields tab. Your new field should show up on the pull down to select the field.

Dave



Am I missing something? I added a custom field to my inventory but somehow I cannot seem to pull it down in my invoice report. I wanted to add a custom "unit" field then use it in my invoice.

Is it as simple as that or do I need to modify other things?

edit: I tried what Dave said and the field is present in my report. however it is when you use one table only. what if I need to use journal_main, journal_item, and inventory tables? do I need to JOIN them? I tried joining them but there is an error.


Top 
 Profile  
 
 Post subject: Re: custom fields
 Post Posted: Thu Oct 04, 2012 4:49 pm 
Offline

Joined: Fri Oct 26, 2007 3:55 pm
Posts: 3499
Location: Colorado, US
If you are trying to modify the invoice form (which requires a special class to properly render), you will need to modify the special class /modules/phreebooks/classes/entry_builder.php. But it's more complicated than that for invoices as the data for these are pulled from the journal_main and journal_item table.

A better way would be to use the special processing and add one custom for your needs. Something like (in path specified):
Code:
<?php
//
//  Path: /modules/phreeform/custom/extra_phreeform.php
//
$FormProcessing['sku_unit'] = 'SKU UOM';
// Extra form processing operations
function pf_extra_process($strData, $Process) {
  global $db;
  switch ($Process) {
    case "sku_unit":
      $result = $db->Execute("select sku_unit from ".TABLE_INVENTORY." where sku = '".$strData."'");
      return ($result->RecordCount()>0) ? $result->fields['sku_unit'] : '';
    default: // Do nothing
  }
  return $strData; // No Process recognized, return original value
}
?>
Then add a column in your invoice and use the SKU field with processing SKU UOM and if the sku is called out on the invoice, the unit of measure will be pulled and returned. The field name in the sql statement and return value (sku_unit) must match the field name you added in your inventory table.

Dave


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 5 posts ] 

Board index » General Usage » Other


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron