Thanks Joe. While reading your answer, I thought up (coded up) a possible enhancement to cater for eg. INV0034 or DPA11023 type references that still allows for 'counting up' as payments etc are made.

Basically, if the ref ends in digits (and digits only), then the function will increment by 1, while still keeping the alpha prefix.
So: DPA0023 becomes DPA0024, INV0000332 becomes INV0000333 and 45TR34P009 becomes 45TR34P010.

Here's the new references.inc class method for increment($reference) (line 72)

    function increment($reference) {
        // If $reference is trailed by digits, and digits only,
        // extract them and add 1, then put the alpha prefix back on
                // NB. preg_match returns 1 if the regex matches completely
                // also $result[0] holds entire string, 1 the first captured, 2 the 2nd etc.
        if(preg_match('/^(.*?)(\d+)$/',$reference,$result)==1) {
            $dig_count = strlen($result[2]); // How many digits? eg. 0003 = 4
            $fmt = '%0' . $dig_count . 'd'; // Make a format string - leading zeroes
            $nextval =  $result[1] . sprintf($fmt, intval($result[2]+1)); // Add one on, and put prefix back on
            return $nextval;
        }
        else
            return $reference;
    }
    //------------------------------------
}

You can get rid of comments, or do anything (or even ignore it if you think it's not worth it). I'm using it because my pre-printed stationery has a 3-letter alpha code at the front.

Cheers
Pete

The easiest way to deal with this would be to simply have one sales area only called eg. N/A, then there's nothing to select.

If you want to remove it, be prepared for alot of code changes (it's in alot of places), and that your version will be out-of-sync and non-upgradeable next release.

Another option is to remove if from reports only, if that's the bit that upsets you most: again, you'll need to be very au fait with PHP coding, and especially PDF classes.

103

(5 replies, posted in Wish List)

vikashsamota wrote:

there is one open source software http://www.e-hris.com  payroll system , can u tell me how to embbed it with Fc and how data of payroll acounts will be used FC.

Hi

Sure...here's how

1) Learn FA, especially the database tables
2) Define what sort of interface you want between your HR system and FA
3) Code the interfaces
4) (optional) Describe how you did it and share it.

Hope this helps
Pete


ps. I'm not being serious here. Seriously.:)

Hello fellas

I'm looking into the beginnings of an API to post transactions. I've seen the downloads for customer and item importation on this site in the download section - these are relatively straightforward, however sys_type updates are obviously more complex as counters, next refs, taxes etc need to kept up to date. I don't think anyone's done this yet through an API-style interface.

A few questions for the experts:

1) In the 1_sys_types table, what is the difference between 'type_no' and 'next reference'? I note that sometimes they are in sync, but in the empty US SQL import file, they aren't always.

2) Am I right in saying that sys_type and type_no are THE definitive keys for any transaction in the system. Does this mean that type_no and next_reference should stay in sync? How would they get out of sync?

3) Is 1_refs table? just a text 'reference' information field against a transaction keyed by a sys_type and id number?

Thanks boys I'll let you know how I go.....

Pete

Hi FA fellas

Can you just confirm the use of the /company/x directories?

I am assuming (hoping?) that they allow you do override core FA code for eg. reports. Is this the case? I put a report in /company/1/reports/rep107.php, but it didn't seem to override the main one. Have I missed something?

Tks
Pete

106

(10 replies, posted in Installation)

Hi bruzergear
While it's OK to remove your .htaccess file, it would be better for you to use it well: it provides lot's of features for securing your site. At the very least, you should password protect your frontaccounting directory if you're on a public web server.

Here's a little guide that might help.
http://www.javascriptkit.com/howto/htaccess.shtml

107

(23 replies, posted in Misc. Charts of Accounts)

I'm sending an Australian services company based chart of accounts through. Caters for Australian taxes and has a GL chart suitable for a service business (eg. software devt). Hope someone finds it useful, or even better, improves on it!

Update: tried admin@frontaccounting.com - got returned. Which email address should I send it too?

108

(38 replies, posted in Wish List)

I agree with Janusz - this is an accounting system, and aims to do that very well. Its beauty is in it's straightforward simplicity. Openbravo is very complex, however the POS module is very good, and standalone. The synchronisation code of Openbravo POS is complex, but an API is not unthinkable. You'll have much more trouble at the Openbravo POS Java end than the FrontAccoutning side of things.

Also, I would not support payroll functionality at all: it's just too differenct across companies and across the world.

109

(3 replies, posted in Wish List)

Quick entries help with some Fixed Assets functionality, but proper functionality for Fixed Assets is much bigger than this - it would be a whole new module.

An example to see taxes at work (in 2.0, 2.1 is not ready)

Setup your tax types, and tax groups, ensure the customer branch has a tax group and that item types also have a tax group. In Sales Types, check that Retail has 'tax included' checked.

Now in Sales, make a Direct Invoice. When you process it you can then go to your G/L accounts you nominated to take the sales tax, and see the tax entries.

What happens depends on the transaction you are doing. If you don't want to use raise a purchase order, receive the goods and invoice and pay, then the GL tax accounts you specified won't be used so there's no workflow to describe.

The step by step workflow for PO/receive/invoice/pay is just the standard business flow. Taxes are recognised at both supplier, and item level.

For what you want to do (quick payments), I think you will need to do your own Bank Payment journal entries with one line for goods ex tax and one line for the tax paid.

V2.1 is going to have a quick payment facility that may address your issues, but I think it's still being designed/worked on by the developers. There is a thread on this somewhere.

What I'd love FrontAccounting to do (in 6.1) is have a quick payment transaction that
a) split the full purchase value into it's pre-tax and tax components automatically, based on the tax status of me and the item I'm buying.
b) Make TWO G/L entries, one for the goods, one for the tax

I think something along these lines is what the guy's have in mind.

Hi Janusz

I am going to do a bit of 2.1 testing so rather than clog up these user forums with details, maybe it would be a good idea to create a mantis 2.1 branch? Up to you.

I'm not using 2.1 for production, but it looks like it will have some really good extra feature, so I've been keen to test it, but of course I understand it's unstable.

Just out of interest, what do you guys use to test/debug? I use Komodo which is fantastic for line-by-line debugging, but I may slowly make the change to Netbeans 6.5, which supports PHP and allegedly has some other Netbeans features for PHP like better class/code completion and syntax error displays. The advantage of Netbeans of course is it's completely free, and can handle most of your other languages too smile.

Happy Christmas!
Pete

Here's the quick description:

Line 18 of item_codes_db.inc should probably read:

    $sql .= "item_code = ".db_escape($item_code)

rather than

    "item_code = ".db_escape($item_code)



This was causing sql error when updating items.

ALSO....
I think items_db.inc needed the same mod I made before but at line 24 ie.
update the call to update_item_code to include $category:

update_item_code(-1, $stock_id, $stock_id, $description,$category_id, 1, 0);

The calls to update_item_code and add_item_code in sales_kits.php look OK, although I haven't tested them.

I'm not sure whether you want these on Mantis or not - but Mantis has no 2.1 section, so I'll post it here.

When you enter a sales order, regardless of what you put in the quantity, it remains zero when you add the line. The total stays $0.00 too. I think this is because on the table item_codes, the quantity for products is always zero.

I debugged it and found that when you add a new item, items_db.inc calls

add_item_code($stock_id, $stock_id, $description, 1, 0);

However, in item_codes_db.inc, this results in the $qty being passed in as zero. This ends up on the database.
When you add an item to a sales order now, it's always zeroed out because of the code in sales_order_ui.inc at lines 40 or 65:

$order->add_to_cart (count($order->line_items),    $item['stock_id'],$new_item_qty*$item['quantity'], $item_price, $discount);

It's the $new_item_qty * $item['quantity'] that's the problem. $item['quantity'] is always zero.

I'm not 100% sure what you're getting at with this code, but I suspect maybe you meant:
add_item_code($stock_id, $stock_id, $description, $category_id, 1, 0);
on line 44 of items_db.inc.

ie. you forgot to pass the $category_id parameter in.

When I make this change, it looks like everything works ok again on sales orders.

Cheers
Pete

Sorry, I was under the impression that FrontAccounting had an active development community, although it appears this is not the case. I'll put any technical postings in the modifications section from now on.

I am still unable to get tax on purchases done through the method you suggested (bank payments) - is there a way to do this (without changing the code?)

Thanks Joe for the response.
The quick-purchases also of course need their tax entries made. I'm trying to write a custom screen to handle these using the API calls. I've seen quite a few tax functions in there, but am wondering whether I am looking in the right places - under the tax directory, and under purchases/includes. What I want to do is calculate tax for an item based on the supplier's tax group and a price given (there's no item) and also  make the GL entry for the tax. Are there places/functions I should be looking to do this with existing API code?
Thanks
Pete

HI Guys
How would people recommend that small purchases eg. office supplies be managed? It seems a bit excessive to create inventory items for them, then raise purchase orders, process an invoice, then a payment the apply the payment.

One  way I was considering was just doing an ordinary journal entry, DR Office supplies, CR bank.

What are others doing?

Cheers
Pete

118

(2 replies, posted in Accounts Payable)

Thanks that explains it!

119

(2 replies, posted in Accounts Payable)

Is there a simple explanation of how purchase/sales taxes are applied in FA? By this I mean, at what business event is the GL journal entry made?
Are there particular guidelines for people in places like Australia where GST/VAT is always included in the purchase/sale price?
Thanks for the help!
Pete

120

(12 replies, posted in Accounts Payable)

What is the actual name of the report you are running? And what is the name of the screen where you see the "Add" button?

121

(12 replies, posted in Setup)

I know this posting is old, but if anyone else wants to do this ie. add a panel, here's how (NOTE: ONLY for people familiar with PHP coding):

1) Copy an app file something like what you want from an /applications/ file, and save it there. Give it a name in $this->application and update the foreach loop around line 31 to include any custom installed modules you want in this 'tab' ie. app.
2) config.php - around line 158 add your new app like the others
3) frontaccounting.php - at top of file, include_once your new app file.
4) frontaccounting.php - around line 67 - same thing - $this->addapplication etc.

Now you should see a new panel in the location you chose in config.php.

Your next step will be to actually write PHP files that do stuff in your new tab.
You'll want to create a new directory to hold your new tab functions.
Create a new directory under the root with the name of your new app. You'll want includes, inquiries, manage and view subdirectories probably, depending on what you want to do. See the other directories eg. manufacturing for hints on what you need to do next.

122

(5 replies, posted in Banking and General Ledger)

The reason you are confused about credit is probably because when you're bank tells you you have 'Credit' in your account - it actually means from THEIR ledger's perspective. When you deposit money into your account, they DR their cash account, and CR your customer account.

Assets Up = CR (for you).

Hi Greenawise
I'm new to FrontAccounting, but I'll try to help.

1) Customer's need branches that contain their address details etc. After adding a customer, Click on Customer Branches and add a branch. Don't forget to select the tax applicable to the customer's branch.
1a) When you first go into Invoice etc. you can see a line with your first product - but it's not actually a line on your sale/invoice yet until you click 'Add Item'. It's just there as a display first. It won't be there when you finish the transaction.
2) Not sure what you've done here. I don't think Sale Orders create GL entries though - they are just orders (Am I right here guys?).
3) In the "Items and Inventory" tab, just click Inventory Adjustmetns and accept your stock.
4) Yes - it should do. When they pay, you make a payment, and then next allocated this to their open orders.

Hope this helps.

Hi Guys
I wrote this little PHP script to delete transaction data (only) from my company while I setup FrontAccounting. It leaves you customers, chart of accounts intact, but does remove all transactional info. I've tried to pick the most relevant table, if you know of others that should be cleared, post them here and I'll update. If you want to do this yourself, just add them to the end of the script file.


WARNING WARNING WARNING!!!
Know what you are doing before you run this script. It will permanently delete transaction data!!!! If you don't know what this means, or what it's for DON'T run it.

Here's the PHP file - save it with an ending .php and run from command line.

// START CODE
<?php

// Clear out all frontaccounting transactions
// Leaves customers/bank accounts alone, but removes all transaction items
// BE CAREFUL YOU WILL LOSE YOUR TRANSACTION DATA IF YOU RUN THIS SCRIPT
// BACKUP BEFORE YOU RUN IT!!!
// IF YOU DON'T KNOW EXACTLY WHAT YOUR ARE DOING, DON'T RUN THIS SCRIPT


// ask for input
fwrite(STDOUT, "Enter your MySQL FrontAccounting database name: ");
// get input
$db = trim(fgets(STDIN));

fwrite(STDOUT, "Enter your Company Number eg. 1, 2 etc: ");
// get input
$company_number = trim(fgets(STDIN));

// ask for input
fwrite(STDOUT, "Enter your MySQL host (usually localhost): ");
// get input
$host = trim(fgets(STDIN));

fwrite(STDOUT, "Enter your MySQL user id: ");
// get input
$userid = trim(fgets(STDIN));

fwrite(STDOUT, "Enter your MySQL password: ");
// get input
$pword = trim(fgets(STDIN));

// Confirmation - must be Y in capitals, or I stop right here.
fwrite(STDOUT, "You are going to clear the FrontAccounting transactions for database : $db company number : $company_number\n" . "Are you absolutely sure you want to do this? (Y/N)");
$confirm = trim(fgets(STDIN));
if ($confirm!="Y") {
    echo "OK...aborting\n";
    exit();
}

$conn = mysql_connect($host,$userid,$password); //<---enter your host, user id and password for MySQL here
if ($conn==null) {
    echo "Could not connect to MySQL with the host/username/password you provided. Try again.\n";
    exit();
}
$tbllist = array();
// Here's the magic - read the end of this file into an array that contains the table names
// you want to clear.
$tbllist = split("\n",file_get_contents(__FILE__, NULL, NULL,  __COMPILER_HALT_OFFSET__));

// Remove first entry - it's just a carriage return.
unset($tbllist[0]);

// Process each table clearing it.
foreach ($tbllist as $tbl) {
    if (substr($tbl,0,1)!="#") run_delete_qry($tbl);
}
echo "Finished clearing transaction tables\n";
exit();
// A function to clear data from a table you specify
function run_delete_qry($tblname) {
    global $db;
    global $conn;
    global $company_number;
    $sql = "delete from " . $company_number . "_" . $tblname ;
    $result = mysql_db_query($db,$sql);
    if ($result!=1) {
        echo "Warning: SQL statement " . $sql . " failed\n";
        echo "with an error message of " . mysql_errno() . mysql_error(mysql_errno());
        mysql_close($conn);
       
        return;
    }
    echo "Cleared " . $company_number . "_" . $tblname . "\n";
}
__HALT_COMPILER();
# Tables you want to clear go here
# Comments start with the pound sign
gl_trans
bank_trans
debtor_trans
debtor_trans_details
debtor_trans_tax_details
purch_orders
purch_order_details
sales_orders
sales_order_details
wo_issues
wo_issue_items
wo_manufacture
wo_requirements
supp_invoice_items
supp_invoice_tax_items
supp_allocations
grn_batch
grn_items

125

(1 replies, posted in Installation)

Correction: I saw it on the invoice after I made a couple of changes to the retail customers Main Branch Account....all fixed.