Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3761312
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:36:23+00:00 2026-05-19T10:36:23+00:00

So this page gets all the sales for todays date in a query and

  • 0

So this page gets all the sales for todays date in a query and then sums them up, but if a sale get’s canceled it also subtracts the canceled amount from the total amount, i don’t want it to do this and i have tryed many things and still cant get it.

set RScontest = Server.CreateObject("ADODB.Recordset")
    RScontest.ActiveConnection = ""
    RScontest.Source = SelectData
    RScontest.CursorType = 3
    RScontest.CursorLocation = 2
    RScontest.LockType = 1
    RScontest.Open()
    if not(rscontest.bof) and not(rscontest.eof) then%><font face="Arial,Helvetica,sans-serif" size=4"><b>
                 Sales</b>

                <table width="100%">

    <%
    st = ""
    pax = 0
    sales = 0
    PAXTotal = 0
    SALESTotal = 0


                while not rscontest.eof

                    if st <> rscontest.fields.item("status") THEN
                        if st <> "" then
                            response.write("<tr bgcolor='#F2F2F2'><td >")
                            %><font face="Arial,Helvetica,sans-serif" size="-1"><%
                            response.write("Sub Total")%>
                            </td>

                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>

                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>

                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>

                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>

                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>
    <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>

                            <td align='right'>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            <%response.write(PAX)%>
                            </td>
                            <td align='right'>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            <%response.write(formatnumber(Sales,2))%>
                            </td>
                            </tr>
                        <%PAXTotal = PAXTotal + PAX
                        SALESTotal = SALESTotal + Sales
                        PAX = 0
                        Sales = 0
                        end if%>

                        <%response.write("<tr bgcolor='#FADFA0'><td >")
                        %><font face="Arial,Helvetica,sans-serif" size="-1"><%
                        response.write(rscontest.fields.item("status") & " Bookings")%>
                        </td>
                        <td>
                        <font face="Arial,Helvetica,sans-serif" size="-1">
                        Departure</td>
                        <td>
                        <font face="Arial,Helvetica,sans-serif" size="-1">
                        Passenger</td>
                        <td>
                        <font face="Arial,Helvetica,sans-serif" size="-1">
                        Source</td>
                        <td>
                        <font face="Arial,Helvetica,sans-serif" size="-1">
                        Campaign</td>
    <td>
                        <font face="Arial,Helvetica,sans-serif" size="-1">
                        Tour</td>
                        <td>
                        <font face="Arial,Helvetica,sans-serif" size="-1">
                        Agent</td>
                        <td>
                        <font face="Arial,Helvetica,sans-serif" size="-1">
                        PAX</td>
                        <td>
                        <font face="Arial,Helvetica,sans-serif" size="-1">
                        Amount</td>
                        </tr>
                        <%st = rscontest.fields.item("status")
                    END IF

                    response.write("<tr><td>")

                    %><font face="Arial,Helvetica,sans-serif" size="-2"><%
                    response.write(rscontest.fields.item("book7") & " - " & rscontest.fields.item("BTIME"))
                    response.write("</td><td>")

                    %><font face="Arial,Helvetica,sans-serif" size="-2"><%
                    response.write(rscontest.fields.item("dep7"))
                    response.write("</td><td>")

                    %><font face="Arial,Helvetica,sans-serif" size="-2"><%
                    response.write(rscontest.fields.item("lead"))
                    response.write("</td><td>")

                    %><font face="Arial,Helvetica,sans-serif" size="-2"><%
                    response.write(rscontest.fields.item("hear"))
                    response.write("</td><td>")

                    %><font face="Arial,Helvetica,sans-serif" size="-2"><%
                    response.write(rscontest.fields.item("cname"))
                    response.write("</td><td>")

    %><font face="Arial,Helvetica,sans-serif" size="-2"><%
                response.write(rscontest.fields.item("theme") & " - " & rscontest.fields.item("tour"))
                    response.write("</td><td align='right'>")

                    %><font face="Arial,Helvetica,sans-serif" size="-2"><%
                    response.write(rscontest.fields.item("userid"))
                    response.write("</td><td align='right'>")

                    %><font face="Arial,Helvetica,sans-serif" size="-2"><%
                    response.write(rscontest.fields.item("pax_count"))
                    pax = pax + rscontest.fields.item("pax_count")
                    response.write("</td><td align='right'>")

                    %><font face="Arial,Helvetica,sans-serif" size="-2"><%
                    IF rscontest.fields.item("status") = "XL" then
                        response.write(formatnumber(rscontest.fields.item("CXVALUE"),2))
                        sales = sales - formatnumber(rscontest.fields.item("CXVALUE"),2)
                    ELSE
                        response.write(formatnumber(rscontest.fields.item("AMOUNT"),2))
                        sales = sales + formatnumber(rscontest.fields.item("AMOUNT"),2)
                    END IF

                response.write("<tr><td rowspan=1>")    
                %><font face="Arial,Helvetica,sans-serif" size="-2"></style><%
                    response.write(rscontest.fields.item("description"))




                    rscontest.movenext

                wend


                        if st <> "" then
                            response.write("<tr bgcolor='#F2F2F2'><td >")
                            %><font face="Arial,Helvetica,sans-serif" size="-1"><%
                            response.write("Sub Total")%>
                            </td>
                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>
                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>
                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>
                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>
    <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>

                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>
                            <td align='right'>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            <%response.write(PAX)%>
                            </td>
                            <td align='right'>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            <%response.write(formatnumber(Sales,2))%>
                            </td>
                            </tr>

                            <%
                            PAXTotal = PAXTotal + PAX
                            SALESTotal = SALESTotal + Sales
                            PAX = 0
                            Sales = 0

                            response.write("<tr bgcolor='#D3FFA1'><td >")
                            %><font face="Arial,Helvetica,sans-serif" size="-1"><%
                            response.write("Total")%>
                            </td>
                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>
                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>

                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>
                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>
    <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>
                            <td>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            </td>
                            <td align='right'>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            <%response.write(PAXTotal)%>
                            </td>
                            <td align='right'>
                            <font face="Arial,Helvetica,sans-serif" size="-1">
                            <%response.write(formatnumber(SalesTotal,2))%>
                            </td>
                            </tr>
                        <%end if%>

                </table>
    <%else%>
            No sales for this date...<BR><BR>
    <%end if
    RScontest.Close()%>




    </td>
    </tr>
    </table>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T10:36:24+00:00Added an answer on May 19, 2026 at 10:36 am

    Improving your Code

    Here’s a list of things to help you neaten your code up. Without spending much more time on it, I can’t see exactly what is wrong (or what you are asking) but following these steps should help you pinpoint the error:

    • Remove all <font> tags, use CSS
    • Your record loop would be better by taking values from the recordset into variables first, not calling them repeatedly throughout the loop, IE:

      Dim strTitle
      Dim intValue1
      Dim intTotal
      
      intTotal = 0
      
      while not rscommon.eof
      
          //Take your variables
          strTitle = rsCommon("title")
          intValue1 = rsCommon("value")
      
          //Process values here, referencing variables not recordset
          intTotal = intTotal + intValue1
      
          //Loop your table here
          response.write("<tr>")
      rsCommon.close
      wend
      

    These changes will improve the speed of your loop (significantly) and also make it a lot more structured, helping you pinpoint errors in your logic a lot faster and easier.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data access page which gets all it's data from a query
I have this function in jQuery that gets data from a page with POST,
This page should display a Google ad. I Tried everything but it's not working.
This page indicates that TabPage has a GotFocus event, but in Visual Studio 2008
This page says to use: var object = $.extend({}, object1, object2); But I prefer
I want to get all GET and POST parameters from Web Page. Let's say
My javascript paths work on this page: http://localhost:53049/ But not on this page: http://localhost:53049/Home/Messages
I have a master page that gets all its images from a table on
This page has been quite confusing for me. It says: Memory management in newLISP
This page in the Android documentation defines an element id as follows: <TextView android:id=@+id/label

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.