And when db_query() function is triggered, that &TB_PREF& from query string is replaced by current user tbpref variable initiated in $_SESSION[]...

I've been trying to figure out either core function is defined TB_PREF or I'll have to make a function for it. I'm making several functions and I don't from where to get TB_PREF for SQL query...

Update--
I found that TB_PREF is defined in current_user.php with value of &TB_PREF&, so how it is used?

Solution--
As mentioned above, TB_PREF is defined in current_user.php with value of &TB_PREF& which then is replaced with prefix of company related tables in db_mysqli.php using str_replace() function...

Haha, I'm talking about this Development Forum. Well, I've done some development work and I had a really hard time because I'm a newbie and FrontAccounting doesn't have documentation.

What I wanted was in Purchase Invoice, all GL Items to be credited instead of debit, and here is why.

I don't know why but I don't have permission to post in Development Forum...

But wouldn't that be an improper way to write negative balance in the invoice, if I change the code and write the positive value to change it negative for crediting it.

I'm trying to edit to code so that the purchase invoice GL Items could be credited rather than debited. I'm currently inside the invoice_db.inc file at function add_supp_invoice().

I'm into it for a week to find out how to process a proper purchase from a foreign supplier along with local expenses, and I have found a solution that looks well to me, but I want to share it with you people to know how it is.

While making a purchase, we go through the process (Purchase Order > Good Receiving Note > Purchase Invoice > Payment Allocation), and after the purchase process the General Ledger looks like this:

General Ledger Transaction
Account Name      |   Debit   |   Credit   
Supplier Payable                       5000
Insurance Exp           500
Tax Exp                      300
Freight                       200
GR Clearing Acc         4000

Total                           5000        5000

The expenses are paid by us and in Home Currency, but in the above transaction, the total is credited into Supplier's Payable account.

The Solution
What if we make a payable account of all expenses above and credit the same amount in them, and Debit the total of Supplier Payable and others in Good Received Cleaning Account.

General Ledger Transaction
Account Name      |   Debit   |   Credit   
Supplier Payable                       4000
Insurance Payable                    500
Tax Payable                               300
Freight Payable                         200
GR Clearing Acc         5000

Total                           5000        5000

This way we will also get so-called Landed Cost debited into Good Received Clearing Account and we will have our local payable expenses separated from supplier payable. BUT While testing the above method, and creating all expenses payable account, the transaction is still being debited and I believe all GL Items "no matter what account I choose" will be debited, so we need to change the functionality.

My Do
I've disabled the GL Items in Purchase Invoice and Supplier Credit Note and making another function in Purchase section where I will get invoices and load local payable expenses, and add total value into Good Received Clearing Account of that invoice, which will solve our problem.

Currently, I've having hurdles as I'm a newbie in PHP and there is no documentation for Purchase section, so any help will be appreciable.

Hello everyone,
I've seen in FrontAccounting, Debit increases the balance and Credit decreases the balance no matter what nature of account I use. Am I overthinking?

I know the Asset and Expense increases when debited and decreases when credited, on another hand Liability, Revenue and Capital decreases when debited and increases when credited.

Please clear by misunderstanding...

9

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

Hello everyone,
It's a beginner in the PHP world, and I'm trying to discover how FrontAccounting is working. I didn't find any Starting Guide for Developer which is making it a bit hard for me to make changes in FrontAccounting Core System.

I've been given the task to create an extension for Sales Projection where our Sales Officer will show his projection on sales in his area. The extension will have his own separate tables to save the projection but it can get sales from current tables to match the projection and show the difference.

I also would like to make the changes in the core system of FronAccounting Purchase tab, to prevent it from adding GL Items into Supplier Total, instead, we want it to save the transaction in its respective General Ledger in Home Currency because those GL Items (in other words, Further Expenses) are from purchasing company.

I've succeeded in preventing it adding GL Items total into Supplier Invoice Total, but AJAX event on the current invoice page is still adding the GL total in Invoice total...

I don't find any forum for this topic so posting it here.

Regards

@apmuthu, @joe
What about the suggestion I have given above?

My Suggestion:
At Purchase Invoice, where we can add GL Items. What if their would-be checkbox that can tell either expenses are paid by supplier company or by buying company, if these expenses are paid by the supplier company then the functionality would be same as in current version, but if expenses are paid by buying company then it needs some functionality as follow.

All expenses are added using GL Items section at Purchase Invoice, and once the Purchase Invoice is proceeded by user, the total payment of items will be in Supplier company account, and GL Items amount will be with relative GL Account, and if we want to check the purchase invoice for cost calculation, we could see those expenses with purchase invoice as well.

Thanks to both of you,
I've one suggestion for you.

At Purchase Invoice, where we can add GL Items. What if their would-be checkbox that can tell either expenses are paid by supplier company or by buying company, if these expenses are paid by the supplier company then the functionality would be same as in current version, but if expenses are paid by buying company then it needs some functionality as follow.

All expenses are added using GL Items section at Purchase Invoice, and once the Purchase Invoice is proceeded by user, the total payment of items will be in Supplier company account, and GL Items amount will be with relative GL Account, and if you want to check the purchase invoice we could see those expenses as well.

I'm kind of amateur to Back-end programming but here is my idea.
You will have to relate GL Account Transaction row with purchase invoice using the foreign key, so every time we try to open the same purchase invoice, the query will also fetch the GL Item transactions related to the purchase invoice.

I might start playing with FrontAccounting once I learn the back-end, database structure of FrontAccounting. If you can guide me where I can get Documentation for making changes in core functionality or creating Addons or themes, that would be really helpful.

Thanks apmuthu,
I'm sorry to say but I still don't understand your response. I would like to tell you that before posting this question here, I tried to find the solution on this forum and tried to google it and found that there is no straight method in front-accounting.

This is what I think;
At Purchase Invoice, the GL Items are entirely related to supplier company, i.e if supplier company is paying all VAT expenses, and if I add these expenses at GL Items on Purchase Invoice, it will be like "Item 1 Total + Item 2 Total + VAT + Freight = Total Purchase Invoice", it will be straight and proper way BUT if WE are paying further expenses (i.e. Freight, VAT...) then we can't add them in GL Items of Purchase Invoice.

I think of two methods;

  • We will have to do a manual calculation on Excel and add them quantity-wise on the purchase invoice, but this is the worst method because we won't know the expense type and expense amount.

  • We will create Account for all expenses (i.e. Freight Expenses, Agent Expense...) and then once we create a purchase invoice, we will have the invoice reference number and add it in the memo of journal entries of all expenses so that we can know the expense type and amount.

Do you mean to convert the expenses from local currency (i.e. PKR) into the Company's Currency (i.e. USDollar) and add them GL Items at Purchase Invoice, if that's what you mean then the expenses will be added in company ledger which we don't want because these expenses are paid by us.

We are facing this hurdle, as mentioned in the topic title.
On Purchase, where we mentioned the item, further expenses (i.e. freight charges...) can be added, but this is where the problem starts.

First,
We, most of the time pay taxes, freight charges in the local currency, but in Purchase Invoice, we can only add those expenses in that company's currency which is different from the local currency.

Second,
Adding those expenses will be added in the company general ledger account and it affects the report because those expenses are paid by us not by that company from which we are purchasing.

Let me know how to handle this thing.

15

(0 replies, posted in Report Bugs here)

I've been trying to import the number of items, from which some categories aren't added in the database but as per readme.txt, those categories which are not in the database will be added automatically, and I'm unable to import the items but only those whose category is in database.

I had to add categories in the database before importing its item...