C
chaintm author
Hello all, Been working with tech support (btw great bunch of people) on some issues, but one here is more of a general question then technical support. I am not all that great with mysql and php however, I know enough to be dangerous <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=10091&image=1&table=forumtopics' class='bbc_emoticon' alt=';)' />, so what I am looking to do is the following. I have the following tables (but a ton more obviously but for what I need to get working, this is only part).. ===========================
[order_sales] - Order_num (master key)
- event_time_start
- event_time_end
=============================
[order_items] -order_num
-ItemID
============================
[items] - ItemID (master key)
============================ Concept: order_sales is a huge table storing all order data, the initial start however is stated above. The user only can enter a time/date start and end the order number is generated by this automaticly once submited.
After submission, the user is re-directed the order_items page. This has a pulldown menu with all items listed linking from the items table. When a user is searching this , I want to flag the system to say "Current selection is schedualed for use during selected times, are you sure you want to continue?" Idea here is that prior to the user loading the order_items page, the system checks the start and end times (and between) against other order_sales allready submitted to the system. When it does this , the next step is the check within those particular orders for items listed in those orders. So my thought process is this.... Going in the "add page before process" (this taken from the reservation templete) [codebox]$rstt = CustomQuery("select from order_sales where Order_num=" . $values["Order_num"]);
$rstt = $dal->order_sales->Query("Order_num=" . $values["Order_num"],"");
while($rsh=db_fetch_array($rstt))
{
if($values["event_time_start"]>=$rsh["event_time_start"] && $values["event_time_start"]<=$rsh["event_time_end"] || $values["event_time_end"]>=$rsh["event_time_start"] && $values["event_time_end"]<=$rsh["event_time_end"] || $values["event_time_start"]<=$rsh["event_time_start"] && $values["event_time_end"]>=$rsh["event_time_end"])
{
$smarty->assign("message2","<div class=message><<< "Current selection is schedualed for use during selected times, are you sure you want to continue?">>></div>");
return false;
}
}return true;[/codebox] Now while that should work for getting my times sorted, I need to referance the outcome to then check the values of ItemID under said order_sales... so.. [codebox]$rstt = CustomQuery("select from order_items where Order_num=" . $values["order_num"]);
$rstt = $dal->order_sales->Query("order_num=" . $values["order_num"],"");
while($rsh=db_fetch_array($rstt))
{
if($values["????????"]<$rsh["????????????"])
{
$xt->assign("message2","<div class=message><<< Selected item is out of stock for this day >>></div>");
return false;
}
}
return true;[/codebox] I get lost here, I know I can check for the start middle and end date and times, do I need to assign this outcome with a new value? then call upon that value to check items within those orders? then after that if any item selected in the current order_items is selected from that list I get the response? I get how mathmatically it all works, I guess I need to learn more about structure and mostly syntex. The way I see it going in my head is ... If current order date/time end/start = any other order date/time end/start then query orders items , if items = current selected item then flag echo response. if not then do nothing. Or would it make sense if the sytem just subtracts from a total , I have a line for physical inventory and actual inventory. So I could use the physical as a constant regenerated number that is done after all this script executes and if that number is => then inventory number ignore, if <number echo response? I am desperate to get this working for my boss, any help or private help would be appreicated. Contact me anytime chaintm@yahoo.com and refer to this issue.. if you can help I would be in your debt. Hope this all makes sense, Noel B.
|
|