Calculate Total In Repeat Region
Hi,
I need to calculate a total based on fields in a repeat
region, these values
are stored in an SQL db, all are numeric and written in ASP.
fields are
TOTAL_COST VAT GRANDTOTAL (Page selects records based on
field parameter and displays in a repeat region)
At bottom of page need to show total sum like
TOTAL_COST(sum of above)
VAT(sum of above)
GRANDTOTAL(sum of above)
Thanks in advance
Simon
Above your repeat region declare three values like this
<%
Dim TCost = 0
Dim VAT=0
Dim GTotal = 0
%>
Then inside the repeat region simply have a line like this
<%
TCost = TCost + recordset.fields.item("cost").value
%>
Finally where you want the numbers to display you would have
the following
calculations
<%
VAT = TCost * .01
GTotal = TCost + VAT
%>
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"Simon Gare" <[email protected]> wrote in message
news:e71gpa$8la$[email protected]..
> Hi,
>
> I need to calculate a total based on fields in a repeat
region, these
> values
> are stored in an SQL db, all are numeric and written in
ASP.
>
> fields are
>
> TOTAL_COST VAT GRANDTOTAL (Page selects records based
> on
> field parameter and displays in a repeat region)
>
>
> At bottom of page need to show total sum like
>
> TOTAL_COST(sum of above)
> VAT(sum of above)
> GRANDTOTAL(sum of above)
>
> Thanks in advance
> Simon
>
>
Similar Messages
-
How to calculate totals in Blocked ALV Report
Hi All,
Can any body tell how to calculate totals & sub totals in
Blocked ALV Report[Blocked List].
Thanks in advance
Thanks & Regards,
Rayeezuddin.read this it might help
Sums
15. No_sumchoice(1) TYPE c : This parameter allows the choice for summing up
Only by fieldcatalog.
Value set: SPACE, 'X'
'X' = fields which are to be summed, passed by the calling program (FIELDCAT-DO_SUM = 'X'). The user should not be able to change this value interactively.
16. No_totalline(1) TYPE c : Removes the option of having totals after sub-totals.
Value set: SPACE, 'X'
'X' = no total record is to be output. Subtotals can still be calculated and output. The fields in the subtotals are flagged DO_SUM = 'X' in the field list.
17. No_subchoice(1) TYPE c : Does not allow the user to interactively change the field chosen for subtotals.
Value set: SPACE, 'X'
'X' = value whose change triggers subtotals, provided by the calling program. The user should not be able to change this value interactively.
18. No_subtotals(1) TYPE c : No subtotals possible
Value set: SPACE, 'X'
'X' = no subtotals.
19. Numc_sum(1) TYPE c : Totals only possible for NUMC-Fields.
20. No_unit_splitting TYPE c: No separate total lines by inh.units
21.totals_before_items TYPE c: Display totals before the items
22. Totals_only(1) TYPE c : Show only totals
Value set: SPACE, 'X'
'X' = only total records are output.
23. Totals_text(60) TYPE c : Text for 1st col. in totals
Value set: SPACE, string (max.60)
' ' = The first column in the total record contains an appropriate number of '*'s to indicate the total by default. If the first column is wide enough, the string 'Total' is output after the asterisks.
'String = The string passed is output after the total indicated by '*', if the column is wide enough.
24. Subtotals_text(60) TYPE c : Texts for subtotals
Value set: SPACE, string (max.60)
' ' = In the first column of subtotal records, the subtotal is indicated by an appropriate number of '*' by default. If the first column is not a subtotal criterion, the string 'Total' is output after the asterisks, if the column is wide enough.
'String = the string passed is output after the subtotal indicated by '*', if the column is wide enough and the first column is not a subtotal criterion. If it is a subtotal criterion, its value is repeated after the total, if the column is wide enough.
ELSE TELL ME I WILL PASTE COMPLETE HELP
regards -
PDF Template (repeating regions) correct version of Adobe Acrobat
Hi,
I want to build a PDF template for a Payslip I am knocking up at the moment and have come to the conclusion this may be easier as a PDF template rather than an RTF template.
The reason being I have multiple repeating regions in the payslip (earnings, deductions, salary history, payments) all of which could overflow onto another sheet of stationary when the job is run. If you think RTF is a better solution please post and let me know how I should achieve this. Or indeed if you think PDF is wrong also please let me know.
So I want to build a PDF template to utilise its overflow handling but what version of Adobe acrobat do I then need? 9 is the current release and there is a "Standard", "Pro" and "Pro-Extended" version of the software each with escalating costs associated. I see in Tim's blog the PDF has to be in the 1.4 specification which all the versions since 5 seem to support.
If you need anymore info in order to please let me know.
Cheers
DougAgreed RTF is a lot simpler to create and maintain.
I cannot seem to get my RTF template to behave with overflowing properties my basic design is Below (excuse the odd way of displaying it but I'm sure you get the idea). So any 1 of 4 repeating groups could go over their limits (I have currently hardcoded the loop limit in the group). I need the basic Emp info the Address info and the random info on each sheet.
I've been around the forum and all over the net (Anil Passi's site, XML/BI Publisher Blog etc.) looking at the solutions people have used for invoices and PO's but I cannot seem to use them in my case.
Any help you or anyone else could give on the subject would be gratefully received.
************************* Basic Emp info *************************
****Earnings Repeating Group***** ****Deductions Repeating Group*******
************************* Total Info *************************
*****Payments Repeating Group**** *****Salary Repeating Group *****
More random info ..
More random info ..
More random info ..
More random info ..
********************Address and Postal Info***********************
Cheers
Doug -
HI I'm currently designing a site and am using master/detail
pages linked to a database.
The master detail page set function in dw8 automatically
creates a repeatable region on the master page. I'm trying to add
an image to that specific repeat region so that each result shows
up with that image behind it (the image i'm using is a blank
rectangle with a specific borderframe so that it appears that each
result has this specific border)
If i try adding as background image the image repeats itself
but is out of line with the results! Any ideas how i can go about
achieving what i'm trying to do, that is assuming I haven't totally
bewildered you all in trying to explain it!!!!can i do that for each specific result? or will it not just
border all results in that style
the border i want is to match with button images etc... which
have a glow effect edge to them -
Hi There,
I am trying to sum a field in a repeat region.
That is, the repeat region displays on page as per normal but then have a total field based on the sub total fields stored in the data base for each record.
Any help is appreciated.
CheersHere's a quick idea of how to do it in CF. If you use PHP the principle would be the same.
<cfset ThisRowTotal = 0 >
<cfloop query="getPageLinks">
<cfset ThisRowTotal = ThisRowTotal + YourSubTotalVariable>
<cfoutput>#ThisRowTotal#<cfoutput>
</cfloop>
That's how it would look, what it is doing is each loop it is adding that loop's subtotal to the "ThisRowTotal" variable, then outputting it, so each loop will show the cumulative sub total.
Hope this helps.
Lawrence Cramer - *Adobe Community Professional*
http://www.Cartweaver.com
Shopping Cart for Adobe Dreamweaver
available in PHP, ColdFusion, and ASP
Stay updated - http://blog.cartweaver.com -
Hello all,
I've been working with templates for the past few weeks and I'm loving it!
Everything has gone smoothly till now. I'm having a very unsual problem with repeating regions and I can't seem to figure out what is causing it. Hopefully someone here can shed some light on this issue.
Basically, I have two templates: one parent and one child template. There are two repeating regions in total.
Problem: When I create a new page using the child template, the repeating regions disappear completely. Meaning, all the repeating region code surrounding an element is completely gone. In fact, my repeating regions have an editable region within it and they disappear with the repeating region! However, when I create a new page using the parent template itself, the repeating regions are there and everything is functioning as it should.
This is only happening with repeating regions. All editable regions, separate from repeating regions, are there.
I would really appreciate the help!
Thanks!I had no idea that nested templates are a serious problem in Dreamweaver.
It's not. It's a serious problem for users who opt to use them. Why? Because any benefit you derive from the coolness is more than offset by the disadvantages you experience down the road from their use. I am a devout user of templates and have never found a single scenario where the use of nested templates would help.
Most of my knowledge of Dreamweaver comes from Lynda.com's videos. I'm surprised that the instructor behind those videos never mentioned any such problem about nested templates.
Me too. To me this says that they have never *actually* used them either. It's very disappointing.
Is there any other way to replicate this functionality?
Yes, in every case there is. But first tell me how you were going to use them, please. What specifically is it about them that you were going to leverage in your page design?
When working with templates, I use the following scheme....
First, I mentally separate the page layout into three sections:
1. Stuff that will not change for the life of the site (i.e., the basic
structural elements)
2. Stuff that *could* change from time to time (e.g., navigation elements,
burst advertisements, section-specific navigation, etc.)
3. Stuff that *will* change from one page to the next
Then I create a template containing all class1 elements. Next I create
server-side include files containing all class 2 elements and place them on
the template as needed. Note - some of the class 2 elements may be
"section-specific elements", and their placement on the template will be
subject to the next item. Finally, I insert editable regions to cover the
class 3 items, INCLUDING the section-specific navigation.
This allows me to just cookie-cut the rest of the site. I estimate that
even for fairly large sites, about 80% of my work goes into planning and
creating this template file. -
Dreamweaver CS3
ASP / VBScript
Hi,
I'm trying to create a nested repeat region to display a list
of categories
and, in brackets afterwards, a count of the number of
sub-categories
contained in it E.g.
Cats (12)
Dogs (43)
Fish (92)
Etc
I have managed to create my repeat region ok because as soon
as I drop a
field in from the recordset, it loops through them all and
displays them
correctly. However, when I try and simply write out the total
number of
records found, it doesn't display anything.
Recordset 1 is a straighforward select from the table.
Recordset 2 adds a
WHERE clause usinga variable based on the 1st recordset. Here
is the code
i'm using for the 2 recordsets:
Recordset 1 :
<%
Dim Level1
Dim Level1_cmd
Dim Level1_numRows
Set Level1_cmd = Server.CreateObject ("ADODB.Command")
Level1_cmd.ActiveConnection = MM_SemiDirectory_STRING
Level1_cmd.CommandText = "SELECT * FROM TBL_Level1 ORDER BY
[Description]
ASC"
Level1_cmd.Prepared = true
Set Level1 = Level1_cmd.Execute
Level1_numRows = 0
%>
Recordset 2 :
<%
Dim Level2__varLink
Level2__varLink = "1"
If (level1.fields.item("Level1_ID").value <> "") Then
Level2__varLink = level1.fields.item("Level1_ID").value
End If
%>
<%
Dim Level2
Dim Level2_cmd
Dim Level2_numRows
Set Level2_cmd = Server.CreateObject ("ADODB.Command")
Level2_cmd.ActiveConnection = MM_SemiDirectory_STRING
Level2_cmd.CommandText = "SELECT * FROM TBL_Level2 WHERE
Level1_ID = ? ORDER
BY Level1_ID ASC"
Level2_cmd.Prepared = true
Level2_cmd.Parameters.Append
Level2_cmd.CreateParameter("param1", 5, 1, -1,
Level2__varLink) ' adDouble
Set Level2 = Level2_cmd.Execute
Level2_numRows = 0
%>
Now for the repeated code :
<%
While ((Repeat1__numRows <> 0) AND (NOT Level1.EOF))
%>
<li><a
href="category.asp?level1=<%=(Level1.Fields.Item("Level1_ID").Value)%>"><%=(Level1.Fields .Item("Description").Value)%>
(<%=(Level2_total)%>)
</li></a>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Level1.MoveNext()
Wend
%>
Can anyone tell me what I need to do to this code to make it
display the
number of sub-categories?
Thanks!!!Ok folks,
I found a way to get what I want. It's not pretty as I had to
make an extra
query in the database (that select of the count of all child
table results
for each parent category) and am pulling from that but it
works and that's
the main thing. I'm sure there is a more effective way of
doing it but
that's life!
I'm still interested in knowing the 'proper' way (if there is
such a thing)
so if you have the time to show me, i'm all ears!
Cheers!
"Mintyman" <[email protected]> wrote in message
news:[email protected]...
> Ok,
>
> So I closed the <li> code before the <a>
code. D'oh!
>
> Anyway, it returns a number now........the problem now
is that it returns
> the same value for each parent repeat!!!
>
> "Mintyman" <[email protected]> wrote in message
> news:[email protected]...
>> Dreamweaver CS3
>> ASP / VBScript
>>
>> Hi,
>>
>> I'm trying to create a nested repeat region to
display a list of
>> categories and, in brackets afterwards, a count of
the number of
>> sub-categories contained in it E.g.
>>
>> Cats (12)
>> Dogs (43)
>> Fish (92)
>> Etc
>>
>> I have managed to create my repeat region ok because
as soon as I drop a
>> field in from the recordset, it loops through them
all and displays them
>> correctly. However, when I try and simply write out
the total number of
>> records found, it doesn't display anything.
>>
>> Recordset 1 is a straighforward select from the
table. Recordset 2 adds a
>> WHERE clause usinga variable based on the 1st
recordset. Here is the
>> code i'm using for the 2 recordsets:
>>
>> Recordset 1 :
>>
>> <%
>> Dim Level1
>> Dim Level1_cmd
>> Dim Level1_numRows
>>
>> Set Level1_cmd = Server.CreateObject
("ADODB.Command")
>> Level1_cmd.ActiveConnection =
MM_SemiDirectory_STRING
>> Level1_cmd.CommandText = "SELECT * FROM TBL_Level1
ORDER BY [Description]
>> ASC"
>> Level1_cmd.Prepared = true
>>
>> Set Level1 = Level1_cmd.Execute
>> Level1_numRows = 0
>> %>
>>
>> Recordset 2 :
>>
>> <%
>> Dim Level2__varLink
>> Level2__varLink = "1"
>> If (level1.fields.item("Level1_ID").value <>
"") Then
>> Level2__varLink =
level1.fields.item("Level1_ID").value
>> End If
>> %>
>> <%
>> Dim Level2
>> Dim Level2_cmd
>> Dim Level2_numRows
>>
>> Set Level2_cmd = Server.CreateObject
("ADODB.Command")
>> Level2_cmd.ActiveConnection =
MM_SemiDirectory_STRING
>> Level2_cmd.CommandText = "SELECT * FROM TBL_Level2
WHERE Level1_ID = ?
>> ORDER BY Level1_ID ASC"
>> Level2_cmd.Prepared = true
>> Level2_cmd.Parameters.Append
Level2_cmd.CreateParameter("param1", 5,
>> 1, -1, Level2__varLink) ' adDouble
>>
>> Set Level2 = Level2_cmd.Execute
>> Level2_numRows = 0
>> %>
>>
>>
>> Now for the repeated code :
>>
>>
>> <%
>> While ((Repeat1__numRows <> 0) AND (NOT
Level1.EOF))
>> %>
>> <li><a
>>
href="category.asp?level1=<%=(Level1.Fields.Item("Level1_ID").Value)%>"><%=(Level1.Fields .Item("Description").Value)%>
>> (<%=(Level2_total)%>)
>> </li></a>
>>
>>
>> <%
>> Repeat1__index=Repeat1__index+1
>> Repeat1__numRows=Repeat1__numRows-1
>> Level1.MoveNext()
>> Wend
>> %>
>>
>> Can anyone tell me what I need to do to this code to
make it display the
>> number of sub-categories?
>>
>> Thanks!!!
>>
>>
>>
>
> -
Calculate total and average for same key figure
Hi Experts,
I have a requirement where I need to calculate total and average for same key figure no of employees.
eg:
If I enter 03,2009 as Input the reuslt should give from financiual year starting to current month.
11.2008 12.2008 1.2009 2.2009 3.2009 average
11 10 12 10 10 10.6
10 10 11 12 10 10.6
total 21 20 23 22 20 21.2
we have only one characteristic in rows... companycode.
Waiting for your Inputs.
Regards
Prasad Nannurino it will work for u
you have to use variable on 0calmonth or fiscal period depending on what Time characteristic u are using.
lets say that variable is zcalmonth
it is based on 0calmonth for e.g.
now u restrict keyfigure with this variable zcalmonth with time char. = 0CALMONTH
copy and paste the restricted keyfigure
now set offset for variable in variable selection screen dialog box = -1
repeat this until u want
make this variable mandatory
now at query execution user will select any value for month/year
and u will see all 5 months in result set
now there can be maximum 12 months in a year, so u end up creating only 12 restricted keyfigures.
use YEAR in restricted keyfigure too, and restrict it with YEAR VARIABLE processing by CUSTOMER EXIT = CURRENT YEAR
in this case it will automatically removes any additional values...
for e.e.g
YEAR = 2008 only
User entered 6/2008
so lets say ur financial year starts in april 2007 and ends in april 2008
so u expect to see
4/08
5/08
6/08
but u created 12 restricted keyfigures , so it will show upto
4,5,6 months only -
Using rsRecordsetB_total within rsRecordsetA repeat region?
Hi. Is it possible to display the total of a related
recordset (recordsetB)
within the repeat region of recordsetA?
Recordset A is customers and Recordset B is orders. We want
to display a
list of customers and the total number of orders they've
placed.
Thanks.
Nath.Hi. Is it possible to display the total of a related
recordset (recordsetB)
within the repeat region of recordsetA?
Recordset A is customers and Recordset B is orders. We want
to display a
list of customers and the total number of orders they've
placed.
Thanks.
Nath. -
Problem updating rows of recordset with repeat region
Hi,
So here's what I'm trying to do - I have a repeat region displaying a series of rows from a recordset. Each row has an "id" value and a "Votes" value. The id value is just an identifier, and the Votes value is the total number of votes. The rows are then organized by the Votes column in descending order (so that the row with the "most Votes" is displayed at the top). The whole thing is set up in kind of a table, so each row has a "Vote" button. When a user clicks the button it is supposed to increase that row's Votes by 1 - in effect creatign a Digg-style system.
I'm having two problems-
1. How can I get id value for the current row when using repeat region? I would assume that I first have to figure out the row, but how would I got about this?
2. This is probably a much simpler problem, but how do I add to a mysql integer instead of just replacing the number? Is there any add function? Or can I do it the "BASIC way" (x = x + y)?
Now for my code. What is here right now is a pretty simple "frame" of a website using PHP for the server-side scripting and MySQL for the database. Also, most of the PHP is generated by Dreamweaver, since I'm pretty novice when it comes to PHP.
Here is my "repeat region" section alone-
<?php do { ?>
<table width="780" border="0">
<tr>
<td width="195"><?php echo $row_all['Title']; ?></td>
<td width="195"><?php echo $row_all['Genre']; ?></td>
<td width="130"><?php echo $row_all['Year']; ?></td>
<td width="130"><?php echo $row_all['Votes']; ?></td>
<td width="65"><a href=<?php
$id1 = $row_all['id'];
$con = mysql_connect("localhost","root","");
if (!$con)
die('Could not connect: ' . mysql_error());
mysql_select_db("dig", $con);
mysql_query("UPDATE list SET Votes =300 WHERE id = '$id1'");
mysql_close($con);
?> >+1</a></td>
<td width="65">-1</td>
</tr>
</table>
<?php } while ($row_all = mysql_fetch_assoc($all)); ?>
And, for the sake of completition, here is the entire file-
BANNER
MENU
CONTENT
LIST
+1
-1
Just let me know if you need any more info, and thanks in advance!
-BHi David,
I read your reply and thankyou, but I am not sure I fully
understand. Could
you be a little more specific please.
"David Powers" <[email protected]> wrote in message
news:e9vsg2$ljd$[email protected]..
> JED wrote:
>> Why is this and what can I do?
>
> Answered your duplicate post in the main Dreamweaver
forum.
>
> --
> David Powers
> Author, "Foundation PHP for Dreamweaver 8" (friends of
ED)
> Author, "Foundation PHP 5 for Flash" (friends of ED)
>
http://foundationphp.com/ -
Use rsRecordset_total in a repeat region?
Hi,
Two recordsets. Recordset A contains customer details,
including their
unique customerID.
I have this in a repeat region, listing customers by order of
date.
Recordset B, on the same page, contains order details with a
PK called
orderID and a FK; customerID.
Is it possible to display the <%=(rsRecordsetB_total)%>
WITHIN the repeat
region for Recordset A so that, when viewing the list of
customers, we can
see how many orders each customer has made?
So far, it only displays the total for the first recordset
for every
customer and we've worked out that this is because we are
only repeating
Recordset A, not B, so, therefore, the total for Recordset B
won't change.
Hope someone can help,
Regards
nath.you could just nest a loop inside of a loop.
so lets say I have a filed that seletces users and all the prerequesists are defined inside of a veriable called query. Than i want to select all of there grades
while($getter1 = mysql_fetch_array($query))
echo $geter1['user'];
echo "<br />";
$select = "select * from gradebook were user='" . $geter1['user'] . "'";
$run = mysql_query($select)or die(mysql_error());
$i=1;
while($getter2 = mysql_fetch_array($run))
echo "grade" . $i . ": " . $getter2['grade'];
$i = $i + 1;
Now in this situation this would not be the best way to get the grades but it demonstrates nested loops (repeatable region inside a repeatable reigon)like what you want. I do however agree with the other person who posted you should use an SQL Join. -
Email php function repeat region not working
i have a form that needs to be emailed and it as products attached to it. however i have a repeat region to list all the products but when i email it ithe email only shows the first item on the list.
below is the form set up
//emailer
// Email new tenant information
$to = '[email protected]';// . ',' . '$row_rsOrder["Email"]';
//$to = $row_rsOrder["Email"];
$subject = "Your Order Details";
$message = "
<html>
<head>
<title>Dear ".$row_rsOrder['FirstName'].$row_rsOrder['LastName']." please see your Order Details Below</title>
</head>
<body>
<img src=\"http://www.website.com/images/logoBLPP.jpg\" alt=\"" />
<h2>Your B Order".$row_rsOrder['OrderID']."</h2>
<table width='800' border='0' cellspacing='0' cellpadding='0'>
<tr><td><p>Thank you for shopping below are you details of the order you have recently placed. If you have any questions please contact us</p>
<br />
</a></p>
<tr><td></td></tr></table>
<table width='980' border='1' cellspacing='0' cellpadding='10'>
<tr valign='top'>
<td bgcolor='#E9E9E9' class='header1'>Customer Name</td>
<td class='text'>".$row_rsOrder['FirstName'] . $row_rsOrder['LastName']."</td>
<td bgcolor='#E9E9E9' class='header1'>Order ID</td>
<td bgcolor='#E9E9E9' class='text'>".$row_rsOrder['OrderID']."</td>
<td bgcolor='#E9E9E9' class='header1'>Order Status</td>
<td class='text'>".$row_rsOrder['TransactResult']."</td>
</tr>
<tr valign='top'>
<td bgcolor='#E9E9E9' class='header1'>Email</td>
<td class='text'>".$row_rsOrder['Email']."</td>
<td bgcolor='#E9E9E9' class='header1'> </td>
<td class='text'> </td>
<td bgcolor='#E9E9E9' ><span class='header1'>Order Date</span></td>
<td class='text'>".makeDateTime($row_rsOrder['OrderDate'], '%#d %B %Y', true)."</td>
</tr>
<tr valign='top'>
<td bgcolor='#E9E9E9' class='header1'>Shipping Address</td>
<td class='text'><p>".$row_rsOrder['Address']."</p>
<p>".$row_rsOrder['Town']."</p>
<p>".$row_rsOrder['PostCode']."</p>
<p>".$row_rsOrder['Country']."</p>
<p> </p></td>
<td> </td>
<td> </td>
<td colspan='2' align='right' valign='bottom'><span class='header'> ORDER TOTAL:".DoFormatCurrency($row_rsOrder['Total'], 2, ',', '.', '£ ', '')."<br />
</span><span class='text'>Shipping:".DoFormatCurrency($row_rsOrder['Shipping'], 2, ',', '.', '£ ', '')."</span><span class='header'><br />
</span></td>
</tr>
<tr valign='top'>
<td bgcolor='#E9E9E9' class='header1'>Product ID</td>
<td bgcolor='#E9E9E9' class='header1'>Product Description</td>
<td bgcolor='#E9E9E9' colspan='2' class='header1'>Size</td>
<td bgcolor='#E9E9E9' ><span class='header1'>Quantity</span></td>
<td bgcolor='#E9E9E9' align='right'><span class='header1'>Price</span></td>
</tr>
<?php do { ?>
<tr valign='top'>
<td class='text'>".$row_rsOrder['ProductID']."</td>
<td class='text'>".$row_rsOrder['Product'].','.$row_rsOrder['catname']."</td>
<td colspan='2' class='text'>".$row_rsOrder['UnitSize']."</td>
<td><span class='text'>".$row_rsOrder['Quantity']."</span></td>
<td align='right' class='text'>". DoFormatCurrency($row_rsOrder['UnitPrice'], 2, ',', '.', '£ ', '')."</td>
</tr>
<?php } while ($row_rsOrder = mysql_fetch_assoc($rsOrder)); ?>
<tr valign='top'>
<td class='text'> </td>
<td class='text'> </td>
<td colspan='2' class='text'> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: company name <[email protected]>' . "\r\n";
$send = mail($to, $subject, $message, $headers);Yes, ALL product information in the database were retrieved and sent to the email. Only 3 products for testing purposes.
I just tested it down to the do-while loop. The html table code after that is missing.
You have to bare in mind this is a crude test. The database set up query is not as complex as yours is so that may be why its working but certainly breaking up the 'message' is the way to go. I may try and get the products from another table tomorrow if I have time to test.
The html code and column database names are the same as you have. the recordeset is 'rsOrders' instead of 'rsOrder' that you used,
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
mysql_select_db($database_conDonations, $conDonations);
$query_rsOrders = "SELECT * FROM orders";
$rsOrders = mysql_query($query_rsOrders, $conDonations) or die(mysql_error());
$row_rsOrders = mysql_fetch_assoc($rsOrders);
$totalRows_rsOrders = mysql_num_rows($rsOrders);
//emailer
// Email new tenant information
$to = '[email protected]';// . ',' . '$row_rsOrder["Email"]';
//$to = $row_rsOrder["Email"];
$subject = "Your Order Details";
$message = "
<html>
<head>
<title>Dear ".$row_rsOrders['FirstName']." please see your Order Details Below</title>
</head>
<body>
<img src=\"http://www.website.com/images/logoBLPP.jpg\" alt=\"\" />
<h2>Your B Order".$row_rsOrders['OrderID']."</h2>
<table width='800' border='0' cellspacing='0' cellpadding='0'>
<tr><td><p>Thank you for shopping below are you details of the order you have recently placed. If you have any questions please contact us</p>
<br />
</a></p>
<tr><td></td></tr></table>
<table width='980' border='1' cellspacing='0' cellpadding='10'>
<tr valign='top'>
<td bgcolor='#E9E9E9' class='header1'>Customer Name</td>
<td class='text'>".$row_rsOrders['FirstName']."</td>
<td bgcolor='#E9E9E9' class='header1'>Order ID</td>
<td bgcolor='#E9E9E9' class='text'>".$row_rsOrders['OrderID']."</td>
<td bgcolor='#E9E9E9' class='header1'>Order Status</td>
<td class='text'>".$row_rsOrders['TransactResult']."</td>
</tr>
<tr valign='top'>
<td bgcolor='#E9E9E9' class='header1'>Email</td>
<td class='text'>".$row_rsOrders['Email']."</td>
<td bgcolor='#E9E9E9' class='header1'> </td>
<td class='text'> </td>
<td bgcolor='#E9E9E9' ><span class='header1'>Order Date</span></td>
<td class='text'>".$row_rsOrders['OrderDate']."</td>
</tr>
<tr valign='top'>
<td bgcolor='#E9E9E9' class='header1'>Shipping Address</td>
<td class='text'><p>".$row_rsOrders['Address']."</p>
<p>".$row_rsOrders['Town']."</p>
<p>".$row_rsOrders['PostCode']."</p>
<p>".$row_rsOrders['Country']."</p>
<p> </p></td>
<td> </td>
<td> </td>
<td colspan='2' align='right' valign='bottom'><span class='header'> ORDER TOTAL:".$row_rsOrders['Total']."<br />
</span><span class='text'>Shipping:".$row_rsOrders['Shipping']."</span><span class='header'><br />
</span></td>
</tr>
<tr valign='top'>
<td bgcolor='#E9E9E9' class='header1'>Product ID</td>
<td bgcolor='#E9E9E9' class='header1'>Product Description</td>
<td bgcolor='#E9E9E9' colspan='2' class='header1'>Size</td>
<td bgcolor='#E9E9E9' ><span class='header1'>Quantity</span></td>
<td bgcolor='#E9E9E9' align='right'><span class='header1'>Price</span></td>
</tr>";
?>
<?php do { ?>
<?php $message .=" <tr valign='top'>
<td class='text'>".$row_rsOrders['ProductID']."</td>
<td class='text'>".$row_rsOrders['Product']."</td>
<td colspan='2' class='text'>".$row_rsOrders['UnitSize']."</td>
<td><span class='text'>".$row_rsOrders['Quantity']."</span></td>
<td align='right' class='text'>".$row_rsOrders['UnitPrice']."</td>
</tr>";
?>
<?php } while ($row_rsOrders = mysql_fetch_assoc($rsOrders)); ?>
<?php $message .="
</body>
</html>";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: company name <[email protected]>' . "\r\n";
$send = mail($to, $subject, $message, $headers);
mysql_free_result($rsOrders);
?> -
Spry collapsible panel - repeating region
Hi,
I'm trying to make a repeating region that contains a spry
collapsable panel.
The problem is that i need to develop a way to automatically
increase the ID of the spry panel.
The problem I am encountering is that only the first
Collapsible Panel works properly. The remainder are displaying the
data, but will not open and close when their tabs are clicked. It
appears that all are being repeated as
id="CollapsiblePanel1".
Does anyone have a way to increment the Tab & Content
ID's?
On another forum, somebody has suggested using the following
PHP - although having never used PHP before, I am uncertain as to
where I insert this into my code:bump
-
How can I use a Looper inside a Repeat Region?
I have a Dreamweaver standard Repeat Region applied to a HTML table containing two horizontal loopers. The HTML table is to display a list of company contacts for our members. The loopers display find for the first company but after that they stop. To key the loopers to the company Im using a trick mentioned by Günter Schenk in this thread: http://www.adobeforums.com/webx/.59b524b4/5. He calls it a sub query; at times I use to help myself by using some sort of "sub query" like the following
<br />
<br />Ive linked my looper recordset to the recordset used for the Repeat Region. Heres one of the looper queries:
<br />
<br />$KTColParam1_rsContactFeatures = "-1";
<br />if (isset($_SESSION["kt_login_id"])) {
<br />$KTColParam1_rsContactFeatures = $_SESSION["kt_login_id"];
<br />}
<br />mysql_select_db($database_RNW, $RNW);
<br />$query_rsContactFeatures = sprintf("SELECT DISTINCT list_feature.description_feature, company.id_company, contact_cnt.idpremissions_cnt FROM (((company LEFT JOIN company_to_feature ON company_to_feature.idcompany=company.id_company) RIGHT JOIN list_feature ON list_feature.id_list_feature=company_to_feature.idlistfeature) LEFT JOIN contact_cnt ON contact_cnt.idcompany_cnt=company.id_company) WHERE company.id_company='".$row_rsContactAll['id_company']."' AND company_to_feature.id_feature is not null AND contact_cnt.idpremissions_cnt=%s ORDER BY company.id_company ASC ", GetSQLValueString($KTColParam1_rsContactFeatures, "int"));
<br />$rsContactFeatures = mysql_query($query_rsContactFeatures, $RNW) or die(mysql_error());
<br />$row_rsContactFeatures = mysql_fetch_assoc($rsContactFeatures);
<br />$totalRows_rsContactFeatures = mysql_num_rows($rsContactFeatures);
<br />
<br />This is my link in both quires: WHERE company.id_company='".$row_rsContactAll['id_company']."'
<br />
<br />Heres the code for the connected looper:
<br />
<br /><?php<br />do { // horizontal looper version 3<br />?>
<br />
<br />
<br />
<br />
<br />As I said this works fine for the first item in the list but then it quits. Heres a screen shot of what I dont want: http://www.retirenw.com/images/help/looper_inside_repeat_region.gif
<br />
<br />Is there anyway to change the php for the loopers to make this work?
<br />
<br />Thanks for your help
<table>
<tr>
<td>
<img src="../images/bullet.gif" width="8" height="14" />
</td>
<td>
<?php echo $row_rsContactFeatures['description_feature']; ?>
</td><?php <br />$row_rsContactFeatures = mysql_fetch_assoc($rsContactFeatures);<br />if (!isset($nested_rsContactFeatures)) { <br />$nested_rsContactFeatures= 1;<br />}<br />if (isset($row_rsContactFeatures) && is_array($row_rsContactFeatures) && $nested_rsContactFeatures++ % 1==0) {<br />echo "</tr><tr>";<br />}<br />} while ($row_rsContactFeatures); //end horizontal looper version 3<br />?>
</tr>
</table>I found an easy solution.
I moved my looper quires out of my head and into my bodyinside the repeat region (the Looper Wizard puts the quires in the head). I put the quires right before my looper code. Finally, I had to make sure my conditional regional code came after the looper quires but before the looper code. -
Help with Spry Rating Widget within a Spry Repeating Region
My link http://www.youthinkyougotitbad.com
This is a long question, but it seems to me if answered somewhere it could help alot of people in the spry community creating comment boards as it uses three important spry widgets: rating, repeating, and tabbed panels. I am trying to use spry rating widget within a spry repeating region within a spry tabbed panel with xml. I was trying to go with the pulse light script (http://forums.adobe.com/message/3831721#3831721) but Gramps told me about the spry rating widget. But I have ran into a couple more problems. First, I couldnt find that much information on the forums or online about how to do the php page with the spry rating widget. None of these have any information on how to do it:
http://labs.adobe.com/technologies/spry/articles/rating_overview/index .html
http://labs.adobe.com/technologies/spry/articles/data_api/apis/rating. html
http://labs.adobe.com/technologies/spry/samples/rating/RatingSample.ht ml
And it seems that the official examples are so poor (or I am just ignorant, which def could be a possiblity) it shows
to set the initial rating value from the server, but uses a static value of 4
http://labs.adobe.com/technologies/spry/samples/rating/RatingSample.html
<span id="initialValue_dynamic" class="ratingContainer">
<span class="ratingButton"></span>
<span class="ratingButton"></span>
<span class="ratingButton"></span>
<span class="ratingButton"></span>
<span class="ratingButton"></span>
<input id="spryrating1_val" type="text" name="spryrating1" value="4" readonly="readonly" />
<span class="ratingRatedMsg sample">Thanks for your rating!</span>
</span>
<script>
var initialValue_dynamic = new Spry.Widget.Rating("initialValue_dynamic", {ratingValueElement:'spryrating1_val'});
</script>
I finally found a site that has the php and mysql setup.
http://www.pixelplant.ro/en/articles/article-detail/article/adobe-widgets-for-download.htm l
But its not perfect. It has the same problem that I ran into with Pulse light, that you had to use php echo within the spry repeating region to set the initial value from the server:
<span id="spryrating1" class="ratingContainer">
<span class="ratingButton"></span>
<input type="text" id="ratingValue" name="dynamic_rate" value="<?php echo $row['average']?>"/>
</span>
<script type="text/javascript"
var rating1 = new Spry.Widget.Rating("spryrating1", {ratingValueElement:'ratingValue', afterRating:'serverValue', saveUrl: 'save.php?id=spryrating1&val=@@ratingValue@@'});
</script>
So instead, I tried with three of my panels (www.youthinkyougotitbad.com) to get the average rating from xml by using the following queries:
Recent
Returns the blurts in most recent order along with average rating
SELECT Blurt.Id_blurt, Blurt.Name, Blurt.Location, Blurt.Blurt,Blurt.`Date`,DATE_FORMAT(Blurt.`Date`, '%l:%i %p on %M %D, %Y') as Date, ratings.rating_id, Avg(ratings.rating_value) as average_r FROM ratings Left Join Blurt On ratings.rating_id = Blurt.Id_blurt Group By Id_blurt ORDER BY Blurt.`Date` DESC
Wet Eyed
Returns the blurts in highest ratings order along with the average rating
SELECT Blurt.Id_blurt, Blurt.Name, Blurt.Location, Blurt.Blurt, DATE_FORMAT(Blurt.`Date`, '%l:%i %p on %M %D, %Y') as Date, ratings.rating_id, Avg(ratings.rating_value) as average_r FROM ratings Left Join Blurt On ratings.rating_id = Blurt.Id_blurt AND ratings.rating_value > 0.1 Group By Id_blurt ORDER BY average_r Desc
Dry Eyed
Returns the blurts in lowest rating order along with the average rating
SELECT Blurt.Id_blurt, Blurt.Name, Blurt.Location, Blurt.Blurt, DATE_FORMAT(Blurt.`Date`, '%l:%i %p on %M %D, %Y') as Date, ratings.rating_id, Avg(ratings.rating_value) as average_r FROM ratings Left Join Blurt On ratings.rating_id = Blurt.Id_blurt AND ratings.rating_value > 0.1 Group By Id_blurt ORDER BY average_r
These all return the correct xml in the correct order.And they return the average rating of each blurt which I can send to my page with xml.
My first question is that I dont know how to configure the query on my fourth panel Empathized & Advised the same way because it already has a Group By for the Comment Id.
SELECT `Comment`.id_Blurt, COUNT(*) as frequency, Blurt.Id_blurt, Blurt.Name, Blurt.Location, Blurt.Blurt, DATE_FORMAT(Blurt.`Date`, '%l:%i %p on %M %D, %Y') as Date FROM Blurt, `Comment` WHERE Blurt.Id_blurt = `Comment`.id_Blurt GROUP BY `Comment`.id_Blurt ORDER BY COUNT(*) DESC";
Not sure if you guys need more information to understand that all, if so just ask.
So after I get my average value through xml to the first three panels, I set my spry repeating region up like this:
(Blurt panel)
<div spry:region="pv1" spry:repeatchildren="pv1">
<div class="blurtbox">
<!-- most recent blurt tab-->
<h3> "{pv1::Blurt}"</h3>
<p> Blurted from {pv1::Location} at {pv1::Date}</p>
<p>Empathize or Advise about {pv1::Name}'s Blurt #<a href="detailblurt.php?blurtid={pv1::Id_blurt}"> {pv1::Id_blurt}</a></a></p>
<span id="{pv1::Id_blurt}" class="ratingContainer">
<span class="ratingButton"></span>
<span class="ratingButton"></span>
<span class="ratingButton"></span>
<span class="ratingButton"></span>
<span class="ratingButton"></span>
<span class="ratingRatedMsg">Thank You! Your tears have been tallied.</span>
<input type="text" id="ratingValue" name="dynamic_rate" value="{pv1::average_r}"/>
</span>
<script type="text/javascript">
// overview of available options and their values:
// http://labs.adobe.com/technologies/spry/articles/rating_overview/index.html
var rating1 = new Spry.Widget.Rating("{pv1::Id_blurt}", {ratingValueElement:'ratingValue', afterRating:'serverValue', saveUrl: 'save.php?id={pv1::Id_blurt}&val=@@ratingValue@@'});
</script>
<br/>
</div>
</div>
Ok, it registers the right vote in the database with the right blurt id each time. But I am having two problems so far:
One, even though {pv1::average_r} returns the correct average through xml, it doesn't show the initial rating value for each of the repeating blurts. It seems to show the first one correct, and then just repeat that same value to the other ones that follow. I just dont understand since it can get the correct server value right after you vote (afterRating:'serverValue), that I can't manipulate spryrating.js in some way that I could just replace 'ratingValue' in ratingValueElement:'ratingValue' with something to give me the initial server value.
Two: Is even more mysterious to me, if you play around with voting on the site, sometimes you are unable to vote on different blurts. Its weird. It seems like that the javascript is completely off just on those blurts. And sometimes its a whole row, sometimes none. But so far its never a problem on the first tabbed panel (Recent), only on the other three. As far as I know, the coding is exactly the same in each tab's repeating region except for the different xml input.
And, now on the live server, sometimes the pics of tears used to voting dont show up until you click.
Any help on those three questions (how to query the fourth panel, how to show the initial server value, and the glitches with voting) would be greatly appreciated!! I looked pretty hard on adobe forums and other sites, and didnt see much on how to really use the spry rating widget with php and xml.
Thanks!!Update:
Ok, the first query on the Recent tab doesnt work for me because it wont show unless its already voted, and since these are supposed to be new blurts, that kind of breaks the whole site:
"SELECT Blurt.Id_blurt, Blurt.Name, Blurt.Location, Blurt.Blurt,Blurt.`Date`,DATE_FORMAT(Blurt.`Date`, '%l:%i %p on %M %D, %Y') as Date, ratings.rating_id, Avg(ratings.rating_value) as average_r FROM ratings Left Join Blurt On ratings.rating_id = Blurt.Id_blurt Group By Id_blurt ORDER BY Blurt.`Date` DESC";
So I replaced it with what I originally had.
"SELECT Blurt.Id_blurt, Blurt.Name, Blurt.Location, Blurt.Blurt,Blurt.`Date`,DATE_FORMAT(Blurt.`Date`, '%l:%i %p on %M %D, %Y') as Date FROM Blurt ORDER BY Blurt.`Date` DESC";
But this doesn't provide me with the initial average rating:(
Maybe you are looking for
-
I keep getting the following Disk Utility error message after a permissions repair, even after using DU from the Leopard installation DVD: Repairing permissions for "Michael" Warning: SUID file "usr/libexec/load_hdi" has been modified and will not be
-
Re-applying colour to a b&w image.
How does one re-apply the original colour to a selected part of the photo which has been converted to b&w ? I can add b&w to selected part of a colour image but don't know how to do it in reverse. Many thanks
-
Get weekday of DD/MM/YYYY
I thought I'd almost got here with this script set ShotDate to do shell script "exiftool -s3 -DateTimeOriginal /Users/StudioA/Desktop/MJC_0025.JPG " log ShotDate set theYear to (characters 1 thru 4 of ShotDate) as text set theMonth to (characters 6 t
-
Use running total to get cumulative value
Just want to clarify, can it be get the cumulative value of string instead of numeric figure by using running total function? for example: Date Action 01/Jun Created 02/Jun Deleted 03/Jun Created 11/Jul Deleted 12/J
-
Create user in service marketplace
Hi Basis Gurus, 1. Can u plz tell me how to create a user in the service market place. 2.How to create developer keys . Thanking You in Advance. Vikram Krishna.