<cfobject component="cfcs.qry" name="variables.qry" />

<cfset arguments.order_info_struct.order_key =
variables.qry.qry_order_commit_1 (

                app_user_id = arguments.order_info_struct.user.app_user_id,

                item_subtotal =
arguments.order_info_struct.totals.item_subtotal,

                tax = arguments.order_info_struct.totals.tax,

                total_before_tax =
arguments.order_info_struct.totals.total_before_tax,

                total_total =
arguments.order_info_struct.totals.total_total


                )/>


<cffunction access="public" name="qry_order_commit_1" output="no"
returntype="numeric">
    <cfargument name="app_user_id" type="numeric" required="yes">
    <cfargument name="item_subtotal" type="numeric" required="yes">
    <cfargument name="tax" type="numeric" required="yes">
    <cfargument name="total_before_tax" type="numeric" required="yes">
    <cfargument name="total_total" type="numeric" required="yes">

    <cfquery
        name="qry_order_commit_1"
        datasource="#variables.datasource#">

        declare        @orderKey int

        INSERT         #request.sqlObjectPrefix#tblOrders (
                        tblPeopleFK
                        ,shippingMethod
                        ,shippingCost
                        ,insurancecost
                        ,shippingtotal
                        ,shippingWeight
                        ,itemSubtotal
                        ,tax
                        ,totalBeforeTax
                        ,total
                        ,orderStatus
                    )
        SELECT        <cfqueryparam value="#val(arguments.app_user_id)#"
cfsqltype="CF_SQL_INTEGER">
                    ,oib.shippingMethod
                    ,oib.shippingCost
                    ,oib.insuranceamount
                    ,( oib.shippingCost + oib.insuranceamount )
                    ,oib.shippingWeight
                    ,<cfqueryparam value="#val(arguments.item_subtotal)#"
cfsqltype="CF_SQL_MONEY">
                    ,<cfqueryparam value="#val(arguments.tax)#"
cfsqltype="CF_SQL_MONEY">
                    ,<cfqueryparam value="#val(arguments.total_before_tax)#"
cfsqltype="CF_SQL_MONEY">
                    ,<cfqueryparam value="#val(arguments.total_total)#"
cfsqltype="CF_SQL_MONEY">
                    ,<cfqueryparam value="1" cfsqltype="CF_SQL_INTEGER">
        FROM        #request.sqlObjectPrefix#tblOrderInfoBuffer oib
        WHERE        oib.tblPeopleFK = <cfqueryparam
value="#val(arguments.app_user_id)#" cfsqltype="CF_SQL_INTEGER">

        SET NOCOUNT ON

        SELECT    @orderKey = SCOPE_IDENTITY()

        SET NOCOUNT OFF

        SELECT @orderKey as orderKey

    </cfquery>

    <cfreturn qry_order_commit_1.orderKey>

</cffunction>

arguments.order_info_struct.order_key remains undefined.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333963
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to