1

(2 replies, posted in Setup)

Hi Arun
Your questions are very vague. Can you do a bit more pre-work and describe what you're trying to do?

2

(2 replies, posted in Setup)

If you're experience an error in the running of the code, you'll need to try to get some more information on what's going wrong by editing ./config.php
and setting:
$debug=1;
$show_sql=1;
$go_debug=1;

If you can access your php settings, you might also try looking at the error_log to see if there's a PHP or database access problem.

If there's nothing wrong with the code, please note the checks FA runs before it will allow the deletion of a FY. Here are some of the messages in the code ./admin/fiscalyears.php:

- Cannot delete this fiscal year because thera are fiscal years before.
- Cannot delete this fiscal year because the fiscal year is not closed.
- The marked fiscal year is the current fiscal year which cannot be deleted.

There is also a comment in the code that may be relevant:
"only delete if used in neither customer or supplier, comp prefs, bank trans accounts"

Hello Miles
I have a PHP script that removes all transaction data from FA. It's only for use by those technically minded. I think I posted it on this site somewhere ages ago, but let me know if you want me to re-post it. Not sure if the administrators want me to post it as a forum response though, as it's more a developer tool (and will destroy all transaction data).

The script simply runs through ALL transaction tables (and only those tables) in FA, clears them and resets the autonumber fields.

One other thing: to see what went wrong, you could set debugging of SQL on in your config file, then check the SQL's to see why your account was not visible.

Pete

Hi Guys
I have a date formatter piece of javascript that turns a date eg 011211 into 01/12/2011.
I'm just wondering where I would add this to the code to activate it for things like OrderDate in Direct Invoice.?
Thanks
Pete

function addSlashes(input) {
    var v = input.value;
    var startYear = '';
    // If it's only 2 digits and 2 digits long, add one slash
    if (v.match(/^\d{2}$/) !== null) {
        input.value = v + '/';
        // If up to year, add slash again.
    } else if (v.match(/^\d{2}\/\d{2}$/) !== null) {
        input.value = v + '/';
    }
    // If six chars, add year
    
    if (v.match(/^\d{2}\/\d{2}\/\d{2}$/)) {
        
        // 24/12/08 
// substring from - to (to is char position so always > from)

        if (v.substring(6,8)>30) {
            startYear = '19';
        }
        else {
            startYear = '20';
        }
        input.value = input.value.substring(0,6)  + startYear + input.value.substring(6,8);
    }
}

5

(1 replies, posted in Setup)

stock_master and
stock_category

You may also want to update stock_moves if there's changes to quantities.

THe current journal entries report (rep702.php), and possible a few other reports, don't cope with multiline comments in your transactions.
As a quick fix, you can do this kind of modification which will split out the comment lines on the report so you can see them all:

Around line 99 of rep702.php, modifiy the code so it looks like the following:

            $memo = get_comments_string($myrow['type'], $myrow['type_no']);
            // Pete: multline journal display.
            $replines = array();
            if ($memo != '')
            {
                if ($coms == "")
                    $coms = $memo;
                else
                    $coms .= " / ".$memo;
                // turn memo text into multiline array for printing
                $replines = explode("\n",$coms);
            }
            // Print each line of comment separately, rather than a single line
            foreach ($replines as $repline) {
                $rep->TextCol(3,6,$repline);
                $rep->NewLine();
            }

This is a very quick fix, I can't vouch for the quality of it as PDF report modification can be hard, but it should get you going if you desperately need it.

Pete

Adding quick entries for payments (expensed) in Australia with GST:

Use this kind of quick entry for bank payments (for items) that you expense like Office Supplies etc, when the retail price on your docket/invoice includes GST.

In Quick Entries Edit screen
1) Add quick entry eg. 'Stationery', type 'Bank Payment'
2) Click 'Add New'
3) Edit the new 'Stationery' Quick Entry
4) Under 'Quick Entry Lines' change 'Posted' combo box to Taxes Included - Reduce Base and 'Tax Type' GST. Click Add New
5) Add the next Quick Entry Line: Posted set to Remainder (the default)
6) Under Account, select the G/L account you want the item expensed to eg. 'Office Supplies' and click 'Add New' to add this second line.

Now when you use the quick entry, the amount will be allocated to GST (10%) and the remainder, with the correct account postings eg. $50.00 goes to $4.55 GST and $55.45 to Office Supplies.
I think the same set up is relevant for VAT in the UK, and maybe other European VATS too.

Pete

I too added space to the comments field by altering the tables to make them 'mediumtext' instead of 'tinytext'. The tables I updated were:

0_comments
0_purch_orders
0_sales_orders
0_budget_trans
0_gl_trans
0_supp_invoice_items
0_trans_tax_details
0_voided

I also enlarged a few other comment type fields too:
description in 0_debtor_trans_details
description in 0_grn_items

Basically, you can do a search of company SQL that comes with the package and look for tinytext, comments, memo and description.

To enlarge the comments section of things like invoice entry, you might need more room on the screen too:
To do this, update eg. ./sales/includes/ui/sales_order_ui.inc
and change the line that refers to the comments which has

textarea_row(_("Comments:"), "Comments", $order->Comments, 31,5);

to:

textarea_row(_("Comments:"), "Comments", $order->Comments, 61, 20);

You might want to do this for other entry screens eg. for po_ui.inc etc. A global search on the text  '->Comments' should get you started on which files you could modify.

As tclim said, you can also modify your report files eg. Invoice rep107.php. You need to be pretty careful doing this that you don't muck up alignments etc.

Lastly, don't forget you can get more text on your reports if you change the report fonts. I use a font called 'tuffy' (http://www.fontspace.com/thatcher-ulrich/tuffy) which fits alot on the page (it's narrow) and is quite modern looking. It's a technical job to add this font or any other  to FA, but I have documented it in the FA wiki for those with enough technical know-how to use command line utilities and code PHP. You use an external utility ttf2pt1 which converts ttf files into font file the TCPDF framework can use. TCPDF is the framework FA uses for handling PDF files.

Pete

Are you sure that the transaction you are applying would not take the bank account into negative balance at the date of the transaction?

The message you saw is based on a check for 0/negative balances on the transaction date - there's no limits set anywhere. If the transaction would take the account into negative balance, the error appears. As a suggestion: If you have multiple transactions on a given day to keep the account in credit, apply the credits first (as a suggestion). That way, the account won't try to go momentarily negative.

The code to look at the logic is in ./gl/bank_transfer.php

FA currently uses a default hard-coded '30' days in the past setting for all inquiry screens.I have created some instructions for changing this to a user setting (transaction_days) so you can set this up for each user. This is useful if your company transactions are low-volume and you want to see more than 30 days in the past in your inquiry screens.

Note to Joe/Itronics: I put this as a suggested update on the Wiki for you to consider in the next version. Let me know if I've got the design of this wrong, but it's a fairly simple change to make.

New User Configurable Transaction days setting by Pete p2409.
-------------------------------------------------------------

Currently, FA uses a hard-coded default 30 days in the past setting for transaction display screens
eg. ifyou do a GL inquiry, the default is to display dates from today to 30 days ago.
With a new user-configurable 'transaction_days' setting, you can now set this to a default number 
you choose eg. 365 to always display the last year's instead of month's transactions.
With this change, the default 'From' date on inquiry screens will be the setting you made
eg. -365 days from now.

To achieve this, we add a new global setting 'transaction_days' and look up this setting in
all inquiry screens that previously had a hardcoded 30 days.

(Note the setting is a positive number, made negative to go back in the past in the inquiry screens
with a minus sign).

CHANGES TO CODE/TABLE
---------------------

1) Create new 'Transaction days' setting in preferences screen:

In ./admin/display_prefs.php

Around line 37

FROM:
        set_user_prefs(get_post( 
            array('prices_dec', 'qty_dec', 'rates_dec', 'percent_dec',
            'date_format', 'date_sep', 'tho_sep', 'dec_sep', 'print_profile', 
            'theme', 'page_size', 'language', 'startup_tab',
            'show_gl' => 0, 'show_codes'=> 0, 'show_hints' => 0,
            'rep_popup' => 0, 'graphic_links' => 0, 'sticky_doc_date' => 0,
            'query_size' => 10.0)));

TO:
// Add transaction days configurable.            
        set_user_prefs(get_post( 
            array('prices_dec', 'qty_dec', 'rates_dec', 'percent_dec',
            'date_format', 'date_sep', 'tho_sep', 'dec_sep', 'print_profile', 
            'theme', 'page_size', 'language', 'startup_tab',
            'show_gl' => 0, 'show_codes'=> 0, 'show_hints' => 0,
            'rep_popup' => 0, 'graphic_links' => 0, 'sticky_doc_date' => 0,
            'query_size' => 10.0, 'transaction_days' => 30)));
            
Around line 142 after:

check_row(_("Remember last document date:"), 'sticky_doc_date', sticky_doc_date(),
    false, _('If set document date is remembered on subsequent documents, otherwise default is current date'));

ADD:

text_row_ex(_("Transaction days:"), 'transaction_days', 5, 5, '', user_transaction_days());


2) Update user preferences to add new transaction_days global variable.

In ./includes/prefs/userprefs.inc

Around line 38:
ADD:
    var $transaction_days;

Around line 54 after:
            $this->theme = 'default';
ADD:
            $this->transaction_days = -30;
Around line 91 (in the else block)
AFTER:
            else
            {
                $this->sticky_date = 0;
                $this->startup_tab = "orders";
            }

ADD:
            $this->transaction_days = $user['transaction_days'];

Around line 127:
ADD:
    function transaction_days() {
        return $this->transaction_days;
    }

3) Update current user settings with new user_transaction_days function:

Around line 312
ADD:
function user_transaction_days()
{
    return $_SESSION["wa_current_user"]->prefs->transaction_days();
}


4) Modify all inquiry screens to use new 'Transaction Days' setting:

In all inquiry screens (do a global search on '30' to find them all):
./gl/inquiry/bank_inquiry.php
./gl/inquiry/gl_account_inquiry.php
./gl/inquiry/gl_trial_balance.php
./gl/inquiry/profit_loss.php
./gl/inquiry/tax_inquiry.php
./gl/view/accrual_trans.php
./inventory/inquiry/stock_movements.php
./purchasing/includes/ui/invoice_ui.inc
./purchasing/inquiry/po_search.php
./purchasing/inquiry/po_search_completed.php
./purchasing/inquiry/supplier_allocation_inquiry.php
./purchasing/inquiry/supplier_inquiry.php
./sales/inquiry/customer_allocation_inquiry.php
./sales/inquiry/customer_inquiry.php
./sales/inquiry/sales_deliveries_view.php
./sales/inquiry/sales_orders_view.php

Example for bank inquiry: ./gl/inquiry/bank_inquiry.php

Around line 50:

CHANGE:
date_cells(_("From:"), 'TransAfterDate', '', null, -30);

TO:
date_cells(_("From:"), 'TransAfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());

Do this for each inquiry screen file


5) SQL update x_users table with new 'transaction_days' column:

ALTER TABLE `0_users` ADD `transaction_days` INT( 6 ) NOT NULL COMMENT 'Transaction days'

(Note: use your company number eg. 0_, 1_ etc to update for each company).

11

(3 replies, posted in Setup)

Same answer: just create a branch for this customer.
To make data entry easier, you might try calling it something like 'AAA' so it appears as the first item in the list, leaving you with one less thing to click!

Oh OK
Are there plans to put dimension id's on the debtor_trans table or does this not make sense for using dimensions properly?

This requires a few things to be done:
- In the invoice report (107), check the stock master table for each line item, getting the tax code
- lookup the tax code to translate back to words eg. 4 = GST
- change the item report line loop to also include the tax code.
It all needs coding, but that's the basic logic I think.

14

(1 replies, posted in FA Modifications)

The easiest way (without coding) and assuming your htaccess puts .html ahead of .php is to simply make an index.html file and copy it into your root directory.
You could also swap in a spare index.php that just echo's that the system is currently not available.
Other than this, you could make a simple mod to index.php that checks a global variable eg. in config.php and displays 'system unavailable'.

Not sure whether you did this too, but to make it worthwhile, all the 'comment' and 'memo' fields in the various tables need to be expanded to eg. mediumtext at least (from tinytext - <255 characters).

It was also written for an older version of FA, so the module doesn't work on the latest framework. Most of the work to upgrade it would be making it consistent with FA, not zen cart (which hasn't changed that much).

I updated it to oscommerce, but didn't get further than basic testing.

Hi Guys
When I make an invoice and choose a dimension, I can't find the dimension field updates on the 0_debtor_trans table. Is this where it should go?
Or elsewhere?
Right now, it's leaving the dimension set at 0 regardless of what I enter.
Thanks
Pete

Yep that's what I did tclim, but see above, I'm getting the password error:
Fatal error: Uncaught exception 'Exception' with message 'Invalid User ID or Password!!!
for demo@anterp.com
password1
I think

tclim wrote:

Hi p2409,

  Can you try this, open a new firefox browser, enter the soap url as

  http://localhost/FA234/api/soap.php?wsdl

   Did you see any soap webservice is up and running?

The problem is 'missing ..//lib/Ldap.php' file...

A hint maybe, I commented out the include of Ldap.php (I think my php has LDAP compiled in), then I get a screen that looks like HTML (but not rendered as such), in the errors then I see demo@anterp.com/password password failure.

Quick question tclim:
When attempting to run soap-test.php, I'm getting:
XML error parsing WSDL from http://localhost/FA234/api/soap.php?wsdl on line 2: Invalid document end
and a list of debug/error information.

Any ideas what might be wrong?
Thanks
pete

tclim wrote:

Hi Excellence/Itronics,

   Thanks you for your testing on the WebService API and great to hear that you have tested and verify it work fine.  This webservice API can be extended and share among others members in FA. Nice !!!

Cheers,

  tclim

Tclim thanks for kicking off the soap API. We can now get started on building more interfaces. An effective soap interface requires rigorous naming standards ie use of words get/set and spelling of entities. Are you working to a standard or is this something you havent thought about yet?

Your question is vast, so youre unlikely to be handheld through this, but as a starting point, check out the code in th 'import multi journal entry' module for examples of how to update the ledger with code. This code does not run anymore in the current version, but the logic and all the calls (except for add bank account transaction) are the same. (I have sent an updated import any transaction module to the site owners which willll hopefully appear to download soon)

23

(2 replies, posted in FA Modifications)

AndrewE wrote:

Can anyone recommend a development environment or debugger to use for debugging the PHP code?

Hi Andrew.
I use Netbeans (Mac version) with xdebug which works really well, and is free.

Hi Guys

Mucking about modules at the moment, and have just written a versatile function to calculate start/end dates of quarters. With some adjustment to fit naming standards etc. it might be useful to include in date_functions.inc at some point. Hope someone finds it useful!
Pete

/**
 * Get last quarter start and end dates for today. Eg. 13/12/2010 = 1/10/2009, 31/12/2009
 * @param array $qtr_dates Referenced array of quarter dates (0=start, 1=end)
 * @param int $num_qtrs How many quarters back/forward (default 0 = this quarter)
 */
function get_quarter_dates(&$qtr_dates, $num_qtrs = 0) {
    // work out the last quarter dates, and store in the qtr_dates array
    include_once($path_to_root . "/includes/date_functions.inc");
    // 1. Get current month (number)
    $this_month = date('m');
    //$this_month = 1; TEST
    // 2. Calculate the start month for this quarter.
    $this_qtr = intval(($this_month - 1)/3) * 3 + 1;
    // 3. Subtract 3 months from this quarter start date to get last quarter
    $qtr_dates[0] = add_months(__date(date('Y'),$this_qtr,01),$num_qtrs*3);
    // 4. Add two months and get last day of that month for end of last quarter.
    $qtr_dates[1] = end_month((add_months($qtr_dates[0],2)));
}

25

(5 replies, posted in Modules/Add-on's)

Janusz do you mean when running 'Access Setup'?
I did that, but it doesn't appear to change the variable (to false or true when selected).