Topic: ERROR Report GL Trans (show warning sign)

everything is ok if i only select date range for 1 month.
but I want to print report GL Trans, for date range is 6 months and for all Chart of Accounts (have 196 numbers) to report_pdf.
the jshttprequest is stop, I don't think anything is wrong, maybe jshttpresquest can't process too much data.

what should i do to solve this problem?
please help me.

thanks
ardy

Re: ERROR Report GL Trans (show warning sign)

It doesn't depends on chart of account. May be the six month data is huge in GL trans. As you said you have 196 in chart of accounts. 

Or the query fails to complete it time like the server have less RAM .

Subscription service based on FA
HRM CRM POS batch Themes

Re: ERROR Report GL Trans (show warning sign)

can i do generate report without jshttprequest?

Re: ERROR Report GL Trans (show warning sign)

ardyan wrote:

can i do generate report without jshttprequest?

Actually no need. Just increase the js timeout. That will wait for some more time with php response. It was inside util.js. It has 10 seconds like 10000 there. Change it to 30000 And logout and login to your FA and hard refresh it again and try it.  It might wait for 20 more seconds.

Subscription service based on FA
HRM CRM POS batch Themes

Re: ERROR Report GL Trans (show warning sign)

thanks for replying, problem solved.

Re: ERROR Report GL Trans (show warning sign)

@joe, most of the php config set for 30 seconds  why do we have 10 seconds.  Can we set it for 30 seconds as basic one..?

Subscription service based on FA
HRM CRM POS batch Themes

Re: ERROR Report GL Trans (show warning sign)

Yes, why not. Let me discuss this with @itroniics.

Joe

Re: ERROR Report GL Trans (show warning sign)

Lines 38 and 40 in js/utils.js need this change.

Re: ERROR Report GL Trans (show warning sign)

I think better solution is change in line 103 of reporting/includes/reports_classes.inc (fifth argument of submit() call).
When you change 'default popup' string here to 'default progress popup' effective report engine timeout should change to max. 10 minutes (this is visualised by progressbar icon instead of swirl).
Could you please test if this fix works for you without any side effects?

Janusz

Re: ERROR Report GL Trans (show warning sign)

@itronics proposal has been committed to stable repo.

/Joe

Re: ERROR Report GL Trans (show warning sign)

itronics wrote:

I think better solution is change in line 103 of reporting/includes/reports_classes.inc (fifth argument of submit() call).
When you change 'default popup' string here to 'default progress popup' effective report engine timeout should change to max. 10 minutes (this is visualised by progressbar icon instead of swirl).
Could you please test if this fix works for you without any side effects?

Janusz

Looks you have considered only to the reports. How about inquiry pages which has to query in huge records and if the FA  is hosted on shared hosting.

Subscription service based on FA
HRM CRM POS batch Themes

Re: ERROR Report GL Trans (show warning sign)

Inquires use paged transaction lookup ie only limited number of records is retrieved at once,  so this issue should not appear here. Unless you will set 10000 records per page to be displayed :-).
J.

Re: ERROR Report GL Trans (show warning sign)

It happens with a customer transaction inquiry page itself with 10 records show. But the table has more than 50k customers in it.

Subscription service based on FA
HRM CRM POS batch Themes

Re: ERROR Report GL Trans (show warning sign)

Seems the query used here is suboptimal. Really 10 seconds should be enough to retrieve 10 records from database.
Unfortunately I don't have such big databse to test, but you can experiment with query form in get_sql_for_customer_inquiry().

J.

Re: ERROR Report GL Trans (show warning sign)

Agreed @itronics
I have tested on a database with 73000 customer transactions and Customer Transactions page can give result in less than 3 seconds

Phuong

Re: ERROR Report GL Trans (show warning sign)

So I guess problem appears just for huge customer table.

@kvaradha, notrinos
Please test slightly changed inquiry helper, I hope this form will behave better:

//----------------------------------------------------------------------------------------
function get_sql_for_customer_inquiry($from, $to, $cust_id = ALL_TEXT, $filter = ALL_TEXT, $show_voided = 0)
{
    $date_after = date2sql($from);
    $date_to = date2sql($to);

      $sql = "SELECT
          trans.type,
        trans.trans_no,
        trans.order_,
        trans.reference,
        trans.tran_date,
        trans.due_date,
        debtor.name,
        branch.br_name,
        debtor.curr_code,
        IF(prep_amount, prep_amount, trans.ov_amount + trans.ov_gst + trans.ov_freight
            + trans.ov_freight_tax + trans.ov_discount)    AS TotalAmount,"
        . "IF(trans.type IN(".implode(',',  array(ST_CUSTCREDIT,ST_CUSTPAYMENT,ST_BANKDEPOSIT))."), -1, 1)
                *(IF(prep_amount, prep_amount, trans.ov_amount + trans.ov_gst + trans.ov_freight
            + trans.ov_freight_tax + trans.ov_discount)-trans.alloc) Balance,
        debtor.debtor_no,";

        $sql .= "trans.alloc AS Allocated,
        ((trans.type = ".ST_SALESINVOICE." || trans.type = ".ST_JOURNAL.")
            AND trans.due_date < '" . date2sql(Today()) . "') AS OverDue ,
        Sum(line.quantity-line.qty_done) AS Outstanding,
        Sum(line.qty_done) AS HasChild,
        prep_amount
        FROM "
            .TB_PREF."debtor_trans as trans
            LEFT JOIN ".TB_PREF."debtor_trans_details as line
                ON trans.trans_no=line.debtor_trans_no AND trans.type=line.debtor_trans_type
            LEFT JOIN ".TB_PREF."voided as v
                ON trans.trans_no=v.id AND trans.type=v.type
                        LEFT JOIN ".TB_PREF."audit_trail as audit ON (trans.type=audit.type AND trans.trans_no=audit.trans_no)
                        LEFT JOIN ".TB_PREF."users as user ON (audit.user=user.id)
            LEFT JOIN ".TB_PREF."cust_branch as branch ON trans.branch_code=branch.branch_code
            LEFT JOIN ".TB_PREF."debtors_master as debtor ON debtor.debtor_no = trans.debtor_no" // exclude voided transactions and self-balancing (journal) transactions:
            ." WHERE";

    if ($filter == '2')
        $sql .= " ABS(IF(prep_amount, prep_amount, trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount)-trans.alloc)>"
            .FLOAT_COMP_DELTA;
    else {
        $sql .= " trans.tran_date >= '$date_after'
            AND trans.tran_date <= '$date_to'";
    }

    if (!$show_voided)     
             $sql .= " AND ISNULL(v.date_) AND (trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount) != 0";


       if ($cust_id != ALL_TEXT)
           $sql .= " AND trans.debtor_no = ".db_escape($cust_id);

       if ($filter != ALL_TEXT)
       {
           if ($filter == '1')
           {
               $sql .= " AND (trans.type = ".ST_SALESINVOICE.") ";
           }
           elseif ($filter == '2')
           {
               $sql .= " AND (trans.type <> ".ST_CUSTDELIVERY.") ";
           }
           elseif ($filter == '3')
           {
            $sql .= " AND (trans.type = " . ST_CUSTPAYMENT
                    ." OR trans.type = ".ST_BANKDEPOSIT." OR trans.type = ".ST_BANKPAYMENT.") ";
           }
           elseif ($filter == '4')
           {
            $sql .= " AND trans.type = ".ST_CUSTCREDIT." ";
           }
           elseif ($filter == '5')
           {
            $sql .= " AND trans.type = ".ST_CUSTDELIVERY." ";
           }

        if ($filter == '2')
        {
            $today =  date2sql(Today());
            $sql .= " AND trans.due_date < '$today'
                AND (trans.ov_amount + trans.ov_gst + trans.ov_freight_tax +
                trans.ov_freight + trans.ov_discount - trans.alloc > 0) ";
        }
       }

    $sql .= " GROUP BY trans.trans_no, trans.type";

       return $sql;
}

Here cross product of debtor_trans and debtor_master is superseded by LEFT JOIN which should reduce processing time.
J.

17 (edited by notrinos 08/21/2021 08:01:54 am)

Re: ERROR Report GL Trans (show warning sign)

@itronics
I have tested in both apache and nginx server with the same database which has 73666 transactions and here is the result:

Nginx:
- Old query took 1.1133 seconds
- New query took 1.1142 seconds

Apache:
- Old query took 1.8560 seconds
- New query took 1.8940 seconds

The perfomance difference is not noticeable.

Note: The apache is installed on a localhost of a windows 10 machine, the nginx server is on a centos7 server machine

Phuong

18 (edited by kvvaradha 08/21/2021 08:56:01 am)

Re: ERROR Report GL Trans (show warning sign)

@notrinos, I guess there Is not much difference,  guess your tables are not contains utf data. Try with utf data and name the customers and branches almost the size of name max characters and try. You will get this situation. But I would suggest most of the php servers set 30 seconds as their max execution time and some of users using shared hosting. Their server performance not same always. Vps  and dedicated servers and local pc are different then shared hosting.

Hope you guys understand the point. 10 seconds is very less time.

Subscription service based on FA
HRM CRM POS batch Themes

Re: ERROR Report GL Trans (show warning sign)

Thank you notrinos. The results seems to be similar, but in fact problem can also depend on specific database content/structure as kvvaradha suggested.

@kvvaradha

Could you check the change proposed above with the same database you had timeouts before?

J.