Ctorp
Members-
Posts
11 -
Joined
-
Last visited
Reputation
5 NeutralAbout Ctorp

-
I added the following to %root%\inc\classes\Consumable.php: /** * Get Status of Consumable */ static public function get_status(){ $qty = $this->getQty(); $reorder = $this->getReOrder(); if ($qty > $reorder) { return array('ok', '73D216'); } if ($qty <= $reorder && $qty > 0) { return array('low', 'EDD400'); } if ($qty == 0) { return array('critical', 'CC0000'); } } But no matter where I called it in %root%\views\home\stock.php , I could not get it to work. I ended up trying to just transplant it there, but that did not work either. I am still sitting at line 29 with: foreach($status as $k => $v){ $qty = $c->qty; $reorder = $c->reorder_pt; # if ($qty > $reorder) { return array('Ok', '73D216'); } # if ($qty <= $reorder && $qty > 0) { return array('Low', 'EDD400'); } # if ($qty == 0) { return array('Critical', 'CC0000'); } if($c->qty >= $k){ $qtylevel = strtolower($v[0]); $qtycol = $v[1]; break; } } In the meantime, I've set up the printer addedit page ( %root%\views\printers\addedit.php ) with a snippet that adds a checkbox to indicate Inactive/Active status for the inventory. This works, but is not implemented with any functionality yet.. So I am trying to establish a way for the reorder page ( %root%\reorder.php ) to NOT query consumables that belong to an inactive printer, but my query seems to break when I try it. I have: $sql = "SELECT consumables.*,[color="darkslateblue"] printers.active,[/color] ( round( ( (consumables.qty) / (SELECT MAX(qty) FROM consumables) ) * 100 ) ) AS qty_percent, GROUP_CONCAT(CAST(CONCAT(manufacturers.name, ' ', models.name) AS CHAR) SEPARATOR ', ') AS model FROM consumables[color="darkslateblue"], printers[/color] LEFT JOIN consumables_models ON consumables.id = consumables_models.consumable_id LEFT JOIN models ON consumables_models.model_id = models.id LEFT JOIN manufacturers ON models.manufacturer_id = manufacturers.id [color="darkslateblue"]WHERE printers.active = 0[/color] GROUP BY consumables.id ORDER BY models.name ASC, consumables.name ASC"; I also removed the snippet of code that was allowing a full row to be treated as a selectable item for the checkboxes in %root%\views\consumables\addedit.php. The formatting looks the same, but I kept inadvertently selecting multiple items when scrolling the page so now only clicking the name or checkbox will select it, instead of being able to click the empty row space. Again, thank you so much for sticking with me through this. When I get it finished I will gladly post what I have again. So, at present my Reorder page looks like this: http://i.imgur.com/Y0hFQ.jpg
-
I think this has moved over my head in terms of my knowledge of Flourish and PHP. (I'm still newish to PHP.) Where is the consumable model file located? I tried doing a directory search for getQtyStatus(), but did not find it. Supposing that the get_status() function works, where would you place $this_status = $c->get_status(); in order to call it at the right time?
-
Ah. Having added the "Reorder_pt" value to the add/edit consumable form and to the consumables table, I was thinking 0 - Universal 'Critical' value. (or 0&1) >0 & < Reorder_pt - 'Low' values >= Reorder_pt - 'OK' values I have changed the line in views\home\stock.php at 28 to: foreach($status as $k => $v){ if($c->qty >= $k){ $qtylevel = strtolower($v[0]); $qtycol = $v[1]; $qty = $c->qty; $reorder = $c->reorder_pt; break; } } then changed the first lines of config.php to: //change to critical if 0 // low if qty < reorder_pt && > 0 // OK if qty = or > reorder_pt global $qty, $reorder; if($qty=='0') { $status = array('OK', '73D216'); } elseif($qty < $reorder) { $status = array('Low', 'EDD400'); } elseif($qty >= $reorder) { $status = array('Critical', 'CC0000'); } but it does not work this way. I'm still muddling through to figure out why.
-
Still working on this. I have used a simple webtoolkit pre-made script to password protect the inventory pages, and it drops authentication every time the browser is restarted which is good enough for me, but probably not the best solution if you're in a true corporate environment. I also tried adding the printer name to the reorder page, but couldn't figure it out since I used the homepage stock as a template. (Trying to use something like foreach($printers as $p) then echoing $p->name clearly does not work, but it will make your page explode with many values. ^_^) I'm investigating the $status[#]=array('OK', '73D216'); // #+ OK lines at the moment to try to change this dependent on the values set as reorder_pt and qty.. I believe the $status[] portion is defined in views\home\stock.php And I've added an Active field to the printers table which is populated by 0 for active and 1 for inactive. I have not incorporated this into the php, yet.
-
This is what I have so far. You would need to add a field to the 'consumables' table for last_order and reorder_pt for it to work. Attachment: inventory_(modded_by_CTorp).zip It is still very much a work in-progress compared to what I have envisioned, but I'll be back next week when I can look at it again. My have-done notes: - Added Last Order field to keep track of the last time a consumable was ordered - Added Reorder Point field to allow each toner it's own 'Low', 'Critical, 'OK' reference - Added Reorder page with sorting the same as it was on the home page, but including the reorder point and re-sized for easy print-outs (for Finance dept. heads) My want-to-do notes: - I want to add at least 2 more columns to addedit.php in the views\consumables folder because beyond a certain point the page scrolling gets ridiculous. - I'm probably going to change the dates to mm-dd-yyyy standard. My boss would probably prefer this as it is what he is used to with our old toner db. - Printer active/inactive status. If inactive, do not display consumables in reports/stock - Consumable toners should allow only one color selection. (Unless there are multi-color toners that come in a single cartridge that I'm not aware of.) - Create an 'undo last consumed' option on the off chance someone consumes a cartridge and does not. - Password protect the inventory so it can be hosted on the local network for use by all I.T. members without fear of a user stumbling upon and *#%^ing with it.
-
I have already added the reorder_pt and updated my db to verify it works. I also created the Reorder page with links and it shows a table that is very similar to the Consumable Stock section on the homepage (I used it as a template). I am now in the process of reverse engineering a way to set up Critical as any consumable with: - ($status[0]=array('Critical', 'CC0000'); // no stock - ($status[$value]=('Low', 'EDD400'); // 1 to reorder_pt minus 1 - ($status[$value]=('OK', '73D216'); // at or above reorder_pt Where $value is set by comparing $reorder to $qty where: $reorder=$c->getReorderPt(); $qty=$c->getQty(); With something like: if($qty <= $reorder) { $value= blah;} elseif() {..} Sorry if this is a bit slapdash. I'm still working on this part at the moment, actually. Once this is done I am hoping that I can use the existing 'Low' and 'Critical' identifiers to populate the Reorder form effectively. I still haven't tried tackling the 'undo' feature or the password protection. I am glad you mentioned the +/- adding option for manipulating the stock though. That should prove useful.
-
I'm enjoying working on this PrintMaster project. A few notes I still haven't figured out why I can't get sorting to work properly with the Last Order field, but I have forgone that for the moment and started writing a Reorder page for the toner inventory. I'm thinking it would be best if I set a specific "Reorder Point" field for each consumable then allow each consumable to populate this Reorder page based on whether the "qty" field is < the "reorder_pt" field. Also in the works is an "inactive" field for printers that still have consumables, but are not currently in service, so they do not populate the homepage consumable stock. A couple other improvements that I will look into (I currently am not sure how I could implement them) are a password protection for the inventory and the ability to "undo" the last consumed element in case someone uses it by accident (or in case it is taken from the inventory, but is found to be unneeded and returned). I will post back if/when I finish these things as I may be moving to another job before this can come to full fruition.
-
hmm. That was actually one of the things I tried before, but it still only organizes that particular field by 'asc' direction no matter how many times it is clicked. I tried again and cleared the cache as well as using two separate browsers, but it will not change the value. The other fields will alternate as usual either way. Would you like me to pastebin my changed files?
-
The code in consumables\index.php at line 34 with: It seems to only set the ?dir php action to 'asc' (i.e. consumables.php?sort=consumables.LastOrder&dir=asc) and does not store that information in the session (cookie?) so that a subsequent follow of that link (the column header) will change the sort direction to 'desc'. I think I remember seeing something where fCRUD::printSortableColumn was defined that indicated which sort actions it would work with, but I am not entirely sure, and I gave up on it after breaking it in various ways. My next step is going to be to modify the reports page to optionally generate a filled-out re-order form that is in-line with the ones used at the facility where I work. If I get that working I can post it later. ^_^
-
After a bit more tinkering, I managed to make this work. It was entirely trial and error so I have no idea why it works, and the Session issue persists, but to add the "Last Ordered" field.. 1. I added a date field type to the consumables table in mysql 2. I updated Line 31 of consumables.php with: Last ordered 3. updated Lines 23 and 54 (respectively) of consumables\index.php with: echo '' . $c->last_order . ''; I *think* that is everything I did, but this was trial and error as I mentioned above so I shall bask in the fact that it works for a little while before I get impatient and break it again trying to figure out what I just did as far as Flourish was concerned. (BTW if anyone can help me with the Session issue, I'm still game to try to fix that) Edit: I also found on line 4 of inc\config.php where the consumable status can be altered, although it is global right now. A few simple if/else might be able to fix that. I set 0 as Critical, 1 as Low, and 3 or more as OK.
-
First, I'd like to thank Craig for this tool. It's exactly what I was looking for. I actually used it to replace a PHP side-project I'd been working on infrequently to replace an Access DB that does the same thing. One thing I'm looking to implement that I don't see elsewhere is a field to add Last Ordered for each consumable, by which the list can be organized. This is used internally to keep track of when we will get new orders for some of our more impatient users. I added the field to the consumables table as a field titled last_order and was able to reference it in consumables\index.php on line 24: Last Ordered and line 54: echo '' . $c->model . ''; echo '' . $c->last_order . ''; However, my experience with Flourish is non-existent. I used the direct link to the descending order because fCRUD::printSortableColumn('consumables.LastOrder', 'Last Ordered') would only sort in ascending order. I am not sure where or how to pass the existing sort order to the session. Could you point me to how to do this? More importantly, I cannot figure out how to get the Last Ordered value to save to the db from consumables\addedit.php. When I tried to add the necessary code for updating this value, I tried various things, but eventually the only one that worked actually updated the consumable name instead of the last_order value so I scrapped it. Could someone also point me in the right direction for this? I'm assuming it will need its own function defined somewhere with Flourish, but again I have no experience with this API.
