1

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

apmuthu wrote:

A screenshot of how it now appears would be useful.

The pre tag should have the same effect. What browser and version are you using?
If the description has malicious code, it could compromise the output.

The pre tag also exists in the core code (from lines in FA 2.3):

Line 1379: includes/ui/ui_view.php
Line  57: includes/db/connect_db.inc

Here is the screenshot of how it appears after I removed the code that was causing the problem.
https://drive.google.com/open?id=0B6yNa5cxS_7HV2xnR3JTTUN1MU0

I am using Chrome Version 59.0.3071.104 (Official Build) (64-bit)

As you can see from the text that was used as my sample text, there isn't anything in there other than just a message, no random code used.

Not sure why the pre was causing the problem but once it was removed from that part of the code it formatted correctly. I think it has to do with how it was placed in the code in the quotation marks?   That's been the only area where I have had issues with the formatting.

2

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

Oh my, I am persistent if nothing else.  I found where the issue was coming from!

In file /modules/dashboard/widgets/reminders.php

Original code at line 67

 label_cell("<pre>".$myrow["description"]."</pre>",$extra);

Removed

 "<pre>"

and

"</pre>"

so it is now changed to

label_cell($myrow["description"], $extra);

I also had to make the same change at line 95 to /modules/dashboard/widgets/reminders_setup.php

3

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

Ok, I have removed all my customization, it was only 2 additional widgets that were added and the problem still exists with the original module and theme.  I have tired playing with the css file all day today and every change I made in the css file didn't make any change in the theme at all.  Maybe I am working with the wrong css file.  I was trying to edit default.css in the dashboard theme file.  At this point I am at a complete lost.  Please help smile

4

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

Never mind, the formatting is still messed up in the main company file as well.  I just had started new lines just to keep the message from running off the screen.

5

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

OK, when I go to my main company to uninstall this module and theme everything it working perfect.  It's when I go into one of my other company files that it doesn't format right.  What may be causing that it to only effect all my other companies and not the main company file?

6

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

apmuthu wrote:

Looks like the css should have wrap enabled (nowrap disabled).

Since you are using a customised dashboard, you will need to first see what differences there are between the original and your customised one when the customisation was done. The original one itself may have had the bugs and then got rectified in the mainstream itself. It is possible that the customisation may have been done in the core files as well.

The original Dashboard theme and extension are available in my repo.

Ok, where would I find this.  The customization that was done was only adding 2 different reports to show up and that was created by the author of this module.

I just ran a compare plugin to check everything and the css file is identical to the one in your repo.  Checked the widget codes along with all the rest of the basic files with this theme and module..  I think I'll try uninstalling it and reinstalling.  maybe something will correct it's self there.

7

(4 replies, posted in Reporting)

I use Dimensions for something similar to what you are wanting to do.  The key is when you set up the items in your system, you set the dimensions.

For example, I have an expense called tolls and I need to track how much each of my trucks has spent in tolls.  So what I have done is created an item for tolls that is specific to each truck.  Item code is TOA1234 and in the item screen you can assign that item to a specific dimension.  It might be a pain later on when I start getting to 20 or even 50 trucks to have 50 different item numbers for each item I need to separate out, but by having a simple stream line way of creating the item codes anyone can figure out which time goes to who.  I also have a corresponding account for each truck as well.

Now when I run a profit and loss report and select one of the dimensions, I am able to get a breakdown for that specific truck.

Now there might be a better way to use dimensions than how I use it now, but so far this was the best way I could come up with.

8

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

I am having an issue with the dashboard module.  I am using FA 2.3.25 on my system right now.  The creator of the module made some modifications for me a year or so back and I can't find his contact info to ask him this question.

Anyways, when I am using the reminders, if I time a really long message as a new reminder, instead of text wrapping it just continues off the screen.  How do I fix this?

I am trying to put a screen shot on here but I am not sure how.  Here's a link to the screen shot I took.

https://drive.google.com/file/d/0B6yNa5 … sp=sharing

9

(1 replies, posted in Items and Inventory)

Have a situation where a client has there item number for a product but there customers have a different item number and they need to be able to look it up either way.  Issue is they have 3000 different costumers and they need the list of product numbers specific to each customer show up in the item drop down on the sales orders as well as there own internal item number.

Example, company has item number 1234 but for customer 1 there item number is abcd, customer 2 is 4xyz, and customer 3 is 987cba. My client needs to be able to select the customer in the sales screen and either search or see only the items numbers for that specific customer as well as the client's own internal item number.

Any idea of how to make this work or will I need to do a custom code work?

myhandgunpursedotcom wrote:
apmuthu wrote:

Sales Prices and currency for items (stock_id) are stored in the prices table.
Suppliers Prices for items (stock_id along with suppliers UoM and conversion factor) are stored in purch_data table.
The above are used when looking up the fields in the sales and purchase order/invoice forms.
The actual price used for the specific invoice's item is stored in the sales_order_details  and purch_order_details tables respectively.

Hence the closed PO's and Invoices will not have their prices altered when the items' sales and purchase prices vary at the item's lookup tables for sale and purchase.

Unless your most recent purchase item cost is entered against the supplier's list of items on that date, it will not be the one looked up thereafter.

That's what I thought, but for some reason nothing auto populates in my po's when I select the item. I have to enter the price manually every time. Where is the function that calls the info so I can check it and name sure it is correct?

Nevermind.  I figured out why it wasn't working.  I had a completely unrelated issue and turned debug mode on.  Found I had a few errors in that PO module.  Once I fixed those issues it started pulling the price from the purchasing pricing screen smile  Me very happy now!

I love that debug feature in the config.php file.  It has been a life saver!

apmuthu wrote:

Sales Prices and currency for items (stock_id) are stored in the prices table.
Suppliers Prices for items (stock_id along with suppliers UoM and conversion factor) are stored in purch_data table.
The above are used when looking up the fields in the sales and purchase order/invoice forms.
The actual price used for the specific invoice's item is stored in the sales_order_details  and purch_order_details tables respectively.

Hence the closed PO's and Invoices will not have their prices altered when the items' sales and purchase prices vary at the item's lookup tables for sale and purchase.

Unless your most recent purchase item cost is entered against the supplier's list of items on that date, it will not be the one looked up thereafter.

That's what I thought, but for some reason nothing auto populates in my po's when I select the item. I have to enter the price manually every time. Where is the function that calls the info so I can check it and name sure it is correct?

I am trying to figure out how to get the "Price After Tax" in the purchase orders to automatically pull the most recent purchase from from the Purchasing Pricing section for an item type Service.  For example, when I purchase fuel I want it to populate the price for me because my fuel cost per gallon is a fixed amount each quarter.

Is there a way to do this in the PO?  All my items are set up as service items because I don't keep inventory and my business is a service business anyways.

I guess my other question with this is when I update the price each quarter, will this change the price for all of the closed PO's as well or will they keep the price that it was at when the PO was created?

I guess another question I have is I have made a lot of modifications to the core and hard coding changes to FA.  Is there a way to take what I have done and turn it into a module or way to package it up so when an update to FA comes along I won't be pulling my hair out trying to redo all the modifications I have created?

apmuthu wrote:

Your navigation:

Sales -> Invoice Against Sales Delivery

will yield a url like:

http://localhost/sales/inquiry/sales_deliveries_view.php?OutstandingOnly=1

The file sales/inquiry/sales_deliveries_view.php calls the function get_sql_for_sales_deliveries_view() defined in sales/includes/db/cust_trans_db.inc just before assigning the array of column headings to $cols.

Edit the SQL in the said function to include the Ship_From field and adjust the $cols for the heading (either by hardcoding or as gettext translation string in .po/.mo).

Wow, that was so easy to do.  Thank you for all the help.

On a side note though, by making that change to the function get_sql_for_sales_deliveries_view() defined in sales/includes/db/cust_trans_db.inc it now allows me to batch invoice deliveries from the same customer but different branches.  If I process the invoice will that mess up the transactions in the GL or any of the other accounts?  I guess I could make a quick backup of the db and then create the batch invoice and see what happens.  Just was curious if there was something in the deep background that might get messed up with that invoice if I did that.

apmuthu wrote:

You are trying to change the heading label - it has nothing to do with the actual field from where it comes. The type array element is for formatting the column and also has nothing to do with the contents of any table's field.

Anything like: _("string") is shortform for gettext("string") and is changed by changing the *.po file and compiling it as *.mo file using msgfmt. Refer the Translations page in the Wiki.

To achieve what you want, pick out the strings that are affected and then trace the translation strings in the appropriate .po file and edit them in a text editor using "No BOM" format and then compile it it as the *.mo file and replace it in the fa install.

Ok, I think I didn't explain what I was trying to do that well.

What I am want to do is instead of the Branch information being shown in the branch column, have it pull from my DB the Ship From information instead.  I did that with the Sales Order Search page, but I can't figure out how to do that with the Invoice Against Deliveries page.

Here is what the page looks like now

Here is what I want to change

Here is how I changed the data in the search sales order page

Need some help getting pointed in the direction for where the code is that determines what data is pulled from the database.

What I am trying to do is change the "Branch" column to show my new "Ship From" data.  Now I can change the column heading all day long, what I can't figure out is where to change the data that's being called up.  I was able to make it change in the "Sales Order Inquiry" to where it shows the "Ship From" data from my database.  After I made that change this afternoon, I forgot how I did it have been trying to figure that out as well so I could do the same thing for the "Invoice Against Sales Delivery".

I see in sales/inquiry/sales_deliveries_view.php where it calls the sql and the sets up the columns, but I can't find where it calls the data from the database.

$sql = get_sql_for_sales_deliveries_view($selected_customer, $selected_stock_item, $_POST['customer_id']);

$cols = array(
        _("Delivery #") => array('fun'=>'trans_view'),
        _("Customer"),
        'branch_code' => 'skip',
        _("Branch") => array('ord'=>''),
        //_("Ship From") => array('type' => 'ship_from' , 'ord' => '') , This is a line I added, but is commented out right now.  I know if I comment out the line above and uncomment this one I can change the column title.
        _("Deliver To"),
        _("Reference"),
        _("Cust Ref"),
        _("Delivery Date") => array('type'=>'date', 'ord'=>''),
        _("Due By") => 'date',
        _("Delivery Total") => array('type'=>'amount', 'ord'=>''),
        _("Currency") => array('align'=>'center'),
        submit('BatchInvoice',_("Batch"), false, _("Batch Invoicing"))
            => array('insert'=>true, 'fun'=>'batch_checkbox', 'align'=>'center'),
        array('insert'=>true, 'fun'=>'edit_link'),
        array('insert'=>true, 'fun'=>'invoice_link'),
        array('insert'=>true, 'fun'=>'prt_link')
);

Thank you for the help in this!

17

(26 replies, posted in FA Modifications)

apmuthu wrote:

The order of the inserted fields must match the order of the values to be inserted in them.
Your first bold SQL code entry:

        order_type, ship_via, deliver_to, delivery_address, contact_phone, shipper_address, ship_from,

should be:

        order_type, ship_via, deliver_to, delivery_address, shipper_address, ship_from, contact_phone,

Thank you so much.  I knew I was missing something really really simple.  That was all that was wrong.  Thank you again!!!!

18

(26 replies, posted in FA Modifications)

So I turned some of the debug options on in the config.php file and when I entered a new sales order here is the error I got.

Undefined index: Ship_from in file: /hermes/bosnaweb03a/b240/dom.abintra2012/james/accounting/sales/sales_order_entry.php at line 277
/hermes/bosnaweb03a/b240/dom.abintra2012/james/accounting/sales/sales_order_entry.php:352:    copy_to_cart()
/hermes/bosnaweb03a/b240/dom.abintra2012/james/accounting/sales/sales_order_entry.php:458:    can_process()

not sure what any of this means now, but I hope it helps.

19

(26 replies, posted in FA Modifications)

apmuthu wrote:

Add the necessary fields values into the function add_sales_order() in sales/includes/db/sales_order_db.inc.

Ok, I attempted to do what you suggested and it still won't write anything to the db.  Here is what I edited.  Maybe you can tell me what I did wrong.  Thanks

I am adding "shipper_address" and "ship_from".  Those are the two fields I am adding to the db and to the sales order.  Below is the add sales order function from the sales/includes/db/sales_order_db.inc that I am trying to modify.

function add_sales_order(&$order)
{
    global $loc_notification, $path_to_root, $Refs;

    begin_transaction();
    hook_db_prewrite($order, $order->trans_type);
    $order_no = get_next_trans_no($order->trans_type);
    $del_date = date2sql($order->due_date);
    $order_type = 0; // this is default on new order
    $total = $order->get_trans_total();
    $sql = "INSERT INTO ".TB_PREF."sales_orders (order_no, type, debtor_no, trans_type, branch_code, customer_ref, reference, comments, ord_date,
        order_type, ship_via, deliver_to, delivery_address, contact_phone, shipper_address, ship_from,
        freight_cost, from_stk_loc, delivery_date, payment_terms, total)
        VALUES (" .db_escape($order_no) . "," .db_escape($order_type) . "," . db_escape($order->customer_id) .
         ", " .db_escape($order->trans_type) . "," .db_escape($order->Branch) . ", ".
            db_escape($order->cust_ref) .",".
            db_escape($order->reference) .",".
            db_escape($order->Comments) .",'" .
            date2sql($order->document_date) . "', " .
            db_escape($order->sales_type) . ", " .
            db_escape($order->ship_via)."," .
            db_escape($order->deliver_to) . "," .
            db_escape($order->delivery_address) . ", " .
            db_escape($order->shipper_address) . ", ".
              db_escape($order->ship_from) . ", ".

            db_escape($order->phone) . ", " .
            db_escape($order->freight_cost) .", " .
            db_escape($order->Location) .", " .
            db_escape($del_date) . "," .
            db_escape($order->payment) . "," .
            db_escape($total). ")";

    db_query($sql, "order Cannot be Added");

    $order->trans_no = array($order_no=>0);

    if ($loc_notification == 1)
    {
        include_once($path_to_root . "/inventory/includes/inventory_db.inc");
        $st_ids = array();
        $st_names = array();
        $st_num = array();
        $st_reorder = array();
    }
    foreach ($order->line_items as $line)
    {
        if ($loc_notification == 1 && is_inventory_item($line->stock_id))
            $loc = calculate_reorder_level($order->Location, $line, $st_ids, $st_names, $st_num, $st_reorder);

        $sql = "INSERT INTO ".TB_PREF."sales_order_details (order_no, trans_type, stk_code, description, unit_price, quantity, discount_percent) VALUES (";
        $sql .= $order_no . ",".$order->trans_type .
                ",".db_escape($line->stock_id).", "
                .db_escape($line->item_description).", $line->price,
                $line->quantity,
                $line->discount_percent)";
        db_query($sql, "order Details Cannot be Added");

    // Now mark quotation line as processed
        if ($order->trans_type == ST_SALESORDER && $line->src_id)
            update_parent_line(ST_SALESORDER, $line->src_id, $line->qty_dispatched); // clear all the quote despite all or the part was ordered
    } /* inserted line items into sales order details */
    add_audit_trail($order->trans_type, $order_no, $order->document_date);
    $Refs->save($order->trans_type, $order_no, $order->reference);

    hook_db_postwrite($order, $order->trans_type);
    commit_transaction();

    if ($loc_notification == 1 && count($st_ids) > 0)
        send_reorder_email($loc, $st_ids, $st_names, $st_num, $st_reorder);
    return $order_no;
}

Here is the sales/include/ui/sales_order_ui.inc that I modified as well.  I bolded the section that I added below.

function display_delivery_details(&$order)
{
    global $Ajax;

    div_start('delivery');   


    if ($order->payment_terms['cash_sale']) {    // Direct payment sale
        $Ajax->activate('items_table');
        display_heading(_('Cash payment'));
        start_table(TABLESTYLE2, "width='60%'");

        locations_list_row(_("Deliver from Location:"), 'Location', null, false, true);
        if (list_updated('Location'))
            $Ajax->activate('items_table');
        label_row(_("Cash account:"), $order->pos['bank_account_name']);
        textarea_row(_("Comments:"), "Comments", $order->Comments, 31, 5);
        end_table();
        hidden('delivery_date', $order->due_date);
    } else {
        if ($order->trans_type==ST_SALESINVOICE)
        {
            $title = _("Delivery Details");
            $delname = _("Due Date").':';
        }
        elseif ($order->trans_type==ST_CUSTDELIVERY)
        {
            $title = _("Invoice Delivery Details");
            $delname = _("Invoice before").':';
        }
        elseif ($order->trans_type==ST_SALESQUOTE)
        {
            $title = _("Quotation Delivery Details");
            $delname = _("Valid until").':';
        }
        else
        {
            $title = _("Order Delivery Details");
            $delname = _("Required Delivery Date").':';
        }
        display_heading($title);
        start_outer_table(TABLESTYLE2, "width='100%'");
        table_section(1);
       
        text_row(_("Ship From:"), 'ship_from', $order->ship_from, 40, 40,
            _('Additional identifier for delivery e.g. name of receiving person'));

        textarea_row(_("Address:"), 'shipper_address', $order->shipper_address, 35, 5,
            _('Shipper address.'));

           
        table_section(2);

        locations_list_row(_("Deliver from Location:"), 'Location', null, false, true);
        if (list_updated('Location'))
            $Ajax->activate('items_table');


        date_row($delname, 'delivery_date',
            $order->trans_type==ST_SALESORDER ?  _('Enter requested day of delivery')
                : $order->trans_type==ST_SALESQUOTE ? _('Enter Valid until Date') : '');
        text_row(_("Deliver To:"), 'deliver_to', $order->deliver_to, 40, 40,
            _('Additional identifier for delivery e.g. name of receiving person'));

        textarea_row(_("Address:"), 'delivery_address', $order->delivery_address, 35, 5,
            _('Delivery address. Default is address of customer branch'));

        table_section(3);

        text_row(_("Contact Phone Number:"), 'phone', $order->phone, 25, 25,
            _('Phone number of ordering person. Defaults to branch phone number'));
        text_row(_("Customer Reference:"), 'cust_ref', $order->cust_ref, 25, 25,
          _('Customer reference number for this order (if any)'));
        textarea_row(_("Comments:"), "Comments", $order->Comments, 31, 5);

        shippers_list_row(_("Shipping Company:"), 'ship_via', $order->ship_via);

        end_outer_table(1);
    }
    div_end();

And finally here is the sales/sales_order_entry.php that I modified in the function copy_from_cart()

function copy_from_cart()
{
    $cart = &$_SESSION['Items'];
    $_POST['ref'] = $cart->reference;
    $_POST['Comments'] = $cart->Comments;

    $_POST['OrderDate'] = $cart->document_date;
    $_POST['delivery_date'] = $cart->due_date;
    $_POST['cust_ref'] = $cart->cust_ref;
    $_POST['freight_cost'] = price_format($cart->freight_cost);

    $_POST['ship_from'] = $cart->ship_from;
    $_POST['shipper_address'] = $cart->shipper_address;

    $_POST['deliver_to'] = $cart->deliver_to;
    $_POST['delivery_address'] = $cart->delivery_address;
    $_POST['phone'] = $cart->phone;
    $_POST['Location'] = $cart->Location;
    $_POST['ship_via'] = $cart->ship_via;

    $_POST['customer_id'] = $cart->customer_id;

    $_POST['branch_id'] = $cart->Branch;
    $_POST['sales_type'] = $cart->sales_type;
    // POS
    $_POST['payment'] = $cart->payment;
    if ($cart->trans_type!=ST_SALESORDER && $cart->trans_type!=ST_SALESQUOTE) { // 2008-11-12 Joe Hunt
        $_POST['dimension_id'] = $cart->dimension_id;
        $_POST['dimension2_id'] = $cart->dimension2_id;
    }
    $_POST['cart_id'] = $cart->cart_id;
    $_POST['_ex_rate'] = $cart->ex_rate;
}

panchovilla wrote:

Hi.. we have a tax that is calculated on the volume of beverages (0.06 usd/liter) and not on their price. Is there a possibility to configure this kind of tax in FA?

Regards,

Patricio

I have the same issue when I track fuel here in the states. The tax is a per gallon amount and the method @apmuthu suggested wouldn't work either because the price of fuel changes everyday. So my solution for now was to create a separate item for the tax in each state.

Basically I have a total price per gallon that includes that states fuel tax already, so I take that price per gallon and subtract the fuel tax from it since it's a fixed number and create 2 line items on my invoice. One for the net fuel cost and one for the tax per gallon.  It's not the best way, but it seems to work for me now.

21

(11 replies, posted in Items and Inventory)

joe wrote:

I would suggest to put a dimension on the fuel service item. That way you can track the cost of expense.

Or if you are not using the items for that, simple create a quick entry with a dimension included on the transaction.

/Joe

I thought about that, but then I run into issues getting the reports I need for fuel taxes here in the states.  I need to know how many gallons I purchased in each state each month and report that to the respected states.  That's why I am trying hard to find a way for me to run a report that shows the service items, qty purchased, and total.

22

(26 replies, posted in FA Modifications)

I know this topic is kind of old, but I am trying to do something similar.  I need to add 2 fields, ship_to and shipper_address.  I have added the fields into the db table already, _sales_orders.  And I was able to get the fields to show up on the sales order page.  What I can't figure out is how to get the information I type into those fields to be saved in the db.  That is far beyond my skills.  I would appreciate as much help as possible.

The reason for doing this is because of trying to use the batch invoice function.  I have one customer that I bill to, but I pick up and delivery from different locations.  So when I use the branch to set up each pick up location and then I manually get to type in the delivery address and deliver to instead of using the branch billing address so I can track where something was picked up from and delivered to.

Since batch can only be used with the same branch, I can't batch invoice to the customer like I need to for all the loads that were run during that period.   That is why I am trying to create the extra 2 fields so I can add the ship from and shipper address.  Once I can get it to save in the DB I have figured how to pull the information from the DB in the reports or invoices.  I just need to get the information into the DB.

Thanks for the help!

23

(11 replies, posted in Items and Inventory)

apmuthu wrote:

Treat Fuel as an Inventory Item. Enter a large stock quantity as Opening Balance. Reset to large stock quantity when it nears exhaustion.

Alternatively, use Tags / Dimensions for Fuel purchases.

Is there not another way?  I don't want to have to set up all those inventory accounts for fuel, plus it makes for my profit and loss numbers to be all messed up.  Everytime I run a P/L or a balance sheet the numbers will be skewed because I'll have inventory on an item that is not an inventory item showing up.

24

(11 replies, posted in Items and Inventory)

I am trying to get a report to show how many of a service item I purchased from a vendor.  In my case I run a transportation company and so when I purchase fuel, I have the Item Fuel set as a service item since I don't want or need to maintain inventory of fuel because it's going directly into the trucks and not a huge holding tank.  I need to be able to see how much fuel was purchased in each state for tax purposes each quarter.   When I run the "Inventory Purchasing Report" it doesn't show any fuel or any other service item I have set up.  PLEASE HELP smile Thanks.

25

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

apmuthu wrote:

It is possible that the module's files are accepting only integers as account numbers.

Didn't think about that possibility.  how and where would I change that?