Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="Content">
- <% showHeader(100) %>
- <!--#INCLUDE FILE="inc/common/dept_top.asp" -->
- <%
- show_all = nz(mscsPage.RequestNumber("show_all", 0), 0)
- If show_all = 1 Then
- str_priority = ""
- Else
- str_priority = " AND c.priority < 50 "
- End If
- 'call WriteVar("CallFrom", false)
- 'call WriteVar("show_all", false)
- 'call WriteVar("str_priority", false)
- 'if request("call_from").count > 0 and CallFrom <> "US Continental" then
- if CallFrom <> "" AND CallFrom <> "US Continental" then
- call_from = split(CallFrom,",")
- call_from_country = call_from(0)
- if ubound(call_from) > 0 then
- call_from_state = Trim(call_from(1))
- cmdTemp.CommandText = "SELECT c.country, " & _
- "r.per_min + ia.surcharge AS cost_per_min, " & _
- "c.priority " & _
- "FROM discall_country c " & _
- "INNER JOIN discall_rates r ON " & _
- "c.id = r.call_to " & _
- "INNER JOIN international_access ia ON " & _
- "r.dept_id = ia.dept_id " & _
- "INNER JOIN discall_dept d ON " & _
- "ia.dept_id = d.dept_id " & _
- "WHERE d.dept_id = " & dept_id & _
- " AND r.call_from = 1 " & _
- " AND ia.country = " & SQLCode(call_from_country) & _
- " AND (ia.state = " & SQLCode(call_from_state) & _
- " OR ia.city = " & SQLCode(call_from_state) & ") " & _
- str_priority & _
- "ORDER BY c.country, cost_per_min"
- '" AND c.country NOT IN ('Lebanon', 'LEBANON CELL', 'Sudan', 'Ethiopia', 'ETHIOPIA CELL', 'Eritrea', 'Syria') " & _
- '"Convert(VarChar(10), r.per_min + ia.surcharge) AS cost_per_min, " & _
- 'call showQuery(cmdTemp.CommandText, -1, MSCS)
- else
- cmdTemp.CommandText = "SELECT c.country, " & _
- "r.per_min + ia.surcharge AS cost_per_min, " & _
- "c.priority, " & _
- "r.call_from, " & _
- "r.call_to " & _
- "FROM discall_country c " & _
- "INNER JOIN discall_rates r ON " & _
- "c.id = r.call_to " & _
- "INNER JOIN international_access ia ON " & _
- "r.dept_id = ia.dept_id " & _
- "INNER JOIN discall_dept d ON " & _
- "ia.dept_id = d.dept_id " & _
- "WHERE d.dept_id = " & dept_id & _
- " AND r.call_from = 1 " & _
- " AND ia.country = " & SQLCode(call_from_country) & _
- " AND ISNULL(ia.state, '') = '' " & _
- " AND ISNULL(ia.city, '') = '' " & _
- str_priority & _
- "ORDER BY c.country, cost_per_min"
- '" AND c.country NOT IN ('Lebanon', 'LEBANON CELL', 'Sudan', 'Ethiopia', 'ETHIOPIA CELL', 'Eritrea', 'Syria') " & _
- 'call showQuery(cmdTemp.CommandText, -1, MSCS)
- end if
- else
- cmdTemp.CommandText = "SELECT " & _
- "c.country, " & _
- "r.per_min AS cost_per_min, " & _
- "c.priority " & _
- "FROM discall_rates r " & _
- "INNER JOIN discall_country c ON " & _
- "r.call_to = c.Id " & _
- "WHERE r.dept_id = " & dept_id & _
- str_priority & _
- " ORDER BY c.country, cost_per_min "
- '" AND c.country NOT IN ('Lebanon', 'LEBANON CELL', 'Sudan', 'Ethiopia', 'ETHIOPIA CELL', 'Eritrea', 'Syria') " & _
- end if
- 'call showQuery(cmdTemp.CommandText, -1, MSCS)
- Dim rsRates, aRates, last_rec, max_cols, max_rows
- Dim ii, jj, kk
- Set rsRates = cmdTemp.Execute()
- on error resume next
- If Not rsRates.EOF Then
- aRates = rsRates.GetRows()
- last_rec = Ubound(aRates, 2) + 1
- Else
- last_rec = 0
- End If
- rsRates.Close()
- ' ѕерекачаем массив aRates в mass_rates - чтобы оставить уникальные
- ' страны (и вз¤ть дл¤ них, соответственно, самый дешЄвый тариф)
- Dim mass_rates: mass_rates = Array()
- last_rec = 0
- mass_ubound = Ubound(aRates, 2)
- For jj = 0 To mass_ubound
- cur_country = Trim(aRates(0, jj) & "")
- 'Response.Write ("cur_country = " & cur_country & "<br>")
- For jjj = jj + 1 To mass_ubound
- country = Trim(aRates(0, jjj) & "")
- If country <> cur_country OR jjj = mass_ubound Then
- new_ubound = Ubound(mass_rates) + 1
- Redim Preserve mass_rates (new_ubound)
- mass_rates (new_ubound) = Array(aRates(0, jj), aRates(1, jj), aRates(2, jj))
- jj = jjj - 1
- last_rec = last_rec + 1
- Exit For
- End If
- Next
- Next
- 'Response.Write ("last_rec = " & last_rec & "<br>")
- 'For ii = 0 To UBound(mass_rates)
- ' Response.Write ("cur_country = " & mass_rates(ii)(0) & "<br>")
- 'Next
- 'call WriteVar("new_ubound", false)
- max_cols = 2
- max_rows = Int(last_rec / max_cols)
- 'call WriteVar("last_rec", false)
- 'call WriteVar("max_rows", false)
- If max_rows * max_cols < last_rec Then
- max_rows = max_rows + 1
- End If
- %>
- <div class="FirstColumn">
- <table border="0" class="SimpleView" width="100%" cellpadding="0" cellspacing="0">
- <%
- For ii = 0 To max_rows - 1
- 'price = Split(FormatCents(aRates(1, ii) / 100), " ")
- price = Split(FormatCents(mass_rates(ii)(1) / 100), " ")
- %>
- <tr>
- <td><%= mass_rates(ii)(0) %><%'= aRates(0, ii) %></td>
- <td align="right"><b><%= price(0) %></b></td>
- <td width="35"><%= price(1) %>/min</td>
- </tr>
- <%
- If ii < max_rows - 1 Then
- call line_dot
- End If
- Next
- %>
- </table>
- </div>
- <div class="SecondColumn">
- <table border="0" class="SimpleView" width="100%" cellpadding="0" cellspacing="0">
- <%
- kk = ii
- For ii = kk To last_rec - 1 'max_rows - 1
- 'price = Split(FormatCents(aRates(1, ii) / 100), " ")
- price = Split(FormatCents(mass_rates(ii)(1) / 100), " ")
- %>
- <tr>
- <td><%= mass_rates(ii)(0) %><%'= aRates(0, ii) %></td>
- <td align="right"><b><%= price(0) %></b></td>
- <td width="35"><%= price(1) %>/min</td>
- </tr>
- <%
- If ii < last_rec - 1 Then
- call line_dot
- End If
- Next
- on error goto 0
- %>
- </table>
- </div>
- <div class="Division"></div>
- <div class="ShowAll"><a HREF="javascript: checkFormRates()">See all rates</a></div>
- <div class="Division"></div>
- <!--#INCLUDE FILE="inc/common/dept_bottom.asp" -->
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement