I can see this commit by @joe for Item Editable Description. I have applied this but I couldn't find any change in Behaviour of Editable Item Description. Any Idea how shall I expect the change?

I copied the Logic from rep101.php and it worked.

function get_open_balance($supplier_id, $to)
{
    if($to)
        $to = date2sql($to);

        $sql = "SELECT SUM(IF(t.type = ".ST_SUPPINVOICE." OR (t.type IN (".ST_JOURNAL." , ".ST_BANKDEPOSIT.") AND t.ov_amount>0),
                        -abs(t.ov_amount + t.ov_gst + t.ov_discount), 0)) AS charges,";

 $sql .= "SUM(IF(t.type != ".ST_SUPPINVOICE." AND NOT(t.type IN (".ST_JOURNAL." , ".ST_BANKDEPOSIT.") AND t.ov_amount>0),
                        abs(t.ov_amount + t.ov_gst + t.ov_discount) * -1, 0)) AS credits,";

     $sql .= "SUM(IF(t.type != ".ST_SUPPINVOICE." AND NOT(t.type IN (".ST_JOURNAL." , ".ST_BANKDEPOSIT.")), t.alloc * -1, t.alloc)) AS Allocated,";

     $sql .=    "SUM(IF(t.type = ".ST_SUPPINVOICE.", 1, -1) *
             (abs(t.ov_amount + t.ov_gst + t.ov_discount) - abs(t.alloc))) AS OutStanding
        FROM ".TB_PREF."supp_trans t
        WHERE t.supplier_id = ".db_escape($supplier_id);
    if ($to)
        $sql .= " AND t.tran_date < '$to'";
    $sql .= " GROUP BY supplier_id";

    $result = db_query($sql,"No transactions were returned");
    return db_fetch($result);
}

I found a bug in Supplier Balances Report.

Check this screen shot of comparison. Opening Balance of the SUpplier was recorded on 30th June. When we query including 30th June the report shows value correctly under Charges Column But When we query from 1st July the Reports Shows the opening balance wrongly under Credits Column.

The reason is that the Opening Balance was entered through Journal Entry. and Journal Entry is not being checked in the get_open_balance() function in rep201.php.

379

(2 replies, posted in Setup)

When a Transaction is selected to be voided in FA, It is not highlighted.

Below code would server the cause. Replace the code starting at Line # 174

function is_selected($row) // Function added by faisal
        {
            global $selected_id;
            return $row['trans_no'] == $selected_id ? true : false;
        }

    $trans_ref = false;
    $sql = get_sql_for_view_transactions(get_post('filterType'), get_post('FromTransNo'), get_post('ToTransNo'), $trans_ref);
    if ($sql == "")
        return;

    $cols = array(
        _("#") => array('insert'=>true, 'fun'=>'view_link'),
        _("Reference") => array('fun'=>'ref_view'),
        _("Date") => array('type'=>'date', 'fun'=>'date_view'),
        _("GL") => array('insert'=>true, 'fun'=>'gl_view'),
        _("Select") => array('insert'=>true, 'fun'=>'select_link')
    );

    $table =& new_db_pager('transactions', $sql, $cols);
    $table->set_marker('is_selected', _("Marked transactions will be voided.")); //Added by Faisal

Unlike Customer payment, Supplier payment is not editable. Any solution for this

@cs you need to enable it from Access Setup

I wrote a function to write to a file the sql output for debugging purpose. I forgot to comment that out. That was actually taking too long.

@poncho1234 yes lac is 100,000 in our local language smile

@kvvaradha, you are right. Thanks alot

I got the problem. One of my customization was basically causing the issue. I must have checked that without customized code.

Regards.

I increased the max_execution_time so the problem mitigated but what if the records increases?

When querying one month transactions for a given gl account, the Ajax does not return any record because the number of records are around 300. What could be the solution for this? Can't we have multiple pages in the return of Query?

Modify the Code block at Line 182 on gl_bank.php with code below. This is to ensure the Edit of Bank Payment.

while ($row = db_fetch($result)) {
                if (is_bank_account($row['account']) && $_GET['ModifyPayment']=='Yes' && $row['amount'] > 0) //Added block by faisal
                {
                    $cart->add_gl_item( $row['account'], $row['dimension_id'],
                        $row['dimension2_id'], $row['amount'], $row['memo_']);
                }
                elseif (is_bank_account($row['account']) ) {
                    // date exchange rate is currenly not stored in bank transaction,
                    // so we have to restore it from original gl amounts
                    $ex_rate = $bank_trans['amount']/$row['amount'];
                }
                 else {
                    $cart->add_gl_item( $row['account'], $row['dimension_id'],
                        $row['dimension2_id'], $row['amount'], $row['memo_']);
                }
            }

Add this line at Line 411 in gl_bank.php

hidden('ModifyPayment',@$_GET['ModifyPayment']); //added by faisal
hidden('NewPayment',@$_GET['NewPayment']); //added by faisal

includes/ui/gl_bank_ui.inc at Line 253 (ignore this code set in above post#1)

if (@$_GET['NewPayment'] == 'Yes' || @$_POST['NewPayment'] == 'Yes' || @$_GET['ModifyPayment'] == 'Yes' || @$_POST['ModifyPayment'] == 'Yes' )
            $skip_bank = !$_SESSION["wa_current_user"]->can_access('SA_BANK2BANK');
    else {
        $skip_bank = true;
    }

    echo gl_all_accounts_list('code_id', null, $skip_bank, true); // modified by faisal

great smile

I have customized the code as below

includes/access_levels.inc Line 269

'SA_BANK2BANK' => array(SS_GL|13, _("Bank Transfer Through Bank Payment")), //added by faisal

includes/ui/gl_bank_ui.inc at Line 253

if (@$_GET['NewPayment'] == 'Yes') //Added by faisal
        $skip_bank = !$_SESSION["wa_current_user"]->can_access('SA_BANK2BANK');
    else {
        $skip_bank = true;
    }

    echo gl_all_accounts_list('code_id', null, $skip_bank, true); // modified by faisal

gl/includes/db/gl_db_banking.inc at Line 477

        if ($trans_type == ST_BANKPAYMENT AND $is_bank_to && !$_SESSION["wa_current_user"]->can_access('SA_BANK2BANK'))

Line numbers may vary.

Please test and comment.

I think members are not sure how to test it. Let me explain it.

Suppose if the Next Available Reference for Journal Entry is JE222 in Transaction References. Change it to JE220. Now if you will make the Journal Entry you will get the message "Reference already in use".

Now place the above code in core and test now. You will see that the message will not appear and the system will itself increment the values and record the transaction with Reference JE222.

I hope now someone can test it and give feedback to @joe.

I am surprised. No one in FA Community facing the problem of reference increment sad

could anyone test this?

I have set the cols='35' and rows='3' and now its OK for me

I have tested the recommended code of @kvvaradha. It is working fine and data is correctly displayed even in reports. The only problem mentioned in this screen short

The TextArea is encompassing the second column

The following function returns a TextBox to Edit Item Description if Item is Editable. Some Item Descriptions needs to be multi lines. How can this function returns TextArea for Editable Items.

function sales_items_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false, $editkey=false)
{
    if ($editkey)
        set_editor('item', $name, $editkey);

    if ($label != null)
        echo "<td>$label</td>\n";
    echo sales_items_list($name, $selected_id, $all_option, $submit_on_change,
        '', array('cells'=>true));
}

Can't we use both? i.description and s.long_description?

I want to add another column in Drop Down List in following function i.e. s.long_description. What changes shall I make

function sales_items_list($name, $selected_id=null, $all_option=false,
    $submit_on_change=false, $type='', $opts=array())
{
    // all sales codes
    $sql = "SELECT i.item_code, i.description, c.description, count(*)>1 as kit,
             i.inactive, if(count(*)>1, '0', s.editable) as editable
            FROM
            ".TB_PREF."stock_master s,
            ".TB_PREF."item_codes i
            LEFT JOIN
            ".TB_PREF."stock_category c
            ON i.category_id=c.category_id
            WHERE i.stock_id=s.stock_id
      AND mb_flag != 'F'";


    if ($type == 'local')    { // exclude foreign codes
        $sql .=    " AND !i.is_foreign";
    } elseif ($type == 'kits') { // sales kits
        $sql .=    " AND !i.is_foreign AND i.item_code!=i.stock_id";
    }
    $sql .= " AND !i.inactive AND !s.inactive AND !s.no_sale";
    $sql .= " GROUP BY i.item_code";

    return combo_input($name, $selected_id, $sql, 'i.item_code', 'c.description',
        array_merge(
          array(
            'format' => '_format_stock_items',
            'spec_option' => $all_option===true ?  _("All Items") : $all_option,
            'spec_id' => ALL_TEXT,
            'search_box' => true,
            'search' => array("i.item_code", "c.description", "i.description"),
            'search_submit' => get_company_pref('no_item_list')!=0,
            'size'=>15,
            'select_submit'=> $submit_on_change,
            'category' => 2,
            'order' => array('c.description','i.item_code'),
            'editable' => 30,
            'max' => 255
          ), $opts), $type == 'kits' ? $type : "stock_sales" );
}

I have tried one solution. I request you to please analyze it critically

Modified the below function in includes/references.inc

at Line 228

function is_new_reference(&$ref, $type, $trans_no=0) //modified by faisal
    {
        $old_ref = $ref;
        while ($this->_get($type,$trans_no,$ref))
        {
            $ref = $this->_increment($ref);
        }

        if ($old_ref!=$ref)
            $this->reflines->save_next($type,$ref);

        return !$this->_get($type, $trans_no, $ref);
    }

At Line 428

function is_new_reference(&$ref, $type, $trans_no=0)//Modified by faisal
{
    global $Refs;

    $old_ref = $ref;
    while (!$Refs->is_new_reference($ref,$type,$trans_no))
    {
        $ref = $Refs->_increment($ref);
    }

    if ($old_ref!=$ref)
        $Refs->reflines->save_next($type,$ref);
    
    return $Refs->is_new_reference($ref, $type, $trans_no);
}

includes/data_checks.inc at Line 666

function check_reference(&$reference, $trans_type, $trans_no=0, $context=null, $line=null)

the code for it has been placed in the forum and possibly in the wiki adn the end user can make a choice.

@apmuthu can you refer the wiki or post where this code is available for this solution.