Customer Credit Note Doesn't Show Transaction References List as dropdown list, when having more than one transaction reference for customer credit note.

@apmuthu: Sorry for not pushing, to repo. I will update it today with all details.

@joe: Thanks for your reply, you are correct new version is quite heavy and our current version is absolutely working fine and we can include existing TCPDF Class in this module.

FA TCPDF library used  4.0.027 (2008-09-19)
For example: QR Code (2D barcode) support was added from version 4.9.000

Since version 4.0.027 till 6.3.2 CHANGE LOG

I know we can create report placing repXXX.php in company/0/reporting but was stuck in some places eg: loading images, loading new ttf fonts etc. So came up with this.

Purpose of this module, is to overwrite existing FA reports with own template report - We can use existing older / newer or any other PDF library.

We have just pasted TCPDF library into module folder, and include to use it's class for creating pdf files. If we want to use some other library we can do that as well. 

Why this approach?
Changing core system file is not good idea, it may cause problem in updating software and troubleshoot problem.

Only those who need huge customization can you it

So here is what we are doing - First registering our module to enable hook.

define ('IMPULSE_TCPDF', 251<<8);

class hooks_TCPDF extends hooks {

    function __construct() {
        $this->module_name = 'TCPDF';
    function install_access() {
        $security_sections[IMPULSE_TCPDF] =  _('TCPDF');
        $security_areas['PULSE_PDF'] = array(IMPULSE_TCPDF|1, _('Allow PDF Printing'));
        return array($security_areas, $security_sections);
    function activate_extension($company, $check_only=true) {
        global $db_connections;
        $updates = array( 'update.sql' => array('TCPDF'));
        return $this->update_databases($company, $updates, $check_only);
    function deactivate_extension($company, $check_only=true) {
        global $db_connections;

        $updates = array('remove.sql' => array('TCPDF'));

        return $this->update_databases($company, $updates, $check_only);

Now when we activate this module and provide access, while printing reports reporting/reports_main.php will scan through each active module searching for module_folder/reporting/reports_custom.php to add report and register controls.

Suppose we want to print rep107 with our template invoice we created with TCPDF or other library. In module_folder/reporting/reports_custom.php

global $reports;

// Override Reports Here
// You Can Find This In reporting/reports_main.php

$reports->addReport(RC_CUSTOMER, 107, _('Print &Invoices'),
    array(    _('From') => 'INVOICE',
            _('To') => 'INVOICE',
            _('Currency Filter') => 'CURRENCY',
            _('email Customers') => 'YES_NO',
            _('Payment Link') => 'PAYMENT_LINK',
            _('Comments') => 'TEXTBOX',
            _('Customer') => 'CUSTOMERS_NO_FILTER',
            _('Orientation') => 'ORIENTATION',
            _('Copy') => 'INV_COPY'

// Example To Register Controls

function invoice_copy($name, $type) {
    if($type == 'INV_COPY')
        return "<select name = '".$name."'><option value='0'>"._('Original Copy For Recipient')."</option><option value='1'>"._('Duplicate Copy For Transporter ')."</option><option value='2'>"._('Triplicate Copy For Supplier')."</option></select>";


We have changed $reports object for our module. With new field Copy in Customer -- Print Invoices, same way we can add field or remove field.

Note: Only Those Report Added here Will Be Replace, Other Reports Does Not Have Any Effect.

Now we need last file rep107.php in module_folder/reporting this is invoice template file

        // $page_security can be found in respective file in reporting folder
        $page_security = 'SA_SALESTRANSVIEW';


        include_once($path_to_root . "/includes/");
        include_once($path_to_root . "/includes/");
        include_once($path_to_root . "/includes/");
        include_once($path_to_root . "/sales/includes/");
        include_once($path_to_root . "/gl/includes/db/");
        include_once($path_to_root . "/inventory/includes/db/");
       // here you can write your own fuctions
       // this can be any PDF Libarary
        require_once($path_to_root . "/modules/TCPDF/tcpdf.php");

// ---------------------------------------------------------
        $from = $_POST['PARAM_0'];
        $to = $_POST['PARAM_1'];
        $invoice_currency = $_POST['PARAM_2'];
        $email = $_POST['PARAM_3'];
        $pay_service = $_POST['PARAM_4'];
        $comments = $_POST['PARAM_5'];
        $customer = $_POST['PARAM_6'];
        $i = $_POST['PARAM_7'];

        if (!$from || !$to) return;

        $dec = user_price_dec();

        $fno = explode("-", $from);
        $tno = explode("-", $to);
        $from = min($fno[0], $tno[0]);
        $to = max($fno[0], $tno[0]);
        $range = get_invoice_range($from, $to);
        // Demo Invoice Starts
        // In this example HTML is used to create PDF file.
        $html = '
        table, tr, td {
        padding: 15px;
        <table style="background-color: #222222; color: #fff">
        <td><h1>INVOICE<strong> #21234</strong></h1></td>
        <td align="right">
        123 street, ABC Store<br/>
        Country, State, 00000
        <strong>+00-1234567890</strong> | <strong>abc@xyz</strong>
        $html .= '
        <td>Invoice to<br/>
        <strong>Demo Customer</strong>
        123 street, ABC Store<br/>
        Country, State, 00000
        <td align="right">
        <strong>Total Due: $ 23,442.00/strong><br/>
        Tax ID: ABCDEFGHIJ12345<br/>
        Invoice Date: '.date('d-m-Y').'
        $html .= '
        <tr style="font-weight:bold;">
        <th>Item name</th>
        $html .= '
        <td style="border-bottom: 1px solid #222">Demo Item</td>
        <td style="border-bottom: 1px solid #222">$23,422.00</td>
        <td style="border-bottom: 1px solid #222">1</td>
        <td style="border-bottom: 1px solid #222">$23,422.00</td>
        $html .='
        <tr align="right">
        <td colspan="4"><strong>Grand total: $23,422.00</strong></td>
        <td colspan="4">
        <h2>Thank you for your business.</h2><br/>
        <strong>Terms and conditions:<br/></strong>
        It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using Content here, content here, making it look like readable English.
        // create new PDF document
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        // set default monospaced font
        // set margins
        $pdf->SetMargins(-1, 0, -1);
        // remove default header/footer
        // set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        // set image scale factor
        // Set font
        $pdf->SetFont('helvetica', '', 10);
        // Print text using writeHTMLCell()
        $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 0, 0, true, '', true);
        // Demo Invoice Ends


        $filename = 'Invoice';

        $root_dir =  $_SERVER['DOCUMENT_ROOT'].substr(company_path(),3). '/pdf_files';
        $dir = company_path(). '/pdf_files';

        $fname = $root_dir.'/'.$filename.'.pdf';
        $pdf->Output($fname, 'F');

        if ($d = @opendir($dir)) {
        while (($file = readdir($d)) !== false) {
            if (!is_file($dir.'/'.$file) || $file == 'index.php') continue;
            $ftime = filemtime($dir.'/'.$file);
            if (time()-$ftime > 180){

        global $Ajax;

In the above example we included

       // here you can write your own fuctions for this template.
       // this can be any PDF Libarary you are trying to print invoice with
        require_once($path_to_root . "/modules/TCPDF/tcpdf.php");

That's it now whenever user try to print invoice this report will print.

Here is sample Invoice Format I Created With TCPDF / dompdf in FrontAccountingERP

Invoice Template 1 - Rep107
Invoice Template 2  - Rep107
Invoice Template 3 - Rep107
Receipt Template 1 - Rep112

Your suggestion, thoughts and comment are appreciated.


I have made this module with TCPDF to over ride existing FA Reports with your own fancy report. Though you need basic PHP knowledge to make one.

No pre made reports has been provided with this module.

I have included Demo Rep107 as an example, get an idea from it.

See TCPDF examples here

TCPDF Module Github



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

thanks @apmuthu: for the changes, I will update the suggested changes in my repo as well.

@anoopmb: I found this function in includes/

This database transaction hooks are for modules to invoked before transaction is voided

function hook_db_prevoid($type, $type_no)
    return hook_invoke_all('db_prevoid', $type, $type_no);

Where $type is type of transaction like ST_PURCHORDER. Which mean first parameter must be ST_PURCHORDER.

So your correct, but @joe or @apmuthu may provide more information on this.



(4 replies, posted in Items and Inventory)

I have created a module for HSN code, batch number, mrp, bin, expiry, manufacture, stocked date. PM me to know more.


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

update ship_via in debtor_trans field if shipping company is changed and has been committed to GITHUB.

files modified shipments\includes\db\ with new function (updated attachment in first post)

@apmuthu: thanks for the information.

It would be great help if fiscal year start date and end date, fields can be included during FA fresh installation or during creating new company.


@apmuthu it because I was using Indian COA while installing new company and area access was not granted to System Administrator

in en_IN-new.sql

TABLE 0_security_roles

('2', 'System Administrator', 'System Administrator', '256;512;768;2816;3072;3328;5376;5632;5888;7936;8192;8448;10496;10752;11008;13056;13312;15616;15872;16128', '257;258;259;260;513;514;515;516;517;518;519;520;521;522;523;524;525;769;770;771;772;773;774;2817;2818;2819;2820;2821;2822;2823;3073;3074;3082;3075;3076;3077;3078;3079;3080;3081;3329;3330;3331;3332;3333;3334;3335;5377;5633;5634;5635;5636;5637;5641;5638;5639;5640;5889;5890;5891;7937;7938;7939;7940;8193;8194;8195;8196;8197;8449;8450;8451;10497;10753;10754;10755;10756;10757;11009;11010;11012;13057;13313;13314;13315;15617;15618;15619;15620;15621;15622;15623;15624;15625;15626;15627;15873;15874;15875;15876;15877;15878;15879;15880;15883;15881;15882;16129;16130;16131;16132;775', '0')

in en_US-new.sql -

TABLE 0_security_roles

('2', 'System Administrator', 'System Administrator', '256;512;768;2816;3072;3328;5376;5632;5888;7936;8192;8448;9472;9728;10496;10752;11008;13056;13312;15616;15872;16128', '257;258;259;260;513;514;515;516;517;518;519;520;521;522;523;524;525;526;769;770;771;772;773;774;2817;2818;2819;2820;2821;2822;2823;3073;3074;3082;3075;3076;3077;3078;3079;3080;3081;3329;3330;3331;3332;3333;3334;3335;5377;5633;5634;5635;5636;5637;5641;5638;5639;5640;5889;5890;5891;7937;7938;7939;7940;8193;8194;8195;8196;8197;8449;8450;8451;9217;9218;9220;9473;9474;9475;9476;9729;10497;10753;10754;10755;10756;10757;11009;11010;11011;11012;13057;13313;13314;13315;15617;15618;15619;15620;15621;15622;15623;15624;15628;15625;15626;15627;15873;15874;15875;15876;15877;15878;15879;15880;15883;15881;15882;16129;16130;16131;16132;775', '0')

Missing sections


Missing Areas




(2 replies, posted in Setup)

@flpages very good work. I know how difficult it is to create informative videos. It will definitely help many FA users.


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

thanks @kvvaradha for correction. Bug has been fix and committed to github repository. Yes I am planning to provide.

1. Option to change shipment status
2. update ship_via in debtor_trans field if shipping company is changed.
3. provide hyperlink popup on tracking number string with API url.
4. shipping label - package wise
5. Option to change label size and package size.

opinion and suggestions are needed.



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


Created shipping tracking module for FA. In case anyone needs it. … acking.git


@joe I have notice tax group is disabled for secondary company if we have more than one company in same database. Is this intentional or need to be corrected.



(1 replies, posted in FA Modifications)

@Mahmoud Ali may be you are looking for search item list while making invoice

Setup - Company Setup

Check Box - Search Item List

Now you can type product name and enter.. All matching item entries related to your search will be displayed in item list.

Tip: Avoid using mouse to focus on field instead use keyboard.

Type Keyword -- Enter -- TAB -- Up / Down Arrow to select product.

Bonus: Type * and Enter -- it will display all products.


@notrinos as Payroll & Human Resource Management is going to come built-in in 2.5

Post: 1

What will happen to salesman table, will it use reference from employee table?



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

@flpages this Tax Setup Is Just For India Which Have Complex Taxation Method

For Example:

A product purchase from other state is tax with IGST, which is sold within business state and tax with CGST and SGST

A product purchase from other state is tax with IGST, which is sold in other state and tax with IGST

A product purchase within business state is tax with CGST and SGST, which is sold in other state and tax with IGST

A product purchase within business state is tax with CGST and SGST, which is sold in business state and tax with CGST and SGST

i.e. CGST = IGST/2 & SGST = IGST/2

All Input Tax Are Accumulated in GL Account Code 2050 - 2061
All Output Tax Are Accumulated in GL Account Code 2000 - 2011

Here we need two Tax Group one for business state and another for other state.

If we put same account for Sales & Purchase in Tax Type, it will be more confusing. Since same account code can't we used multiple time in FA for Tax Type. And has to be Under 3 Account Code for each tax type.

Problem behind this 2 type of tax on same product, depending upon state in which goods is sold.

The main focus of solution is to use FA as it is, without messing core. We can create extension custom report to deal with tax compliance.



(1 replies, posted in Setup)

GST on shipping is possible in FA

Setup GST - With reference post 8 in

Setup - Tax Group
In Shipping Tax Column Select Appropriate Tax For Shipping


(3 replies, posted in Setup)

@apmuthu can the above query be included in English Indian COA - New


(3 replies, posted in Setup)

Banking and General Ledger - Currencies

Currency Abbreviation: INR
Currency Symbol: Rs. or INR
Currency Name: Indian Rupees
Hundredths Name: Paise
Country: India

If you really need ₹ as only option then open phpmyadmin select table 0_currencies under SQL write this query and GO

Please Note: 0_ is the default prefix of primary company. Replace with your company's prefix.

ALTER TABLE 0_currencies MODIFY COLUMN curr_symbol VARCHAR(10)
    CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';

Now Try Inserting ₹ symbol, it must get updated


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

@apmuthu - Here Is MYSQL Query For English Indian COA - New

Since _last is set with e.selectedIndex before making ajax request. If ajax fails input value are not populated with data. but selected drop down option is e.selectedIndex. This can result in data loss or data overwrite on records.

Mantis Bug Tracking For This Issue -


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

My approach in creating setup for Indian Tax System in FA

Step by Step Procedure

@apmuthu can you please include this approach in English Indian COA - New. for Indian GST



(5 replies, posted in Accounts Receivable)

@paul your welcome