This topic is locked
[SOLVED]

 Custom Dropdown & Selecting The Value

5/27/2010 4:49:44 PM
PHPRunner General questions
C
chaintm author

I have custom pulldown checking inventory to make sure it's avalible. If not the value changes to Sold Out as you can see in the image below.
Here is an image working...


The pulldown is done threw a phpsnippet as I can't tie it directly to the actual field as this is in the ADD section. I use the snippet to make the list you see in the image and behind the scenes I check the same data to make sure that this is indeed correct using the before process. I carry the value dropdown1 in request all numbers come up correctly.
I am unable however to save and continue as the moduals value is empty but needs to be full. All other values on the page are automated except the pulldown custom selection. Any help would be appreciated. Sorry for the re-writes here. I have customized fields values before in the listings page, however sense only views can be customized and not edit/add's in the same manner. I am unsure how to proceed at this point using phprunner.
part of the code that generates the list in the image.. so you know where I am coming from better..
if ($data6["temp_total"] > $rs5["Qty"])

{

$str.="<option value=\"".$data["ItemID"]."\"> SoldOut ".$data["Name"]."</option>";

}

else

{

$str.="<option value=\"".$data["ItemID"]."\">".$data["Name"]."</option>";

}

A
ann 5/28/2010

It's difficult to tell you what's happening without seeing actual files. Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.

C
chaintm author 5/28/2010

I would Ann, however the code for this project is over 600 meg at this point ( a very large project that is in it's two years of development)... There is no error, however I will try to clerify things here a bit..
I insert a custom pulldown menu using phpsnippet:
Editor "add page";
global $conn,$strTableName;
$str = "";

$str.= "<select name=dropdown1 id=\"dropdown1\"><option value=1>";

$strSQL = "select from modual_panels";

$rs = db_query($strSQL,$conn);
while ($data = db_fetch_array($rs))

{

$str1 = "select Item_ID,event_time_start,event_time_end from event_times where Order_ID=".$_SESSION[$strTableName."_masterkey1"];

$rsh1 = db_query($str1,$conn);

while ($data1= db_fetch_array($rsh1))

{

$str3 = "select sum(Qty_Order) as total_qty from event_times where Order_ID!=".$_SESSION[$strTableName."_masterkey1"]."

and Item_ID=".$_SESSION["TEMPDATA"]."

and Modual_type=".$data["ItemID"]."

and ".$data1["event_time_start"]." >= event_time_start

and ".$data1["event_time_start"]." <= event_time_end

and status ='1'

or Item_ID=".$_SESSION["TEMPDATA"]."

and Modual_type=".$data["ItemID"]."

and ".$data1["event_time_end"]." >= event_time_start

and ".$data1["event_time_end"]." <= event_time_end

and status ='1'

or Item_ID=".$_SESSION["TEMPDATA"]."

and Modual_type=".$data["ItemID"]."

and ".$data1["event_time_start"]." <= event_time_start

and ".$data1["event_time_end"]." >= event_time_end

and status ='1'";

$hrs3 = db_query($str3,$conn);

$rs3 = db_fetch_array($hrs3);
//out of inventory +1 for current order

$data6["temp_total"] = $rs3["total_qty"]+1;

$hrs3 = db_query($str3,$conn);

$rs3 = db_fetch_array($hrs3);
$str5 = "select Qty from modual_panels where ItemID=".$data["ItemID"];

$hrs5 = db_query($str5,$conn);

$rs5 = db_fetch_array($hrs5);
}

if ($data6["temp_total"] > $rs5["Qty"])

{

$str.="<option value=\"".$data["ItemID"]."\">
SoldOut ".$data["Name"]."</option>";

}

else

{

$str.="<option value=\"".$data["ItemID"]."\">".$data["Name"]."</option>";

}}

//echo "
Qty total: ";print_r($rs["Qty"]);

$str.="</select>";

echo $str;
I change the view of the moduals value so I can change the value that is shared on the database to make it a readable name.
View page value for Moduals;
global $conn;

if ($data["Moduals"])

{

$str7 = "select Name from modual_panels where ItemID='".$data["Moduals"]."'";

$rs7 = db_query($str7,$conn);

$data7= db_fetch_array($rs7);

$value=$data7["Name"];

}
Then as the value of the dropdown1 is selected, I use this to compair data in the database to see if this item is indeed taken or not and if so the echo NO MODULAR is given, if all passes, the values on the screenshot prior to this post are given in this case the value amount of 1.
addpage: Before process;
global $conn,$strTableName;
if (@$_REQUEST["dropdown1"])

{

//------ modual request from pulldown menu-----//

$data1000=$_REQUEST["dropdown1"];

//------- item_id from session-----------//

$_SESSION["TEMPitemid"] = $data1000;
//=============== carry over values from other tables ===========//

$str14 = "select ItemThumb from items where ItemID='".$_SESSION["TEMPDATA"]."'";

$rs14 = CustomQuery($str14);

$data14 = db_fetch_array($rs14);

$values ['ItemThumb'] = $data14['ItemThumb'];

$_SESSION["ItemThumb"] = $data14["ItemThumb"];
//=============================================================//

$str1 = "select event_time_start,event_time_end from event_times where Order_ID=".$_SESSION[$strTableName."_masterkey1"];

$rsh1 = db_query($str1,$conn);

while ($data1= db_fetch_array($rsh1))

{

$str3 = "select sum(Qty_Order) as total_qty from event_times where Order_ID!=".$_SESSION[$strTableName."_masterkey1"]."

and Item_ID=".$_SESSION["TEMPDATA"]."

and Modual_type=".$data1000[0]."

and ".$data1["event_time_start"]." >= event_time_start

and ".$data1["event_time_start"]." <= event_time_end

and status ='1'

or Item_ID=".$_SESSION["TEMPDATA"]."

and Modual_type=".$data1000[0]."

and ".$data1["event_time_end"]." >= event_time_start

and ".$data1["event_time_end"]." <= event_time_end

and status ='1'

or Item_ID=".$_SESSION["TEMPDATA"]."

and Modual_type=".$data1000[0]."

and ".$data1["event_time_start"]." <= event_time_start

and ".$data1["event_time_end"]." >= event_time_end

and status ='1'";
$hrs3 = db_query($str3,$conn);

$rs3 = db_fetch_array($hrs3);
$str5 = "select Qty from modual_panels where ItemID=".$data1000[0];

$hrs5 = db_query($str5,$conn);

$rs5 = db_fetch_array($hrs5);
$data6["temp_total"] = $rs3["total_qty"]+1;
{

if ($data6["temp_total"] > $rs5["Qty"])

{

echo "<font color=red><bold><MIDDLE><CENTER><big><b>XX____XX____XX_____XX </b></big></bold></MIDDLE></CENTER></font>";

echo "<font color=yellow><bold><MIDDLE><CENTER><big><b>
NO MODULAR </b></big></bold></MIDDLE></CENTER></font>";

echo "<font color=white><bold><MIDDLE><CENTER><big><b> for this order, please select another item or goto list to edit current</b></big></bold></MIDDLE></CENTER></font>";

echo "<font color=red><bold><MIDDLE><CENTER><big><b>XX____XX____XX_____XX </b></big></bold></MIDDLE></CENTER></font>";

return false;

}}}}
ISSUE: I need to pass dropdown1 value of the pulldown menu to the moduals value after "save" is clicked. The reason is in the after record added event I do the following (which is allot)... now I could edit this and put it into the before process section, make my own save and go the rout I did with the listings page. but that seems to be allot of work not needed. Is there not an easier way to pass a custom pulldown value in the add page to a value of the current page after hitting save?*
after record added;
//==========Order_Items After Record Added (add page)===================//

global $conn,$strTableName;
//==================Delivery_cost from order_sales + ItemRentalPrice from items = new ItemRentalPrice Total========//

$str7 = "select FlagID from items where ItemID='".$values["ItemID"]."'";

$rs7 = db_query($str7,$conn);

$data7= db_fetch_array($rs7);

if($data7["FlagID"]==1)

//========================if item does have a delivery charge================//

{

$str5 = "select Delivery_cost from order_sales where Order_num=".$_SESSION[$strTableName."_masterkey1"];

$rs5 = db_query($str5,$conn);

$data5 = db_fetch_array($rs5);

$str6 = "select ItemRentalPrice from items where ItemID='".$values["ItemID"]."'";

$rs6 = db_query($str6,$conn);

$data6 = db_fetch_array($rs6);

$strUpdate = "Update order_items set ItemRentalPrice=".$data6["ItemRentalPrice"]."

  • ".$data5["Delivery_cost"]." where Line_num=".$values["Line_num"]." and ItemID=

    '".$values["ItemID"]."'";

    db_exec($strUpdate,$conn);

    //======================if item does not have a delivery charge===============//

    }

    else

    {

    $str5 = "select Delivery_cost from order_sales where Order_num=".$_SESSION[$strTableName."_masterkey1"];

    $rs5 = db_query($str5,$conn);

    $data5 = db_fetch_array($rs5);

    $str6 = "select ItemRentalPrice from items where ItemID='".$values["ItemID"]."'";

    $rs6 = db_query($str6,$conn);

    $data6 = db_fetch_array($rs6);

    $strUpdate = "Update order_items set ItemRentalPrice=".$data6["ItemRentalPrice"]." where Line_num=".$values["Line_num"]." and ItemID='".$values["ItemID"]."'";

    db_exec($strUpdate,$conn);

    }

    // ========================This function is used to get sub_total of items passed to the details order_items page.=======//

    $str5 = "select from order_sales where Order_num=".$_SESSION[$strTableName."_masterkey1"];

    $rs5 = db_query($str5,$conn);

    $data5 = db_fetch_array($rs5);

    if ($data5["event_time_end"]>$data5["event_time_start"])

    {

    $st["Date3"] = (($data5["event_time_end"])-($data5["event_time_start"]))/(60
    6024);

    echo "positive";

    $st1["Date3"] = $st["Date3"]+1;

    echo $st1["Date3"];

    }

    else

    {

    echo "negative";

    $st1["Date3"]=1;

    }

    $str = "select ItemRentalPrice from order_items where Line_num=".$values["Line_num"]."

    and ItemID='".$values["ItemID"]."'";

    $rs = CustomQuery($str);

    $data7 = db_fetch_array($rs);

    $values ['ItemRentalPrice'] = $data7['ItemRentalPrice'];

    $values["Sub_total"] = $values["Qty_order"]
    $values["ItemRentalPrice"]$st1["Date3"]1;

    $strUpdate2 = "update order_items set Sub_total =".$values["Sub_total"]." where Order_num =".$_SESSION[$strTableName."_masterkey1"]." and Line_num=".$values["Line_num"]."

    and ItemID='".$values["ItemID"]."'";

    db_exec($strUpdate2,$conn);

    $rs9 = CustomQuery("select sum(Sub_total) from order_items where Order_num=".$_SESSION[$strTableName."_masterkey1"]);

    $data9 = db_fetch_numarray($rs9);

    $strUpdate = "Update order_sales set Order_sub_total=".$data9[0]." where Order_num =".$_SESSION[$strTableName."_masterkey1"];

    db_exec($strUpdate,$conn);

    //===============================insert current new record to new table .....event_times orders===================================//

    $sql = "insert into event_times (Item_ID,Qty_Order,Order_ID,Line_Num,Modual_type) values

    ('".db_addslashes($values["ItemID"])."','".db_addslashes($values["Qty_order"])."'

    ,'".db_addslashes($values["Order_num"])."','".db_addslashes($values["Line_num"])."'

    ,'".db_addslashes($values["Moduals"])."')";

    db_exec($sql,$conn);

    //============= update times on new table....... event_times table when any item is added===========//

    $str = "select from order_sales";

    $rs = db_query($str,$conn);

    while ($data = db_fetch_array($rs))

    {

    $str1 = "update event_times set event_time_start='".db_addslashes($data["event_time_start"])."'

    , event_time_end='".db_addslashes($data["event_time_end"])."' where Order_ID=".$data["Order_num"];

    db_exec($str1,$conn);

    }

    //======== direct page back to order_items_list page with masterkey being held. =========//

    //echo "Qty Order";

    //echo ($data9);

    //echo "ItemStockPhys";

    //echo ($rs13);

    //------------------update statues of sales------------------//

    $strUpdate = "Update order_sales set Order_status ='9'where order_num =".$_SESSION[$strTableName."_masterkey1"];

    db_exec($strUpdate,$conn);

    //----------------update order items line comment now start date of event-----------//

    $str100 = "select
    from order_sales where Order_num=".$_SESSION[$strTableName."_masterkey1"];

    $rs100 = db_query($str100,$conn);

    while ($data100 = db_fetch_array($rs100))

    {

    $str200 = "update order_items set Line_comment ='".db_addslashes($data100["event_time_start"])."' where Order_num =".$_SESSION[$strTableName."_masterkey1"];

    db_exec($str200,$conn);
    //-----------------update status for event_times tracking only!------------//

    $strUpdate1 = "Update event_times set Status ='1' where Order_ID=".$_SESSION[$strTableName."_masterkey1"]." and Item_ID='".$values["ItemID"]."'";

    db_exec($strUpdate1,$conn);

    $keys["Order_num"]= $_SESSION[$strTableName."_masterkey1"];
    header("Location: order_sales_item_list_list.php?mastertable=order_sales&masterkey1=".$keys["Order_num"]);

    }

    exit();
    NOTE: please know that I relize the After Record Added event needs to be edited to fit the current attempt , this is my previous code prior to needing a custom pulldown menu which worked fine. So values here won't be here as I use a dropdown1 value to get the moduals value.

C
chaintm author 5/28/2010

also...
I read in another thread about using...
document.getElementById('').value
to carry the value select from a custom dropdown to the value you need to put it too. Could I use this by editing the html pages and after hitting the save button it calls the get element and puts that into the value of moduals? Or is my first guess above the right but long way, by adding to the before process, re-write all my code in the after record added and put that also in the before process then manual save all the data to the current invoice and then change page back to listing manually? This seems to be my only recourse, I was hoping for a more simple concept as phprunner is suppose to help cut down on development time not add to it. Last comment not ment to be a shot against phprunner, the program is great, but there seems to be for whatever reason things put in place that could be easly added to fix things like this.
The cutom pulldown menu I have seen this request sense I bought this software, I would recommend allowing a custom script option to be added to the edit/add page as you have for the view page. This would allow us to tie directly into any page from any event without all this side stepping to be done.

A
ann 5/31/2010

Hi,
In general we don't support the code written by our customers.

Here is just a sample:

$values["FieldName"] = $_REQUEST["SomeValue"]



or

$_SESSION["FieldName"] = $_REQUEST["SomeValue"]



where SomeValue is an Id of dropdown:

<input name="SomeValue" id="SomeValue" ...>
C
chaintm author 6/2/2010

well for those in the need, I ended up doing the following...
snippet...custom menu pulldown
//echo $_SESSION["TEMPDATA"];

global $conn,$strTableName;

//echo $_SESSION["TEMPDATA"];

$str = "";

$str.= "<select name=dropdown1 id=\"dropdown1\"><option value=1>";

$strSQL = "select from modual_panels";

$rs = db_query($strSQL,$conn);
while ($data = db_fetch_array($rs))

{

$str1 = "select Item_ID,event_time_start,event_time_end from event_times where Order_ID=".$_SESSION[$strTableName."_masterkey1"];

$rsh1 = db_query($str1,$conn);

while ($data1= db_fetch_array($rsh1))

{

$str3 = "select sum(Qty_Order) as total_qty from event_times where Order_ID!=".$_SESSION[$strTableName."_masterkey1"]."

and Item_ID=".$_SESSION["TEMPDATA"]."

and Modual_type=".$data["ItemID"]."

and ".$data1["event_time_start"]." >= event_time_start

and ".$data1["event_time_start"]." <= event_time_end

and status ='1'

or Item_ID=".$_SESSION["TEMPDATA"]."

and Modual_type=".$data["ItemID"]."

and ".$data1["event_time_end"]." >= event_time_start

and ".$data1["event_time_end"]." <= event_time_end

and status ='1'

or Item_ID=".$_SESSION["TEMPDATA"]."

and Modual_type=".$data["ItemID"]."

and ".$data1["event_time_start"]." <= event_time_start

and ".$data1["event_time_end"]." >= event_time_end

and status ='1'";

$hrs3 = db_query($str3,$conn);

$rs3 = db_fetch_array($hrs3);
//out of inventory +1 for current order

$data6["temp_total"] = $rs3["total_qty"]+1;

$hrs3 = db_query($str3,$conn);

$rs3 = db_fetch_array($hrs3);
$str5 = "select Qty from modual_panels where ItemID=".$data["ItemID"];

$hrs5 = db_query($str5,$conn);

$rs5 = db_fetch_array($hrs5);

//echo print_r($data["ItemID"]);print_r($data["Name"]);print_r($data6["temp_total"]);

//echo"
";
}

if ($data6["temp_total"] > $rs5["Qty"])

{

$str.="<option value=\"".$data["ItemID"]."\">
SoldOut ".$data["Name"]."</option>";

}

else

{

$str.="<option value=\"".$data["ItemID"]."\">".$data["Name"]."</option>";

}}

//echo "
Qty total: ";print_r($rs["Qty"]);

$str.="</select>";

echo $str;
Then in the add page before event..
global $conn,$strTableName;
if (@$_REQUEST["dropdown1"])

{

//------ modual request from pulldown menu-----//

$data1000["mod"]=$_REQUEST["dropdown1"];

echo $data1000["mod"];

//------ determin if current modual panel selected = previous select for current order------//

$str99 = "select
from order_items where ItemID=".$_SESSION["TEMPDATA"]." and Moduals ='".$data1000["mod"]."' and Order_num='".$_SESSION[$strTableName."_masterkey1"]."'";

$rs99 = CustomQuery($str99);

$data99 = db_fetch_array($rs99);

if ($data99["Moduals"])

{

echo "<font color=red><bold><MIDDLE><CENTER><big><b>XX____XX____XXXX </b></big></bold></MIDDLE></CENTER></font>";

echo "<font color=yellow><bold><MIDDLE><CENTER><big><b>Panel Already Selected For This Order </b></big></bold></MIDDLE></CENTER></font>";

echo "<font color=white><bold><MIDDLE><CENTER><big><b> please select another Panel</b></big></bold></MIDDLE></CENTER></font>";

echo "<font color=red><bold><MIDDLE><CENTER><big><b>XX____XX____XX
XX </b></big></bold></MIDDLE></CENTER></font>";

return false;

}

else

{
//=============== carry over values from other tables ===========//

$str114 = "select ItemThumb from items where ItemID='".$_SESSION["TEMPDATA"]."'";

$rs114 = CustomQuery($str114);

$data114 = db_fetch_array($rs114);

$values['ItemThumb'] = $data114['ItemThumb'];

$_SESSION["ItemThumb"] = $data114["ItemThumb"];
//=========================check event_times to see if current modual along with itemid type are avalible also sum of totals for a modual====================================//

$str212 = "select event_time_start,event_time_end from event_times where Order_ID=".$_SESSION[$strTableName."_masterkey1"];

$rsh212 = db_query($str212,$conn);

while ($data212= db_fetch_array($rsh212))

{

$str313 = "select sum(Qty_Order) as total_qty from event_times where Order_ID!=".$_SESSION[$strTableName."_masterkey1"]."

and Item_ID=".$_SESSION["TEMPDATA"]."

and Modual_type=".$data1000["mod"]."

and ".$data212["event_time_start"]." >= event_time_start

and ".$data212["event_time_start"]." <= event_time_end

and status ='1'

or Item_ID=".$_SESSION["TEMPDATA"]."

and Modual_type=".$data1000["mod"]."

and ".$data212["event_time_end"]." >= event_time_start

and ".$data212["event_time_end"]." <= event_time_end

and status ='1'

or Item_ID=".$_SESSION["TEMPDATA"]."

and Modual_type=".$data1000["mod"]."

and ".$data212["event_time_start"]." <= event_time_start

and ".$data212["event_time_end"]." >= event_time_end

and status ='1'";
$hrs313 = db_query($str313,$conn);

$rs313 = db_fetch_array($hrs313);
$str515 = "select Qty from modual_panels where ItemID=".$data1000["mod"];

$hrs515 = db_query($str515,$conn);

$rs515 = db_fetch_array($hrs515);
}

$data66["temp_total"] = $rs313["total_qty"]+1;

//======== if total = greater then 1 then none avalible, else submit order======//

if ($data66["temp_total"] > $rs515["Qty"])

{

echo "<font color=red><bold><MIDDLE><CENTER><big><b>XX____XX____XXXX </b></big></bold></MIDDLE></CENTER></font>";

echo "<font color=yellow><bold><MIDDLE><CENTER><big><b>NO Panel Avalible For This Day... </b></big></bold></MIDDLE></CENTER></font>";

echo "<font color=white><bold><MIDDLE><CENTER><big><b>please select another panel or go back to list</b></big></bold></MIDDLE></CENTER></font>";

echo "<font color=red><bold><MIDDLE><CENTER><big><b>XX____XX____XX
XX </b></big></bold></MIDDLE></CENTER></font>";

return false;

}

else

{
//==================================carry session data to values for ease of import of code from other pages====================================================//

$values["ItemID"]=$_SESSION["TEMPDATA"];

$values["Moduals"]=$data1000["mod"];

$data999["Order_num"]=$_SESSION[$strTableName."_masterkey1"];

//====================insert information into order_items (order items holds actual inventory request for an order========//

$sql1 = "insert into order_items(Order_num,ItemID,Qty_Order,ItemThumb,Moduals)values

('".db_addslashes($_SESSION[$strTableName."_masterkey1"])."','".db_addslashes($values["ItemID"])."'

,'".db_addslashes(1)."','".db_addslashes($values["ItemThumb"])."','".db_addslashes($data1000["mod"])."')";

db_exec($sql1,$conn);
//=========after insert of data into order items, select the line that the order was saved in to access that information more directly ===========//

$str55 = "select Line_num from order_items where Order_num=".$_SESSION[$strTableName."_masterkey1"]." and ItemID=

'".$values["ItemID"]."' and Moduals= '".db_addslashes($data1000["mod"])."'";

$rs55 = db_query($str55,$conn);

$data55 = db_fetch_array($rs55);
$values["Line_num"]=$data55["Line_num"];
//==========================================================================================

//==================Flag = value 1 or 0, 1 = yes 0= no ========//

$str7 = "select FlagID from items where ItemID=".$values["ItemID"];

$rs7 = db_query($str7,$conn);

$data7= db_fetch_array($rs7);

if($data7["FlagID"]==1)

//========================if item does have a delivery charge================//

{

$str5 = "select Delivery_cost from order_sales where Order_num=".$_SESSION[$strTableName."_masterkey1"];

$rs5 = db_query($str5,$conn);

$data5 = db_fetch_array($rs5);
$str6 = "select ItemRentalPrice from items where ItemID=".$values["ItemID"];

$rs6 = db_query($str6,$conn);

$data6 = db_fetch_array($rs6);
$strUpdate22 = "Update order_items set ItemRentalPrice=".$data6["ItemRentalPrice"]."

  • ".$data5["Delivery_cost"]." where Line_num=".$values["Line_num"]." and ItemID='".$values["ItemID"]."'and Moduals= '".$data1000["mod"]."'";

    db_exec($strUpdate22,$conn);

    //======================if item does not have a delivery charge===============//

    }

    else

    {

    $str51 = "select Delivery_cost from order_sales where Order_num=".$_SESSION[$strTableName."_masterkey1"];

    $rs51 = db_query($str5,$conn);

    $data51 = db_fetch_array($rs51);
    $str61 = "select ItemRentalPrice from items where ItemID=".$values["ItemID"];

    $rs61 = db_query($str6,$conn);

    $data61 = db_fetch_array($rs61);
    $strUpdate = "Update order_items set ItemRentalPrice=".$data61["ItemRentalPrice"]." where Line_num=".$values["Line_num"]." and ItemID='".$values["ItemID"]."'";

    db_exec($strUpdate,$conn);

    }
    // ========================This function is used to get sub_total of items passed to the details order_items page.=======//

    $str15 = "select from order_sales where Order_num=".$_SESSION[$strTableName."_masterkey1"];

    $rs15 = db_query($str5,$conn);

    $data15 = db_fetch_array($rs5);

    if ($data15["event_time_end"]>$data15["event_time_start"])

    {

    $st["Date3"] = (($data15["event_time_end"])-($data15["event_time_start"]))/(60
    6024);

    echo "positive";

    $st1["Date3"] = $st["Date3"]+1;

    echo $st1["Date3"];

    }

    else

    {

    echo "negative";

    $st1["Date3"]=1;

    }

    $str = "select ItemRentalPrice from order_items where Line_num=".$values["Line_num"]." and ItemID='".$values["ItemID"]."'";

    $rs = CustomQuery($str);

    $data7 = db_fetch_array($rs);
    $values ['ItemRentalPrice'] = $data7['ItemRentalPrice'];

    $values["Sub_total"] = $values["ItemRentalPrice"]
    $st1["Date3"]1;
    $strUpdate2 = "update order_items set Sub_total =".$values["Sub_total"]." where Order_num =".$_SESSION[$strTableName."_masterkey1"]." and Line_num='".$values["Line_num"]."' and ItemID='".$values["ItemID"]."'";

    db_exec($strUpdate2,$conn);
    $rs9 = CustomQuery("select sum(Sub_total) from order_items where Order_num=".$_SESSION[$strTableName."_masterkey1"]);

    $data9 = db_fetch_numarray($rs9);
    $strUpdate = "Update order_sales set Order_sub_total=".$data9[0]." where Order_num=".$_SESSION[$strTableName."_masterkey1"];

    db_exec($strUpdate,$conn);
    //===============================insert current new record to new table .....event_times orders===================================//

    $sql = "insert into event_times (Item_ID,Qty_Order,Line_Num,Order_ID,Modual_type) values

    ('".db_addslashes($_SESSION["TEMPDATA"])."','".db_addslashes(1)."','".db_addslashes($data55["Line_num"])."',

    '".db_addslashes($_SESSION[$strTableName."_masterkey1"])."','".db_addslashes($data1000["mod"])."')";

    db_exec($sql,$conn);

    // '".db_addslashes($data1000[0])."'
    //$sql = "insert into event_times (Item_ID,Qty_Order,Order_ID,Modual_type) values

    //('".db_addslashes($arr[0])."','".db_addslashes($arr[1])."'

    //,'".db_addslashes($_SESSION[$strTableName."_masterkey1"])."'

    //,'".db_addslashes(1)."')";

    //db_exec($sql,$conn);
    //======================================================================================//

    //============= update times on new table....... event_times table when any item is added===========//

    //======================================================================================//

    }

    $str = "select
    from order_sales";

    $rs = db_query($str,$conn);

    while ($data = db_fetch_array($rs))

    {

    $str1 = "update event_times set event_time_start='".db_addslashes($data["event_time_start"])."'

    , event_time_end='".db_addslashes($data["event_time_end"])."' where Order_ID=".$_SESSION[$strTableName."_masterkey1"];

    db_exec($str1,$conn);

    }
    //------------------update statues of sales------------------//

    $strUpdate = "Update order_sales set Order_status ='9'where order_num =".$_SESSION[$strTableName."_masterkey1"];

    db_exec($strUpdate,$conn);

    //----------------update order items line comment now start date of event-----------//

    $str100 = "select * from order_sales where Order_num=".$_SESSION[$strTableName."_masterkey1"];

    $rs100 = db_query($str100,$conn);

    while ($data100 = db_fetch_array($rs100))

    {

    $str200 = "update order_items set Line_comment ='".db_addslashes($data100["event_time_start"])."' where Order_num =".$_SESSION[$strTableName."_masterkey1"];

    db_exec($str200,$conn);
    //-----------------update status for event_times tracking only!------------//

    $strUpdate1 = "Update event_times set Status ='1' where Order_ID=".$_SESSION[$strTableName."_masterkey1"]." and Item_ID='".$values["ItemID"]."'";

    db_exec($strUpdate1,$conn);

    $keys["Order_num"]= $_SESSION[$strTableName."_masterkey1"];
    header("Location: order_sales_item_list_list.php?mastertable=order_sales&masterkey1=".$keys["Order_num"]);

    }

    exit();

    }}
    hope this code helps some of you out there! it works great now.!