The file purchasing/includes/ui/po_ui.inc has a function display_po_header() that does the job. Reference is generally editable on new data entry only and not available to be editable afterwards (line 117).  Lines 177 to 182:

    if ($editable)
    {
        ref_row(_("Reference:"), 'ref');
    }
    else
    {
        hidden('ref', $order->reference);
        label_row(_("Reference:"), $order->reference);
    }

provide the form elements.

@joe: I stand corrected that the Tmpl inclusion is needed for other reasons. The $rep->SetHeaderType('Header2') "includes" the header2.inc and doctext.inc files. These included files refer to data obtained in SetCommonData() which is useful for including non field db data as illustrated in the wiki for Bin Location type of functionality.

In this instance in rep107.php (Invoicing), $contacts is populated with data from the get_branch_contacts() function and is passed on as an argument into the $rep->SetCommonData() method which in turn populates the $this->formData and $this->contactData properties which in turn is used to get the contacts to email the reports to. In fact the SetCommonData() method makes even a single email id into an array, ie., $this->contactData.

Will investigate further....

4,453

(3 replies, posted in Banking and General Ledger)

Thanks @bobloblian. The wiki has now been updated with your valuable in context suggestion.

@bobloblian: Let's see what line 978 onwards in reporting/includes/pdf_report.inc has:

                $contactData = array();
                if ($this->contactData)
                    foreach($this->contactData as $contact)
                        if (!empty($contact['email']))
                            $contactData[] = $contact;

                if(!count($contactData)) {
                    $this->SetLang(user_language());
                    display_warning(sprintf(_("You have no email contact defined for this type of document for '%s'."), $this->formData['recipient_name']));
                } else {
                    $sent = $try = 0;

Only if there was no email available would you get the error stated

You have no email contact defined for this type of document for 'Computerisms'.

Therefore in the incoming $this->contactData itself, there would be no such record with email contact details and that narrows it down to the output of the get_branch_contacts() function. A check on with and without the last parameter being false will reveal that when it is true, the defaults have kicked in and not the appropriate contact for the specified action type. Try adding more than one contact to the branch where you choose it to be of invoice type (rep107.php) and then see what happens on making the last parameter false.

Please note that you will need tobackportsome report fixes from FA 2.4 since the SetCommonData() method needs to precede the Header2() call in reports that call it. This is necessary because the property $this->contactData is assigned from the $contact in line 409 and the latter comes from the said method SetCommonData() which in turn gets it from the get_branch_contacts() function call in rep107.php a couple of lines earlier.

@joe: the backports of the repXXX.php files done on 2015-01-21 is hence necessary.

4,455

(18 replies, posted in Wish List)

Add your "Check" payment terms in Setup => Payment Terms menu.

Your extra fields:
1. Check Owner Name (anyone other than the customer can be entered in the memo / comments field)
2. Pay to the Order of (anyone other than the Company whose Accounts is being maintained in FA can be similarly entered in the memo / comments field)
3. Check Number can be entered using the comments field and better still using the Non Field DB Data concept discussed in the Wiki.

Whilst getting all contacts and using it for emailing (To, Cc, Bcc, etc) is fine, getting only one contact is important for report printing and for use in the FA user interface screens.

Currently, the function get_branch_contacts is used in:

sales/includes/ui/sales_order_ui.inc
repXXX.php
where XXX in 103 (commented out), 107 (Invoice), 108 (commented out), 109  through to 113.

In the extensions, rep_email_customers calls it in modules/reporting/rep_email_customers/includes/customer_emailer.inc with the last parameter as false (no defaults). Also, when the second parameter ($action) is set to null as in this file, all contacts accrue.

In sales/includes/ui/sales_order_ui.inc the following construct in lines 112-114:

    $contact = get_branch_contacts($branch_id, 'order', $customer_id);
    $order->set_branch($branch_id, $myrow["tax_group_id"],
    $myrow["tax_group_name"], @$contact["phone"], @$contact["email"]);

expect to have defaults (missing last parameter assumed $default as true) and restricted to the 'orders' type alone and is used as a single contact for populating the branch details alone.

The standard repXXX.php listed above use the following constructs:

rep107.php:
$contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], true);

rep109.php:
$contacts = get_branch_contacts($branch['branch_code'], 'order', $branch['debtor_no'], true);

rep110.php:
$contacts = get_branch_contacts($branch['branch_code'], 'delivery', $branch['debtor_no'], true);

rep111.php:
$contacts = get_branch_contacts($branch['branch_code'], 'order', $branch['debtor_no'], true);

rep112.php:
$contacts = get_branch_contacts($myrow['branch_code'], 'invoice', $myrow['debtor_no']);

rep113.php:
$contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], true);

which makes last parameter $default to be true but allows for (but currently does not obtain) multiple contacts in subsequent emailing usage alone.

Either we determine it to be a single contact (count elements in array), or choose only the first one for the sales/includes/ui/sales_order_ui.inc and all other places we need single contacts or make a new function called get_branch_contact (singular) with the current code in it and make new content for the existing function get_branch_contacts (plural) for usage where multiple contacts are needed.

As far as emailing is concerned, we can make the first contact as the "To" recipient and all others as the "Cc" recipients if they exist!

Way forward is to be decided - all your thoughts on this is welcome before a patch is forwarded to @joe.

Hence currently, no code change is required except for setting the last parameter as false in reports that need to be emailed to multiple entities!

In includes/current_user.inc, the following function is defined:

//
//    Search $needle in $haystack or in $haystack[][$valuekey]
//    returns $needle found or null.
//
function array_search_value($needle, $haystack, $valuekey=null)
{
    foreach($haystack as $key => $value) {
        $val = isset($valuekey) ? @$value[$valuekey] : $value;
        if ($needle == $val){
            return $value;
        }
    }
    return null;
}

This function is used by function get_branch_contacts in sales/includes/db/branches_db.inc (this file has another similarly named function prefixed with an underscore that is neither used in the FA core nor in any extension).

At the very end of the function get_branch_contacts we find that only one element is returned because of a return within the loop:

    foreach($defs as $type) {

        if ($n = array_search_value($type, $results, 'ext_type'))

            return $n;
    
    }

If this value is captured in a separate array if it is not empty, then that array would have all the necessary contacts.

This is clearly a bug.

@joe: please update accordingly in FA 2.3 and into FA 2.4.

PS: The error in includes/ui/simple_crud_class.inc is tolerated because of the "@" prefixing the assignment. A check for the variable's existence before assignment would remedy it and it is needed in more than one place in the same function!

4,458

(11 replies, posted in Reporting)

Can print the on screen view of the Invoice as it is text in proper format.

Win7 still comes with a driver for EpsonLQ-compatible dot-matrix machines, and the latter can achieve 360 dpi when all the pins are working. Changing the printer settings to higher CPI helps the print quality be better. This link may be useful.

The Annual Breakdown Reports for detailed Balance and Expenses in the official package repo need fixes to work as desired.

Ross Addisson has found the bug:

My one company is skipping excel printing and printing pdf instead for the Annual Expense/Balance Breakdown Detailed extensions. Annual Expense Breakdown (Non-detailed) is printing Excel however
...
...

The fixes are in my GitHub Repo.

The fix for inclusion of the dimension2 parameter in the request form is in this commit.

The fix for the parameter order issue is in this commit.

The Wiki has been updated with screenshots of these reports.

Since the devs are busy with FA v2.4, do not expect these to enter into the repo any time soon.

4,460

(1 replies, posted in Setup)

If the local machine is connected to the win8 xampp server, map the latter's ip address in the former's c:\windows\system32\drivers\etc\hosts file againsta the Fully Qualified Domain name you would generally access FA from the internet side.

Please describe your network more completely as to which machines have the FA application running and which machines need to access it from which networks.

4,461

(11 replies, posted in Reporting)

Is your FA running in Win7/8 or only the client browser in it?
If your FA is running in Linux, then CUPS printing is possible. If in Windows, check out Internet Printing Protocol or use one of the windows tools above where moving pdfs to a monitored folder will enable instant printing.

In FireFox, Tools => Options => Applications => Choose the PDF application and set what you want.

4,462

(11 replies, posted in Reporting)

AcroTeX PDF Monitor
watchDirectory
Auto Print PDF
Automating Print from Folder
BatchOutputPDF to Printer - Hot Folders
Aloaha Auto Print Folder
SilentPrint

4,463

(11 replies, posted in Reporting)

Configure the printer in FA using Port 515 or 9100 (open on your router) and use CUPS / IPP from your Linux server. Then set it in the Printer profile in FA.

4,464

(21 replies, posted in Reporting)

Edit php.ini in your webserver - increase the value of the variable max_execution_time from 30 (secs) to say 120 or 180 or more depending on the time it takes to prepare your report. You will need to restart your webserver process generally.

4,465

(44 replies, posted in Reporting)

Your SQL will not work as it will only pull out the immediately prior transaction alone and we cannot rely on an auto-increment field when multiple users will use it and many records per transaction will occur even if it is restricted to quick-entries since other transactions too may use the accounts in question.

Try the following in the en_US-demo.sql Training Company and compare it with the actual data in the 1_gl_trans table (2150 is Sales Tax):

SELECT amount, counter, account FROM `1_gl_trans` 
    WHERE counter IN (SELECT counter-1 FROM `1_gl_trans` WHERE account=2150);

There are some errors in the standard UK CoA (as also the Canadian one) in the schema and unless you created your own CoA probably based on the en_US-new.sql CoA or any other proper one, chances are that some FA operation will fail and no one would be the wiser.

The corrected standard UK CoA is in my GitHub repo.

The project devs are busy with getting FA v2.4 out the door, the pkg repo remains to be updated.

Please let us know how we can make the wiki better by submitting a screenshot with info overlaid to be meaningful in context.

The Sales Order Entry page and the Sales Order Inquiry page have the necessary info besides a forum post that discussed it now marked as SOLVED.

I am not clear as to how you populated your contact data.

All email addresses must reside in the #_crm_persons table. All many-to-many linkages are in the #_crm_contacts table where the entity_id will indicate the source table's id (customer => debtor_master table, branch => cust_branch table, supplier, etc). The person_id refers to the id of the crm_persons table. The ERD is self-explanatory.

Now please check your relevant records in the crm_contacts, crm_persons, cust_branch and debtors_master tables and list the sequence you undertook to populate them.

Try to trace the source sql for the $contactData in the pdf_report.inc file.

Manually execute the SELECT sql obtained above and see what gives.

The #_exchange_rates table uses only the rate_buy field as the exchange rate in FA v2.3. The rate_sell field is populated with the same value using line 74 in gl/includes/db/gl_db_rates.inc:

        add_exchange_rate($curr_code, $date_, $ex_rate, $ex_rate);

You might want to directly populate the said table from your records - either a CSV import or using INSERT sql statements generated in a spreadsheet.

The structure of the said table is listed here for reference:

CREATE TABLE `0_exchange_rates` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `curr_code` char(3) NOT NULL DEFAULT '',
  `rate_buy` double NOT NULL DEFAULT '0',
  `rate_sell` double NOT NULL DEFAULT '0',
  `date_` date NOT NULL DEFAULT '0000-00-00',
  PRIMARY KEY (`id`),
  UNIQUE KEY `curr_code` (`curr_code`,`date_`)
) ENGINE=MyISAM;

4,469

(5 replies, posted in Items and Inventory)

Create a separate category for true services and pseudo services (non inventory items).

4,470

(3 replies, posted in Banking and General Ledger)

The actual wiki page on fiscal years does not have any info on the consequences of re-opening a closed fiscal year possibly by directly changing it in the table.

@joe: Any thoughts on it?

4,471

(5 replies, posted in Reporting)

What I meant was the extra tabs in some lines added highlighted in the attachment.

4,472

(5 replies, posted in Reporting)

Thanks Joe. Check the indents.

4,473

(48 replies, posted in Setup)

The immediate priority is to get everything in 2.4 working for all functionality that exists in 2.3 and hence the retention of the 2.3 repo. Many fixes to the standard CoAs too are yet to get into the core and rely on "initial auto upgrades" for now. Subsequent fixes to 2.3 have yet to be merged into 2.4 as well. All updated extension files are available in my GitHub repo including ones not in the official pkg repo.

As a short term measure, it may be okay to clone the 2.3 repo (or symlink it) and make the changes in the core to point to it.

In fact as on date, no updates have occurred to the 2.3 repo itself since 28th Dec, 2014, though many contributions have been received into the official mailbox as stated in the forums since then.

You can use the various APIs that already exist for FA.

Refer the wiki.

There is also a desktop offering of FA by one of the board members using PHP-Desktop.

4,475

(4 replies, posted in Accounts Receivable)

A flag variable that enables / disables discount display would be a nice way to go.