Topic: How to make a link popup a window?

As FA currently stands, after I have added a new item to the database (Items & Inventory -> Items -> New Item) I then have to click on the Sales Pricing link and enter a new selling price for the item.  Then, I have to click on Items & Inventory and click on the Purchasing Pricing link and enter a new purchasing price for each vendor I purchase the item from.  This is not all that convenient, and is time consuming.

I have managed to figure out how to add a Purchasing Pricing link to the Items & Inventory menu bar so, now, I at least don't have to go back to the main Items & Inventory screen to get to the Purchasing Pricing link.  However, I'd prefer to have both the Sales Pricing and Purchasing Pricing links work as pop-up windows to the main Items screen so that I don't have to keep going back to that screen when I'm entering multiple new items.

Can someone explain to me how to do this?  I found the get_js_open_window function in includes/ui/ui_view.php but I can't seem to get it to work properly.

Thanks for any help/suggestions offered.

Regards,

Chris

Re: How to make a link popup a window?

Chris, I guess these items can be added as tabs, like 'Transactions' and 'Status'. Thanks for the idea. I will try to include these tabs. Then I will be back.

/Joe

Re: How to make a link popup a window?

Hey, Joe!

Yes, that would do it, too.  The general idea is to make it so you don't have to jump to different screens to enter the pricing info, so putting them on tabs fixes that.

However, I'd still appreciate it if you could point me in the right direction for creating pop-up windows.  What I have in mind is making a popup to the items screen from the purchasing invoice entry screen, just like you can hit F2 and pop-up the customer screen from the sales invoicing screen.  That way, if you're entering a supplier invoice and you discover you need to create a new item you can do so easily

So, thanks for any pointers/tips on how FA handles pop-up windows.

Regards,

Chris

Re: How to make a link popup a window?

Included Sales Pricing, Purchasing Prising, Cost update and Reorder Levels in tabs in Items form.

The HG repository is updated.

You can download the file new_tabs.zip that include these files:

/inventory/cost_update.php
/inventory/prices.php
/inventory/purchasing_data.php
/inventory/reorder_level.php
/inventory/includes/db/items_prices_db.inc
/inventory/includes/db/items_trans_db.inc
/inventory/manage/items.php

Unpack the zip file and replace the files in relevant folders.

Hope you are satisfied with this.

/Joe

Post's attachments

new_tabs.zip 14.1 kb, 13 downloads since 2013-01-26 

You don't have the permssions to download the attachments of this post.

Re: How to make a link popup a window?

@Chris

Regarding the link to popup windows.

Check that you have these lines at the top of the file where you want the links:
They should be just before the page(...........) function call.

$js = "";
if ($use_popup_windows)
    $js .= get_js_open_window(900, 500);

Use the function

function viewer_link($label, $url='', $class='', $id='',  $icon=null)

on line 219 in file /includes/ui/ui_controls.inc.

Search all the files for viewer_link to get an idea on how to use the parameters.

/Joe

Re: How to make a link popup a window?

Hi, Joe:

Thanks for the updated files.  Very nice!  It's all in one handy place now!  WOO HOO!

Thanks, too, for the pointers/tips on popup windows.  I'll take a look later today.

Regards,

Chris

Re: How to make a link popup a window?

Okay, I think I get the general idea of how popup windows work.  But, could you point me to the following:

  • Which PHP file sets the F2 function key to popup the sales/manage/customers.php screen when I'm in Sales -> Direct Invoice?    I can't seem to find where that's being done.

  • Also, where in sales/manage/customers.php is the "Select" button getting added to select the current customer, close the screen, and populate the Direct Invoice screen with the appropriate data?

I'm sorry to be asking so many questions, but I'm trying to figure out how FA works so that (hopefully!) I can try doing some of my "improvements" myself instead of bugging you folks about it.  So, a little extra help now should pay dividends later.

Thanks, again, for all your help!

Regards,

Chris

Re: How to make a link popup a window?

Your second list item.
All the listboxes (comboboxes) are in the file /includes/ui/ui_lists.inc and the customer list is on line 486 and derivations from that further on.

Your first list item.
Well, I guess it is in one of the javascript files in the /js folder. I must ask Janusz to comment on that. He fixed the Ajax and Js scripts.

/Joe

Re: How to make a link popup a window?

Regarding popup editors available under function keys, they are set using set_editor() function. In specific case of customer_list_*() UI helper functions you can toggle this feature with $edit_key argument (see ui_lists.inc).

Janusz

Re: How to make a link popup a window?

HG Changeset 3162 has a set of changes to implement tabs.

There seems to be one mistake in the file inventory/cost_update.php for the number of arguments of the function called display_notification() that takes only 2 but is given 3, replacing the function called display_note() that took 4.

Both functions are defined in includes/ui/ui_msgs.inc.

Re: How to make a link popup a window?

Thanks Joe, HG Changeset 3165 fixed it.

Re: How to make a link popup a window?

First, thanks to everyone for the information provided so far!  I have spent many hours the last couple of days wandering around the FA code, and your pointing me in the right direction has been very helpful.

Unfortunately, while I can get the general idea of how the code is working, I just don't have sufficient PHP coding skills to truly understand what's going on.  FA is a very complex application, with many nested functions (i.e. functions calling other functions), and it's just too over my head and mind boggling. sad

So, let me explain what I'm trying to accomplish and then, maybe, someone with more skill that I can do it if they have the desire and time to do so.

Currently, in the purchasing module, when I'm using Purchase Order Entry, Direct GRN, or Direct Invoice I can hit F2 to pop-up the purchasing/manage/suppliers.php screen, create a new supplier and then click the "Select" button at the bottom of the screen.  When I do this, the purchasing/manage/supplier.php screen closes and fields on the purchasing screen (PO Entry, Direct GRN, or Direct Invoice) are populated with the data for the new supplier.  This is very handy as I don't have to leave the purchasing screen to create a new supplier.

Now, let's go to another scenario.  I'm entering items on the PO Entry, Direct GRN, or Direct Invoice screen.  I suddenly realize that the item I want to enter isn't in the database.  So, I now have to go over to the inventory module, create the item, and come back to the purchasing screen to finish entering my PO, GRN, or invoice  However, before I can continue, I must refresh the purchasing screen so that it will pick-up the new item in the database.  When I do this, I lose all previously entered items and have to start all over!

This isn't a big deal if it happens at the beginning of entering items, but if I have entered a lot of items it can be really frustrating!  And it's even more frustrating if it happens multiple times while trying to enter the same PO, Direct GRN, or Direct Invoice!  So, what I do now is before I go into the purchasing module to create a PO, Direct GRN, or Direct Invoice, I use inventory/manage/items.php to check each item to make sure it's in the database.  This is a lot of extra work for me, but is better than getting half-way through a PO, Direct GRN, or Direct Invoice and having to start over again because one or more items isn't in the database.

So, what I'm looking for is where I can hit another function key when I'm entering items into a PO, Direct GRN, or Direct Invoice which will pop-up the inventory/manage/items.php screen so that I can create a new item.  When I'm finished  doing that, I click on the "Select" button at the bottom of the inventory/manage/items.php screen.  It then closes and the fields on the line in the items section of the PO, Direct GRN, or Direct Invoice screen are updated with the data for the new item.  I can then save that line and carry on with entering the rest of my PO, Direct GRN, or Direct Invoice.  No more having to refresh the screen and start entering items all over again!  cool

I hope the above explanation is clear?  If not, let me know and I'll try explaining again.  If this is easily do-able, I think it would greatly improve FA's functionality in the purchasing module.  If it's not easily do-able, I guess I'll just have to keep checking items using inventory/manage/items.php and creating new items before I go into purchasing and use the PO, GRN, or invoice screens. sad

Thanks, again, for all your help!  I really do wish I were knowledgeable enough to figure this out on my own.  Maybe I will be someday, but not today.  sad

Regards,

Chris

13 (edited by chrison 01/27/2013 08:26:24 pm)

Re: How to make a link popup a window?

Btw, while we're talking about entering Direct Purchase Invoices....

Currently, when entering an item on a Direct Sales Invoice and the item has an editable description, after you tab through the description drop-down list the description field turns into a text field and is given focus so that you can edit the field (if you want) and then carry-on with finishing and saving the line item.  However,  when entering a Direct Purchase Invoice and the item has an editable description, you have to first save the line and then click the "edit" link to go back and edit the line's description. 

It's no big deal, really, but shouldn't you be able to edit the description for an item on a Direct Purchase invoice before saving the line, just like when entering items on a Direct Sales Invoice?

Thanks!

Regards,

Chris

Re: How to make a link popup a window?

In the purchasing data on Items and Inventory tab, you can setup the suppliers discription of an item.

/Joe

Re: How to make a link popup a window?

@chrison Post 12 here:
While midway entering line items, when you find that you do not have the item in the item master, try entering the new item in another window/tab of the browser instead of the standard popup that occurs. Then save midway and choose to edit / append to the line items of the same main record. If you did not understand the above, then make some numbered steps and screenshots for reference and I'll match the steps to any new workaround ones.

16 (edited by chrison 01/28/2013 04:51:15 am)

Re: How to make a link popup a window?

joe wrote:

In the purchasing data on Items and Inventory tab, you can setup the suppliers discription of an item.

/Joe

Right, but that's not what I'm trying to do.  A fuller explanation might help....

Rather than create an item for each and every piddly thing I purchase, I have created several generic items with their type set to "service" because I also don't want to track them through inventory.  Then, when I purchase the item I want to edit the description from the generic description to what the item actually is.  Because it's a generic item, there might be more than one on each purchase invoice (I just ignore the warning FA gives), but that's okay because the item description tells me what the item actually is.

The best example of this is office supplies.  I do not want to track any office supplies through inventory, and I do not want to create an item for every piddly bit of office supplies I use (pens, paper clips, paper, and on and on).  So, I have created a service item called "MISCOFF" (Misc. Office Supplies).  When I buy a bunch of office supplies, I want the direct purchase invoice I create to look like this:

  • MISCOFF - Black Pens (12/Box) 1 EA @ 3.00 Total = 3.00

  • MISCOFF - Paper Clips Large (100/Box) 2 EA @ 1.50 Total = 3.00

  • MISCOFF - Paper Clips Small (100/Box) 2 EA @ 1.00 Total = 2.00

See what I mean?  So, like I said, being able to edit the description before saving the line instead of having to save the line, edit it, then save it again, would be a time saver.  It's not critical, but it sure would be handy!

Regards,

Chris

Re: How to make a link popup a window?

apmuthu wrote:

@chrison Post 12 here:
While midway entering line items, when you find that you do not have the item in the item master, try entering the new item in another window/tab of the browser instead of the standard popup that occurs. Then save midway and choose to edit / append to the line items of the same main record. If you did not understand the above, then make some numbered steps and screenshots for reference and I'll match the steps to any new workaround ones.

Okay, I see that if you're using the full purchasing workflow (PO -> Receive -> Invoice), then you can, indeed, start a PO, save it, and then go back and add more items to it later.  So, it is possible to save a partial PO, go to inventory/items and create a new item, and then go back and finish the PO.

However, you can't do that if you're using the Direct Invoice function, unless I'm missing something here?  Once you process a Direct Invoice you can't edit it.  All I can find is the ability to credit it.

Since I'm a small, one-man operation, I would rather not have to use the full purchasing workflow. While that workflow is suitable for larger organizations with many employees and purchasing functions divided between several staff, in my circumstances it's overkill.

So, again, it would be very helpful to be able to create a new item using an item pop-up window as previously described.  I do understand that doing this might require significant time and effort, and that there may be more pressing development priorities at the moment, so if it's just not do-able I'll accept that.

Thanks for your help...

Regards,

Chris

Re: How to make a link popup a window?

Okay, I did some more "exploring" and figured out how to get the inventory/manage/items.php window to pop-up while I'm in the sales direct invoice screen.  In includes/ui/ui_lists, I changed function customer_list by adding the hotkey for inventory.

Change line 495-496 from this...

    if ($editkey)
        set_editor('customer', $name, $editkey);

To this...

    if ($editkey)
        set_editor('customer', $name, $editkey);
        set_editor('item', $name, $editkey);

I can now view/create/edit items in the pop-up window.  However, when I click the "Select" button at the bottom of the screen, the items window closes but does not populate the item code field on the Direct Invoice screen.

Obviously, I'm missing a step here.  Any help provided will be greatly appreciated!

Thanks!

Regards,

Chris

Re: How to make a link popup a window?

Wait a second...  it does work, although not quite how it works in the other modules.

As mentioned in my last post, when I click the "Select" button at the bottom of the inventory/manage/items.php pop-up window, the window closes but does not update the Direct Invoice screen with the stock_id and other data for the newly-created item.  However,  I can type the new item's stock_id into the "Item Code" field, or use the drop down list, and it's there!

Also, when I create a new item in the pop-up window, if I go to another tab (e.g. "Sales Pricing") and make a change there, when I go back to the "General Settings" tab the "Select" button is no longer at the bottom of the screen.  So, I have to refresh the screen and reselect the new item to get the "Select" button back.  Then I can carry on with selecting the item and going back to the Direct Invoice screen.

So, I have accomplished what I set out to do...  I'm able to create new items from within the Direct Invoice screen.  WOO HOO!  However,  it would be nice if I could get this to work just like it does with customers and branches...  update the fields automatically, and not lose the "Select" button if I go to another tab.

Any tips/pointers on how to get it to do that?

Thanks, again, for any help provided!

Regards,

Chris

Re: How to make a link popup a window?

Did you mean:

    if ($editkey) {
        set_editor('customer', $name, $editkey);
        set_editor('item', $name, $editkey);
    }

21 (edited by chrison 01/29/2013 04:20:13 am)

Re: How to make a link popup a window?

apmuthu wrote:

Did you mean:

    if ($editkey) {
        set_editor('customer', $name, $editkey);
        set_editor('item', $name, $editkey);
    }

The original code didn't have the braces so I didn't add them.  That goes to show you how much I know about PHP programming!  (BLUSH!)

Thanks for pointing that out!  I fixed it.  Now, if I could get it to automatically populate the Direct Invoice screen when I close he item pop-up screen I'd be all set!  (Hint!) wink

Thanks for your help!

Regards,

Chris

Re: How to make a link popup a window?

I am terrible sorry guys, and especially you @chris.

It turns out to be a little glitch when changing the Item list box fill a year ago. A parameter was missing in the new one.

The function in ui_lists.inc, line 776:

function stock_items_list_cells($label, $name, $selected_id=null, $all_option=false, 
    $submit_on_change=false, $all=false, $editkey = false)

indicates a final parameter $editkey. If this is true, a f4 key is available to call upp the items form in a popup window.

So in file /purchasing/includes/ui/po_ui.inc line 401:

        stock_items_list_cells(null, 'stock_id', null, false, true, false);
should have a last parameter set to true
        stock_items_list_cells(null, 'stock_id', null, false, true, false, true);

And finally there was a little bug in /inventory/manage/items.php on line 22. Should be:

page(_($help_context = "Items"), @$_REQUEST['popup'], false, "", $js);

Try to change theese lines and it will work with the f4 key. Some times you have to pres this key twice.

So F2 = customer/supplier, F3 = customer branches and F4 = items in forms where this is established.

This will be sent to the HG repository. First I will have a look into other scripts if it need changing.

You can also download the 2 files here. Rename the items.php1 to items.php and replace the files
/inventory/manage/items.php
/purchasing/includes/ui/po_ui.inc

/Joe

Post's attachments

items.php1 16.3 kb, 5 downloads since 2013-01-29 

po_ui.inc 15.2 kb, 4 downloads since 2013-01-29 

You don't have the permssions to download the attachments of this post.

Re: How to make a link popup a window?

@Joe:

I manually made the changes you outlined and, yes, it now automatically populates the fields when you select an item in the pop-up window.

WOO HOO!!!!  cool cool cool

There's still a small problem that if I create a new item and then go to another tab (e.g. to Purchase Pricing to enter a purchase price), when I go back to the General Information tab the "Select" button is no longer at the bottom of the screen.  So, I have to refresh the screen, reselect the item to get the "Select" button back, and then click the "Select" button.

This is NOT a big deal and I'm REALLY happy just being able to use the pop-up window to create new items.  I just mention this last little thing in case there's an easy fix for it.  If not, don't worry about it.

Again, thank you VERY much for all your help!

Regards,

Chris

Re: How to make a link popup a window?

Btw, Joe, does this mean that the changes I made in includes/ui/ui_lists.php aren't needed and should be removed?  Or, should I leave them as is?

Thanks!

Regards,

Chris

Re: How to make a link popup a window?

I guess you should revert it again. Later when I get the resources, I will look at you minor item above.

/Joe