26

(20 replies, posted in Accounts Receivable)

sorry to take so long on this just saw this

this one is a little more involved so do this.
if you need I can make a branch of the repo to see the changes, so let me know.

in 'sales/inquiry/sales_orders_view.php' do much like you did before. create a copy function and paste it near the edit function about line 115 in the page

function copy_link($row) 
{
    global $page_nested;

  return pager_link(_("Copy Order") ,
      "/sales/sales_order_entry.php?CopyOrder=". $row['order_no'], ICON_DOC); 
}

then in that same file call it in the salesorder if statement around line 330 at the end of the file. (you could add it to other vues on the page if desired. the changed elseif should look like this. NOTE: it has the closing bracket from the last elseif above.

} elseif ($trans_type == ST_SALESORDER) {
     array_append($cols,array(
            _("Tmpl") => array('insert'=>true, 'fun'=>'tmpl_checkbox'),
                    array('insert'=>true, 'fun'=>'edit_link'),
                    array('insert'=>true, 'fun'=>'copy_link'),
                    array('insert'=>true, 'fun'=>'dispatch_link'),
                    array('insert'=>true, 'fun'=>'prt_link')));
};

Now the problem is the cart doesn't support copying orders like it did on deliveries/invoices. so we will add it.
in file 'sales/sales_order_entry.php' in the top array about line 36 add a CopyOrder type. the finished array should look like this.

    array(    'NewOrder' => 'SA_SALESORDER',
            'CopyOrder' => 'SA_SALESORDER',
            'ModifyOrderNumber' => 'SA_SALESORDER',
            'AddedID' => 'SA_SALESORDER',
            'UpdatedID' => 'SA_SALESORDER',
            'NewQuotation' => 'SA_SALESQUOTE',
            'ModifyQuotationNumber' => 'SA_SALESQUOTE',
            'NewQuoteToSalesOrder' => 'SA_SALESQUOTE',
            'AddedQU' => 'SA_SALESQUOTE',
            'UpdatedQU' => 'SA_SALESQUOTE',
            'NewDelivery' => 'SA_SALESDELIVERY',
            'AddedDN' => 'SA_SALESDELIVERY', 
            'NewInvoice' => 'SA_SALESINVOICE',
            'AddedDI' => 'SA_SALESINVOICE'
            )

in the same file the function create_cart() needs to be modified to allow this new 'CopyOrder' type to pass as a template. change the function to look like this

function create_cart($type, $trans_no)
{ 
    global $Refs, $SysPrefs;

    if (!$SysPrefs->db_ok) // create_cart is called before page() where the check is done
        return;

    processing_start();

    if (isset($_GET['NewQuoteToSalesOrder']))
    {
        $trans_no = $_GET['NewQuoteToSalesOrder'];
        $doc = new Cart(ST_SALESQUOTE, $trans_no, true);
        $doc->Comments = _("Sales Quotation") . " # " . $trans_no;
        $_SESSION['Items'] = $doc;
    }    
  elseif(($type != ST_SALESORDER || isset($_GET['CopyOrder'])) && $type != ST_SALESQUOTE && $trans_no != 0) { // this is template

        $doc = new Cart(ST_SALESORDER, array($trans_no));
        $doc->trans_type = $type;
        $doc->trans_no = 0;
        $doc->document_date = new_doc_date();
        if ($type == ST_SALESINVOICE) {
            $doc->due_date = get_invoice_duedate($doc->payment, $doc->document_date);
            $doc->pos = get_sales_point(user_pos());
        } else
            $doc->due_date = $doc->document_date;
        $doc->reference = $Refs->get_next($doc->trans_type, null, array('date' => Today()));
        //$doc->Comments='';
        foreach($doc->line_items as $line_no => $line) {
            $doc->line_items[$line_no]->qty_done = 0;
        }
        $_SESSION['Items'] = $doc;
    } else
        $_SESSION['Items'] = new Cart($type, array($trans_no));
    copy_from_cart();
}

@apmuthu and @joe
here is an idea though I dont think it should be in core. People can already template an order and copy invoices and deliveries. if you copy or direct deliver you will get a delivery ref number and that could be used for an api unique ID. Or if you have to use an order could you not use the order# already?

27

(20 replies, posted in Accounts Receivable)

That should only be on direct invoice the direct delivery gets an auto for ref but the invoice gets the next number.
That is normal behavior when you skip the delivery step. if you copy the delivery it will get a ref number than invoice against that invoice.

28

(2 replies, posted in Wish List)

I saw this review as well. I would like to propose a change to the customer search to be able to search phone numbers and emails. I often get texts from clients and I am unclear as to whom i'm speaking with, or when scheduling delivery note, I forget who it was. I added all crm fields in the search but didnt include them in the table for fear of clutter. The crm table view does have all those things and looks ok to me. 

change db function get_customers_search in '/sales/includes/db/customers_db.inc' to...

function get_customers_search($customer)
{
    global $SysPrefs;

    if (isset($SysPrefs->max_rows_in_search))
        $limit = $SysPrefs->max_rows_in_search;
    else
        $limit = 10;

  $sql = "SELECT d.debtor_no, d.name, d.debtor_ref, d.address, d.tax_id, 
    p.phone, p.phone2, p.fax, p.email 
    FROM ".TB_PREF."crm_persons p, ".TB_PREF."crm_contacts c,  
    ".TB_PREF."debtors_master d
    WHERE p.id = c.person_id AND c.entity_id = d.debtor_no AND 
          c.type = 'customer' AND
    (      d.name LIKE " . db_escape("%" . $customer. "%") . " OR 
     d.debtor_ref LIKE " . db_escape("%" . $customer. "%") . " OR 
          d.address LIKE " . db_escape("%" . $customer. "%") . " OR 
           d.tax_id LIKE " . db_escape("%" . $customer. "%")." OR
            p.phone LIKE " . db_escape("%" . $customer. "%") . " OR 
           p.phone2 LIKE " . db_escape("%" . $customer. "%") . " OR 
              p.fax LIKE " . db_escape("%" . $customer. "%") . " OR 
            p.email LIKE " . db_escape("%" . $customer. "%").")
      ORDER BY name LIMIT 0,".(int)($limit);

    return db_query($sql, "Failed in retreiving customer list.");
}

add fields to table header and cells in '/sales/inquiry/customers_list.php' to have at least phone and email
Header array $th

$th = array("", _("Customer"), _("Short Name"), _("Address"), _("Tax ID"), _("Phone"), _("Email"));

Cell contents add email and phone

      label_cell($myrow["name"]);
      label_cell($myrow["debtor_ref"]);
      label_cell($myrow["address"]);
      label_cell($myrow["tax_id"]);
      label_cell($myrow["phone"]);
      label_cell($myrow["email"]);

@joe and @ apmuthu
?

29

(1 replies, posted in Setup)

Sounds like your accounts won't balance?
retained earnings are usually an equity type of account is account class set in a way you won't balance out when closing your temporary accounts like revenue and expenses?

Here is how I would do it this is a working example on BANKPAYMENT ONLY you would have to do all the cases that you want recorded. ie. fetch that original trans type prior to void, then append data you need to memo.

in ./admin/db/voiding_db.inc:function void_transaction($type, $type_no, $date_, $memo_)
change case ST_BANKPAYMENT to appear like this.

        case ST_BANKPAYMENT : // it's a payment
            if (!exists_bank_trans($type, $type_no))
                return _('Selected transaction does not exists.');
                  $original_trans = db_fetch(get_bank_trans($type, $type_no));
                  $memo_ = $memo_."\nOriginal Amt: ".$original_trans['amount'];
            void_bank_trans($type, $type_no);
            break;

I've tested this and it works adding it to both the voided table and the audit_trail table
Unfortunatly the audit_trail report doesnt include the description in the report but that could be easily added.

I can think of two work arounds for this a dirty way and a better way

dirty way
create a log entry in the function when voided

better way
enter the original amount in the memo to post to audit_trail 'description' and voided 'memo_' in the database

here is the name and location of the void function that you need to do the work. append the original amount to the memo_

./admin/db/voiding_db.inc:function void_transaction($type, $type_no, $date_, $memo_)

here are locations where it is doing the 'Document reentered.' memo specifically

./purchasing/includes/db/invoice_db.inc:        void_transaction($trans_type, $trans_no, $supp_trans->tran_date, _("Document reentered."));
./gl/includes/db/gl_db_banking.inc:    void_transaction(ST_BANKTRANSFER, $trans_no, $date_, _("Document reentered."));
./gl/includes/db/gl_db_banking.inc:        $msg = void_transaction($trans_type, $old_trans, $date_, _("Document reentered."));
./gl/includes/db/gl_journal.inc:        $msg = void_transaction($trans_type, $cart->order_id, Today(), _("Document reentered."));

32

(20 replies, posted in Accounts Receivable)

CAUTION
I just want to give a heads up for people using this.

If you have a client that you have updated the mailing address and you use this copy invoice or delivery. IT WILL NOT HAVE THE NEW ADDRESS. It will copy the mailing address from the prior order so, take caution.

While the order is open you can press F3 to open the branch & verify the current mailing address on file to be safe

Otherwise I have been using daily with no other notes.

function 'get_customer_details' in '/sales/includes/db/customers_db.inc/'

is not counting type ST_JOURNAL or ST_BANKPAYMENT in the calculation for credit for sales orders giving a different result in customer_inquiry balance.

If you would like to add the link and QR to your invoices etc make these changes to core

in "/includes/ui/ui_view.inc" change "if (!isset($payment_services))" to this

if (!isset($payment_services))
{
  $fa_url = "https://".$_SERVER['HTTP_HOST'].strtok($_SERVER['REQUEST_URI'], '?');
  $fa_url = str_replace('/reporting/reports_main.php', '', $fa_url );

  $payment_services = array(
    'PayPal' => "https://www.paypal.com/xclick?business=<company_email>&item_name=<comment>&amount<amount>&currency_code=<currency>",
    'StrikeOut' => $fa_url."/modules/strikeout/pay/?co=<company_no>&amount=<amount>&custId=<reference>",
    'XUMM XRP' => "https://xumm.app/detect/request:{{account}}?amount=<amount>"
  );
}

in "/reporting/includes/doctext.inc" change "if (@$this->formData['payment_service'])" function to this to enable new variables and qr code generation.

    if (@$this->formData['payment_service'])    //payment link
    {
        $amt = number_format($this->formData["ov_freight"] + $this->formData["ov_gst"] + $this->formData["ov_amount"], user_price_dec());
        $service = $this->formData['payment_service'];
        $url = payment_link($service, array(
            'company_email' => $this->company['email'],
            'amount' => $amt,
            'company_no' => user_company(),
            'document_number' => $this->formData['document_number'],
            'currency' => $this->formData['curr_code'],
            'trans_no' => $this->formData['trans_no'],
            'type' => $this->formData['type'],
            'tax_id' => $this->formData['tax_id'],
            'reference' => $this->formData['reference'],
            'comment' => $this->title . " " . $this->formData['reference']
            ));
    $Footer[_("You can pay through"). " $service: "] = "$url";

    if (file_exists("../modules/strikeout/pay/inc/phpqrcode/qrlib.php"))
    {
      include_once("../modules/strikeout/pay/inc/phpqrcode/qrlib.php"); 
        $tmp_file = company_path(). "/pdf_files/". random_id().".png";
        QRcode::png($url, $tmp_file, QR_ECLEVEL_L, 3);
        $this->Image($tmp_file,486,670,100,100);
    }
    }

I have created a payment integration module for frontaccounting called 'strikeout' this was released as a standalone webapp before but decided to make it a direct FA extension

Currently it does 4 methods 1 more coming soon
Pick and choose the methods to enable

Strike (Standard Bitcoin and Bitcoin Lightning invoices) Custodial* Requires Account
Accept bitcoin tx and newer 2017+ lightning (instant global settlement) as the asset or home currency with 0 fees to merchant. Receiving home currency is nice if you don't want to account inventory and capital gains/losses of asset just accept payment. compatiable with all bitcoin wallets including cash app

PayPal (Venmo, PayPal, Afterpay?, & credit cards) Custodial* Requires Account
Popular payment platform that most know

LNbits (Bitcoin Lightning) Non custodial* no account needed can host at home or a friend/family
Accept bitcoin instantly with no banks automatically generate invoices at the time of payment valued at the home currency. all kinds of plugins to trigger actions automatically like spit payroll, convert asset, trigger vending machines. etc

Stripe (Cash APP, EFT, credit cards) Custodial* Requires Account
Another popular payment platform that most know, slightly better on fees and I think a little better than paypal.

BTCPayServer (Standard Bitcoin and Bitcoin Lightning invoices) coming soon* Non custodial* no account needed dont even need to host
Another opensource platform geared towards vendors even has plugins for many webstores big thing here is you can be non custodial without even hosting your it. (standard bitcoin only lightning requires you to host) It has plugins for adding other crypto assets like USDT (digital security version of USD ie. a stable coin) though nothing other than Bitcoin has lots liquidity and is truly censorship resistant.

All platforms will auto enter fa payments and fees if applicable to the gl accounts you set for each for bitcoin there is a choice to inventory.

current limitations/things to do (This is unfinished software)
Clients fees/discounts: are not enabled yet you can enter them for each method but they will not change invoiced amount yet

Currencies: Currently I have it set to USD and BTC for currency this can be changed in code but will add it to the options soon

Fiscal year: if there isnt a fiscal year that matches the date of payment it will create a fiscal year Jan 1st to Dec 31st Pre your create future years to prevent this if you dont do cal year for fiscal year

payment refs: currently it is doing a date for the payment ref num not your preference.

Payment link: This will need to be added to core to support. I have it generating QR's and links on invoices but core payment link is a little odd (unfinished) I might create some custom included reports with the link already enabled (statements, invoices, deliveries etc) @

You can find it in my FA-EXT github here strikeout fork download it in modules and set the methods up api keys etc.

https://github.com/trafficpest/FA24ext … strikeout

I dont have documentation but most of the standalone strikeout wiki docs apply

https://github.com/trafficpest/strikeout/wiki

Oh I am not sure, I never even noticed it. Looks like it calculates differently to make sure the balance sheet will balance and only allows you to do it with journal quick entries? Here is all the code I could find quickly that is ran when it is enabled.

/includes/ui/ui_view.inc

        // quick entry made on account balance is special case.
        if ($qe['bal_type'] == 1) // if this is quick entry based on balance - calculate it
        {
            // Note, that this is ugly hack overriding standard field usage 
            // just to make the feature available between major FA releases!
            $gl_code = $qe['base_desc'];
            $monthly = $qe['base_amount'] == 1.0;

            if (!isset($date))
                $date = Today();

            if ($monthly) // marked as monthly
                $begin = begin_month($date);
            else
            {
                if (is_account_balancesheet($gl_code)) // total
                    $begin = "";
                else
                    $begin = begin_fiscalyear(); // from fiscalyear begin
            }
            $base = get_gl_trans_from_to($begin, $date, $gl_code);

        }

/gl/includes/ui/gl_journal_ui.inc

        if ($qid['bal_type'] == 1)
        {
            $accname = get_gl_account_name($qid['base_desc']);
            label_row(($qid['base_amount'] == 0 ? _("Yearly") : _("Monthly")) . " ". _("balance from account")." ".
                $qid['base_desc']." ".$accname."&nbsp;&nbsp;".submit('go', _("Go"), false, false, true),'', "colspan=2");
        }

/gl/manage/gl_quick_entries.php

    if ($bal_type == 1 && $_POST['type'] != QE_JOURNAL)
    {
        display_error( _("You can only use Balance Based together with Journal Entries."));
        set_focus('base_desc');
        return false;
    }

/gl/manage/gl_quick_entries.php

if (get_post('type') == QE_JOURNAL && get_post('bal_type') == 1)
{
    yesno_list_row(_("Period"), 'base_amount', null, _("Monthly"), _("Yearly"));
    gl_all_accounts_list_row(_("Account"), 'base_desc', null, true);
}

Look here for info on quick entry

https://frontaccounting.com/fawiki/inde … amp;lang=C

You set preset double entries for common transactions to speed up time and make errors less common.

I don't use it much. I use it for payments that are owner draws to to a equity or payments I do often enough. but dont need to track supplier tx/ payable balance just debit the appropriate acct, etc. It works for deposits too but I haven't done that.

If doing a Direct Supplier Invoice (I think what you are talking about)
while creating you can click F2 to add supplier if needed or F4 to add a new inventory item if needed.

Hot keys will be shown on the bottom right of a window

39

(20 replies, posted in Accounts Receivable)

It will auto create a new sales order for you.
It works on delivery or invoice both will make an new order for you.
Im guessing you get a order and schedule a delivery?

40

(20 replies, posted in Accounts Receivable)

Ok so how I just did it is like this...

edit in file "/sales/inquiry/customer_inquiry.php"

add this copy function around the other link functions like "edit link"

function copy_link($row)
{
    global $page_nested;

    if ($page_nested)
        return '';
  if ($row['type'] == ST_CUSTDELIVERY)
    return pager_link(_('Copy Delivery'), "/sales/sales_order_entry.php?NewDelivery=" 
      .$row['order_'], ICON_DOC);
  else if ($row['type'] == ST_SALESINVOICE)
    return pager_link(_("Copy Invoice") ,
    "/sales/sales_order_entry.php?NewInvoice=". $row['order_'], ICON_DOC);
}

then add "array('insert'=>true, 'fun'=>'copy_link')," $cols array at the bottom of the page my finished $cols looks like this

$cols = array(
    _("Type") => array('fun'=>'systype_name', 'ord'=>''),
    _("#") => array('fun'=>'trans_view', 'ord'=>'', 'align'=>'right'),
    _("Order") => array('fun'=>'order_view', 'align'=>'right'), 
    _("Reference"), 
    _("Date") => array('name'=>'tran_date', 'type'=>'date', 'ord'=>'desc'),
    _("Due Date") => array('type'=>'date', 'fun'=>'due_date'),
    _("Customer") => array('ord'=>''), 
    _("Branch") => array('ord'=>''), 
    _("Currency") => array('align'=>'center'),
    _("Amount") => array('align'=>'right', 'fun'=>'fmt_amount'), 
    _("Balance") => array('align'=>'right', 'type'=>'amount'),
        array('insert'=>true, 'fun'=>'gl_view'),
        array('insert'=>true, 'fun'=>'edit_link'),
        array('insert'=>true, 'fun'=>'copy_link'),
        array('insert'=>true, 'fun'=>'credit_link'),
        array('insert'=>true, 'fun'=>'prt_link')
    );

@apmuthu and @joe
this is a simple change and would probably be handy for many people. I would consider adding it to core if you dont think it clutters the table to much.

41

(20 replies, posted in Accounts Receivable)

Ok So it does what you want but with the extra step "create template" and you want to copy a new order right away right?

the "Cart" of an order can be copied by adding the order # to the url like so

https://{your-url}/sales/sales_order_entry.php?NewDelivery=0 (this is the direct delivery url)
Change the 0 to the order with the cart you want to copy.

'NewDelivery' is for direct deliveries
'NewInvoice' is for direct invoice

If I wanted to make this a super easy single click I would add a copy link to the table of the page you like to look at past orders like the Customer Transaction Inquiry

42

(16 replies, posted in Report Bugs here)

So its working out now? It is a pretty old plugin, and looks like php has changed to be quite a bit more strict recently.
downgrade php or upgrade FA are best bets

43

(20 replies, posted in Accounts Receivable)

Sounds like FA does exactly what you want.
make a template for the client from a sales order / invoice. Then Template delivery or invoice depending on your sales flow.

Do it like this
make a sales order, direct delivery, or direct invoice then--> open 'sales order inquiry' and set 'tmpl' checkbox

After that anytime you want to recreate it do Template Delivery or Template Invoice

You can also make it recurrent and it will remind you to create it at a years time but I dont like how the UI Select only has the order number in the drop down list and not the customer or branch so I usually don't do this since it takes time to reference.

44

(40 replies, posted in Reporting)

I tested it and it works in my install (though it worked for me prior to the fix)
I have created a mail branch in my extensions repo again with the fix.


https://github.com/trafficpest/FA24ex … tree/mail


@apmuthu I didn't forget to hash the files for init this time if you want to pull such a trivial fix. lol

45

(40 replies, posted in Reporting)

OK, I checked it out for you. (mind you this is not my plugin. So Im just looking through code.)

Looks like there is a typo in class.mail.inc line 131 must be some versions of php will allow defining outside of the class while others do not. (like your 3rd server) I works on mine running PHP 8.0.30

the line should read

$this->phpmailer->CharSet = $this->charset;

Im guessing that should fix it. Let me know

I have added delivery note with shipper info on the ticket on the bottom left of the note
Find it in the route_deliveries branch below

https://github.com/trafficpest/FA24exte … Extensions

copy rep_route_deliveries_no_ship to your modules and activate it.

I haven't tested it let me know if it needs anything

Is she asking about adding the Shipping Company name(Delivery Person)? I was thinking about adding this to the route delivery report extension.

Currently you can filter by shipping company and print it out but was thinking to put the shipping company/ Person as well. This would be good for service company clients to be aware of who performed the service. In some industries it is required by law even.

I think I will add the clients number on the note as well for the delivery driver.

48

(40 replies, posted in Reporting)

Ok I pushed it to my fork in the mail branch of my repo and made a pull request for @apmuthu repo
you can find it here

https://github.com/trafficpest/FA24extensions/tree/mail

49

(40 replies, posted in Reporting)

oh good catch! I didn't even notice that.

In the new file in the function pass the $filename then add the check if it is passed like the old version then pass it to 2nd argument in phpmailer addAttachement function. In the end the function should be this

public function attachment($file, $filename=null) {
  if (!isset($filename))
    $filename = basename($file);
  $this->phpmailer->addAttachment($file, $filename);
}

50

(40 replies, posted in Reporting)

Have you tried the FA PHPMailer extension labeled "mail"? it works really good

here it is
https://github.com/apmuthu/FA24extensio … sions/mail

only drag is you have to replace "class.mail.inc" in core with the provided one to make it work. So it will break with updates. This is why I think it should become core even if as an option.