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

https://mpulse.in/images/Credit_Note.jpg

@apmuthu: Sorry for not pushing, README.md 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>";
}

$reports->register_controls('invoice_copy');

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

<?php
        // $page_security can be found in respective file in reporting folder
        $page_security = 'SA_SALESTRANSVIEW';
        ob_start();

        $path_to_root="..";

        include_once($path_to_root . "/includes/session.inc");
        include_once($path_to_root . "/includes/date_functions.inc");
        include_once($path_to_root . "/includes/data_checks.inc");
        include_once($path_to_root . "/sales/includes/sales_db.inc");
        include_once($path_to_root . "/gl/includes/db/gl_db_currencies.inc");
        include_once($path_to_root . "/inventory/includes/db/items_db.inc");
       // here you can write your own fuctions
        include_once($path_to_root."/modules/TCPDF/reporting/includes/db/rep107_db.php");
       // 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 = '
        <style>
        table, tr, td {
        padding: 15px;
        }
        </style>
        <table style="background-color: #222222; color: #fff">
        <tbody>
        <tr>
        <td><h1>INVOICE<strong> #21234</strong></h1></td>
        <td align="right">
        123 street, ABC Store<br/>
        Country, State, 00000
        <br/>
        <strong>+00-1234567890</strong> | <strong>abc@xyz</strong>
        </td>
        </tr>
        </tbody>
        </table>
        ';
        $html .= '
        <table>
        <tbody>
        <tr>
        <td>Invoice to<br/>
        <strong>Demo Customer</strong>
        <br/>
        123 street, ABC Store<br/>
        Country, State, 00000
        </td>
        <td align="right">
        <strong>Total Due: $ 23,442.00/strong><br/>
        Tax ID: ABCDEFGHIJ12345<br/>
        Invoice Date: '.date('d-m-Y').'
        </td>
        </tr>
        </tbody>
        </table>
        ';
        $html .= '
        <table>
        <thead>
        <tr style="font-weight:bold;">
        <th>Item name</th>
        <th>Price</th>
        <th>Quantity</th>
        <th>Total</th>
        </tr>
        </thead>
        <tbody>';
        $html .= '
        <tr>
        <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>
        </tr>
        ';
        $html .='
        <tr align="right">
        <td colspan="4"><strong>Grand total: $23,422.00</strong></td>
        </tr>
        <tr>
        <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.
        </td>
        </tr>
        </tbody>
        </table>';
        // 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
        $pdf->setPrintHeader(false);
        $pdf->setPrintFooter(false);
        // set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        // set image scale factor
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        // Set font
        $pdf->SetFont('helvetica', '', 10);
        $pdf->AddPage();
        // Print text using writeHTMLCell()
        $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 0, 0, true, '', true);
        // Demo Invoice Ends

        ob_end_clean();

        $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){
                unlink($dir.'/'.$file);
            }
        }
        closedir($d);
        }

        global $Ajax;
        $Ajax->popup($dir.'/'.$filename.'.pdf'); 
        exit;

In the above example we included

       // here you can write your own fuctions for this template.
        include_once($path_to_root."/modules/TCPDF/reporting/includes/db/rep107_db.php");
       // 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.

Regards

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 https://tcpdf.org/examples/

TCPDF Module Github https://github.com/impulse-solutions/FA-TCPDF

Regards

4

(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/hooks.inc

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.

Regards

6

(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.

7

(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\tracking_db.inc 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.

Regards

@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

9472;9728

Missing Areas

9217;9218;9220;9473;9474;9475;9476;9729;11011;15628

Regards

11

(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.

12

(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.

Regards

13

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

Hello

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

https://github.com/impulse-solutions/FA … acking.git

Regards

@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.

Regards

15

(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.

Regards

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

Reference: https://frontaccounting.com/punbb/viewtopic.php?id=8137
Post: 1

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

Regards

17

(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

CGST + SGST = IGST
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.

Regards

18

(1 replies, posted in Setup)

GST on shipping is possible in FA

Setup GST - With reference post 8 in
https://frontaccounting.com/punbb/viewtopic.php?id=7770

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

19

(3 replies, posted in Setup)

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

20

(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

21

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

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

https://mpulse.in/public/FA_indian_tax_dearmosin.txt

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 - http://mantis.frontaccounting.com/view.php?id=5201

24

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

My approach in creating setup for Indian Tax System in FA

Step by Step Procedure

https://mpulse.in/images/FA_indian_tax_setup.jpg

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

Regards

25

(5 replies, posted in Accounts Receivable)

@paul your welcome