201

(13 replies, posted in Accounts Receivable)

Core changes are needed for the reissue invoice page that I wrote to work because although it is basically a copy of the void page, it then calls the order entry, delivery, and invoice pages and then expects control to be returned back to the calling page rather than continue to the standard completion pages.

So if one were to create an extension without core changes, the extension would have to contain all the code from the void page and these other pages in the extension itself.   It would also need a way of selecting the invoice to be reissued.

However, I prefer the somewhat core-integrated approach that I took, largely because the code is much simpler but also because the link to the reissue page (reissue icon) is on the list of customer transactions inquiry page, making it easy to find.

202

(13 replies, posted in Accounts Receivable)

Void of a sales invoice does not void the sales order.    You can reuse the same sales order.  You do not have to type the already inputs again (except for quantities: void of a direct invoice (auto generated delivery) clears the quantities in the sales order but the void of a manual invoice does not).

Thus, to edit a sales invoice:

1.  void the invoice.
2.  If the sales invoice was a manual invoice, void the delivery (void of a direct invoice auto-voids the delivery).
3. edit the sales order and process
4. process the delivery
5. process the invoice

On my site, I have a page that does these steps somewhat automatically, thus creating the appearance of being able to edit any invoice.

In summary, FA does not prevent the edit of an invoice.  It just requires more steps.

Wiki-ed.

203

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

FYI, I played with a different approach: defining additional fields as xml inside a text field.  There are no database changes and no changes to the items, suppliers, or customers pages.

Gist

Screenshots:

Customers
Items

204

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

My gl_account_inquiry.php differs from the core because it offers the person-type/person-id filters, just like the quickreport extension.  So the call in my gl_account_inqury.php is:

    $result = get_gl_transactions($_POST['TransFromDate'], $_POST['TransToDate'], -1,
        $_POST["account"], $_POST['Dimension'], $_POST['Dimension2'], null,
        input_num('amount_min'), input_num('amount_max'), get_post('person_type'), get_post('person_id'), $_POST['Memo']);

Without the person-type/person-id filter code, those parameters can be null.

In quickreport.php and my gl inquiry, the person-type/person-id list is ajax enabled.   One regret is that the code does not search on the Miscellaneous person type so perhaps there should be an additional <no search> entry in the list.

The original impetus to add the person-type/person-id filter was because there is no other way of searching for quick entry transactions in FA.

205

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

Note: this also has my suggested fix for mantis issue 0004817: g/l account inquiry can timeout due to slow sql.

function get_gl_transactions($from_date, $to_date, $trans_no=0,
    $account=null, $dimension=0, $dimension2=0, $filter_type=null,
        $amount_min=null, $amount_max=null, $person_type=null, $person_id=null, $memo='')
{
    global $SysPrefs;

    $from = date2sql($from_date);
    $to = date2sql($to_date);

    $sql = "SELECT gl.*, j.event_date, j.doc_date, a.gl_seq, u.user_id, st.supp_reference, gl.person_id subcode,
            IFNULL(IFNULL(sup.supp_name, debt.name), bt.person_id) as person_name, 
            IFNULL(gl.person_id, IFNULL(sup.supplier_id, IFNULL(debt.debtor_no, bt.person_id))) as person_id,
            IF(gl.person_id, gl.person_type_id, IF(sup.supplier_id,".  PT_SUPPLIER . "," .  "IF(debt.debtor_no," . PT_CUSTOMER . "," . 
            "IF(bt.person_id != '' AND !ISNULL(bt.person_id), bt.person_type_id, -1)))) as person_type_id,
            IFNULL(st.tran_date, IFNULL(dt.tran_date, IFNULL(bt.trans_date, IFNULL(grn.delivery_date, gl.tran_date)))) as doc_date,
            coa.account_name, ref.reference, IF(ISNULL(c.memo_), gl.memo_, CONCAT(gl.memo_,' ',c.memo_)) AS memo
             FROM "
            .TB_PREF."gl_trans gl
            LEFT JOIN ".TB_PREF."voided v ON gl.type_no=v.id AND v.type=gl.type

            LEFT JOIN ".TB_PREF."supp_trans st ON gl.type_no=st.trans_no AND st.type=gl.type AND (gl.type!=".ST_JOURNAL." OR gl.person_id=st.supplier_id)
            LEFT JOIN ".TB_PREF."grn_batch grn ON grn.id=gl.type_no AND gl.type=".ST_SUPPRECEIVE."
            LEFT JOIN ".TB_PREF."debtor_trans dt ON gl.type_no=dt.trans_no AND dt.type=gl.type AND (gl.type!=".ST_JOURNAL." OR gl.person_id=dt.debtor_no)

            LEFT JOIN ".TB_PREF."suppliers sup ON st.supplier_id=sup.supplier_id
            LEFT JOIN ".TB_PREF."cust_branch branch ON dt.branch_code=branch.branch_code
            LEFT JOIN ".TB_PREF."debtors_master debt ON dt.debtor_no=debt.debtor_no

            LEFT JOIN ".TB_PREF."bank_trans bt ON bt.type=gl.type AND bt.trans_no=gl.type_no AND bt.amount!=0
                 AND (bt.person_id != '' AND !ISNULL(bt.person_id))

            LEFT JOIN ".TB_PREF."journal j ON j.type=gl.type AND j.trans_no=gl.type_no
            LEFT JOIN ".TB_PREF."audit_trail a ON a.type=gl.type AND a.trans_no=gl.type_no AND NOT ISNULL(gl_seq)
            LEFT JOIN ".TB_PREF."users u ON a.user=u.id
            LEFT JOIN ".TB_PREF."comments c ON c.id=gl.type_no AND c.type=gl.type

            LEFT JOIN ".TB_PREF."refs ref ON ref.type=gl.type AND ref.id=gl.type_no,"
        .TB_PREF."chart_master coa
        WHERE coa.account_code=gl.account
        AND ISNULL(v.date_)
        AND gl.tran_date >= '$from'
        AND gl.tran_date <= '$to'
        AND gl.amount <> 0"; 

    if ($trans_no > 0)
        $sql .= " AND gl.type_no LIKE ".db_escape('%'.$trans_no);;

    if ($account != null)
        $sql .= " AND gl.account = ".db_escape($account);

    if ($dimension != 0)
        $sql .= " AND gl.dimension_id = ".($dimension<0 ? 0 : db_escape($dimension));

    if ($dimension2 != 0)
        $sql .= " AND gl.dimension2_id = ".($dimension2<0 ? 0 : db_escape($dimension2));

    if ($filter_type != null)
        $sql .= " AND gl.type IN (" . $filter_type .")";

    if ($amount_min != null)
        $sql .= " AND ABS(gl.amount) >= ABS(".db_escape($amount_min).")";
    
    if ($amount_max != null)
        $sql .= " AND ABS(gl.amount) <= ABS(".db_escape($amount_max).")";

    if ($memo)
        $sql .= " AND (gl.memo_ LIKE ". db_escape("%$memo%") . " OR c.memo_ LIKE " . db_escape("%$memo%") . ")";

    $sql .= " GROUP BY counter";

    $sql .= " HAVING TRUE";
    if ($person_type != 0)
            $sql .= " AND person_type_id=".db_escape($person_type); 
    if ($person_id != 0)
            $sql .= " AND person_id=".db_escape($person_id); 

    $sql .= " ORDER BY tran_date, counter";
//display_notification($sql);

    return db_query($sql, "The transactions for could not be retrieved");
}

206

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

@apmuthu: I fixed the reset problem you mentioned.  Thanx.

I have a differing core and the get_gl_transactions() differs in several ways.  One difference is the person_type argument that you mention.   Another difference is that the filter_type parameter accepts a list of gl types instead of just one, which is necessary for the balances to be correct in this report by not displaying deliveries.   A third difference is that the memo field searches by both gl memo and comment memo.

The purpose of this inquiry page is to condense the display of g/l account transactions by placing the two accounts of a double entered transaction into separate columns rather than on separate lines like the standard gl inquiry.   If there are more than two accounts for a transaction, it displays "split".

This is helpful in visually identifying transactions entered into wrong accounts because often transactions use the same accounts each time.   For example, payments to a fuel supplier might usually use the accounts "Auto Expenses" and "Credit Card".   If one scans down the list of transactions for this supplier and then sees "Office Expenses" on one transaction, it probably was incorrectly entered and appropriate action can be taken (by clicking on the pencil to edit the transaction).

207

(36 replies, posted in FA Modifications)

Code fixes for special characters and lost focus

208

(36 replies, posted in FA Modifications)

The lists need special character handling so that names like "A & L" Foods appear properly.  One possible fix is to call

function decodeHtml(html) {
    var txt = document.createElement("textarea");
    txt.innerHTML = html;
    return txt.value;
}

where the code currently uses "selval" and

selectedoption.innerHTML= selectedoption.innerHTML.replace(/&nbsp;/gi,' ');

which currently may not be doing anything because the browser just converts back.

Another minor problem is lost focus because FA does not expect to focus on a hidden variable, which in the new code has the old list name (the new list being named "name" + mselect).  I have a simple fix for this if you are interested.

Thanks for the contribution.  I already had autocomplete lists running on my site but I like yours better because it modular and non-invasive, so I replaced my code with yours.

209

(36 replies, posted in FA Modifications)

To make this work with v2.4.6:
add in the auto_select_box lines in ui_lists.inc and auto_select_box.inc but change them to @$SysPrefs->auto_select_box and define the global SysPrefs.  Then add in the MBCODE block in js/inserts.js and the escapeRegExp (late adder) outside the MBCODE block and the call to mbselect in the 'select' block.  Add the MBCODE block in the desired theme.

210

(2 replies, posted in Dimensions)

This was a recent commit after the original pull request (https://github.com/FrontAccountingERP/FA/pull/32), which was not included in the core.

The earlier commit always used the dimension from the customer branch to dimension customer payments so there was no need to specify dimension on the customer payments page.

The recent commit was needed to handle a special case where a customer was invoiced separately by two separate dimensions of a company but the customer paid both invoices with a single check, so dimension was added to the customer payments screen to split the payment to the proper dimensions.

The purpose of these commits as stated in the original pull request, is to keep A/R correct when tracked separately by dimension.   If one does not need to track A/R separately by dimension, FA works correctly without these commits.

211

(17 replies, posted in Reporting)

core/reporting/includes/doctext.inc sets Footer for various documents.

reporting/includes/header2.inc inserts the Footer into the page.

So experiment with putting the text and image into doctext.inc for document specific text or header2.inc for all documents.  You may need to change the amount of space allocated for the Footer, thus shortening the number of lines that are displayed on a page.

See https://frontaccounting.com/punbb/viewtopic.php?id=7463.  Fix is same for suppliers/items/customers.

Can you create standard items where the description is "Description, Height, Width, Area"?  Then then item units would be area, the price is price/area, so invoice line price is qty x area.

If you are unable to make standard line items because every order is custom sized, then you would create a single item with an editable description and units of area.  During order entry, you would have to enter the height/width/area in the description and do the math yourself when you create the invoices, calculate the area, and update the associated price/area if it varies based on area.  You could keep a spreadsheet handy to do this during order entry.

If that is unacceptable, you could make some relatively simple modifications to the order entry to have Height, Width columns and do the calculations for you and update the description to "Description, Height, Width, Area" after the line is entered.  This would not require any database modifications.

I think many would like to see this in freely available code.

Not what you would want, but we are using the ancient web cart "oscommerce" and the FA oscommerce extension to do much of what you ask.

@hanneli

When the customer balance of the specific customer in question is incorrect on the statements, does the statement add up correctly?  If not, the problem is a arithmetic error; otherwise, if the statement does add up, the problem is either missing or additional transactions, given that the balance is correct when viewed in other ways.   

When you said that the customer statement shows an additional credit that is not correct, it made me suspect the latter case.  If the problem is indeed an extra transaction (i.e. credit) that should not be there, and cannot be found elsewhere in the system, then I am guessing that this is a voided transaction, although I do not have a theory why the "show also allocated" would make any difference.  In any case, it would suggest that the sql to locate transactions on the customer statement report is in error, if those transactions are not the same as shown in other parts of the system.

If you can isolate the problematic transaction, which perhaps you already have, then you can examine the database for more clues, using the data from this transaction to find it using the mysql client.

I also added void screening to the customer statement in https://github.com/braathwaate/frontac24/blob/master/rep108.php.  You could try replacing your core/rep/rep108.php with this file.  However, it is just a wild guess at this point that it would work.

Wild guess: maybe the customer statement report should screen voided transactions like the other customer balance methods mentioned?

217

(5 replies, posted in Reporting)

To see undelivered orders, try "Sales->Delivery against Sales Orders".  To see detail for a given order, click on the order number.

To see more than 10, click on Preferences and set Query Page size.

For a report, you made need to create a report extension, which is not difficult to do, by copying an existing report and modifying it to your liking.   I had to create a "Deliveries Picklist" report for my purpose.

218

(1 replies, posted in Accounts Receivable)

In vanilla FA, I believe you can configure the number of items by changing  core/config.default.php:

    $max_rows_in_search = 10;

For next page, you would have to change the code, such as is done in https://github.com/braathwaate/frontac24/commit/5bf114b9fe1974331709e18e7d13c337ba939716.

219

(5 replies, posted in Accounts Receivable)

Yes, void the delivery to edit the sales order and then redo the delivery.

Void is the only way.

Note that FA allows you to change the sales order after delivery/invoicing, but these changes are not reflected in the delivery/invoice.

220

(5 replies, posted in Accounts Receivable)

You can void the invoice, then void the delivery, then edit the sales order, then deliver again, then invoice again.

221

(12 replies, posted in Report Bugs here)

Are you making a deposit using the "bank deposit" function and selecting "customer"?  If so, this is the bug I pointed out earlier, because a deposit from a customer is essentially a customer payment.

222

(12 replies, posted in Report Bugs here)

This is done in the extension,  https://github.com/braathwaate/FA24extensions/blob/master/Extensions/bank_gl_inquiry/bank_gl_inquiry.php.  Look for the call to get_dimension_string().

223

(12 replies, posted in Report Bugs here)

My opinion is that it is a bug for those who use dimensions.

See pull request https://github.com/FrontAccountingERP/FA/pull/32.

Without dimension on payments, the gl A/R account for a dimension will rise ad infinitum as sales and payments are made.   The A/R account for a dimension is also needed in cash basis accounting by dimension, as I point out in https://frontaccounting.com/punbb/viewtopic.php?id=6747.

I didn't know it changed, but to show them,

sales/includes/db/cust_trans_db.inc
function get_sql_for_customer_inquiry

Change line 351 to:

    // exclude voided transactions :
            ." AND ISNULL(v.date_)"
        // exclude self-balancing (journal) transactions:

      ." AND (trans.type = " . ST_SALESINVOICE . "
            OR (trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount) != 0)";

225

(5 replies, posted in Accounts Receivable)

Net 30 is fine.  Check your Setup->Payment terms to make sure "due after days" is 30.   Make sure that Net 30 is selected in Payment Terms on your delivery.