21. april 2007 - 10:12Der er
12 kommentarer og 1 løsning
subtotal for 12 måneder, én måned af gangen
Hejsa, hvordan får jeg nemmest nedenstående til at virke med ALLE 12 måneder???
strSQL = "select sum(Indskud) as sum_ind, sum(Debit) as sum_deb, sum(Kredit) as sum_kre from Regnskab Where Maaned = '1'" Set rs = Conn.Execute(strSQL)
Hos Computerworld it-jobbank er vi stolte af at fortsætte det gode partnerskab med folkene bag IT-DAY – efter vores mening Danmarks bedste karrieremesse for unge og erfarne it-kandidater.
for b = 1 to 12 strSQL = "select sum(Indskud) as sum_ind, sum(Debit) as sum_deb, sum(Kredit) as sum_kre from Regnskab Where Maaned = "& b Set rs = Conn.Execute(strSQL)
for b = 1 to 12 strSQL = "select sum(Indskud) as sum_ind, sum(Debit) as sum_deb, sum(Kredit) as sum_kre from Regnskab Where Maaned = "& b Set rs = Conn.Execute(strSQL) if not rs.eof then do SUM_IN = FormatNumber(Rs("sum_ind"),2) SUM_DE = FormatNumber(Rs("sum_deb"),2) SUM_KR = FormatNumber(Rs("sum_kre"),2) SALDO = FormatNumber(Rs("sum_ind") + Rs("sum_deb") - Rs("sum_kre"),2)
rs.movenext loop while not rs.eof set rs= nothing end if
next
'glemte lige et gemmenløb 'du laver en løkke der har fra 1 til 12 - dvs. dine måneder - jeg går ud fra at kolonnen Maaned er sat til kun at indeholde tal
<table align="center" style="font-size:13px;" width="960px"> <tr> <td style="font-weight:bold;text-align:center;" width="72px"></td> <td style="font-weight:bold;text-align:center;" width="74px"> jan</td> <td style="font-weight:bold;text-align:center;" width="74px"> Feb</td> <td style="font-weight:bold;text-align:center;" width="74px"> Mar</td> <td style="font-weight:bold;text-align:center;" width="74px"> Apr</td> <td style="font-weight:bold;text-align:center;" width="74px"> Maj</td> <td style="font-weight:bold;text-align:center;" width="74px"> Jun</td> <td style="font-weight:bold;text-align:center;" width="74px"> Jul</td> <td style="font-weight:bold;text-align:center;" width="74px"> Aug</td> <td style="font-weight:bold;text-align:center;" width="74px"> Sep</td> <td style="font-weight:bold;text-align:center;" width="74px"> Okt</td> <td style="font-weight:bold;text-align:center;" width="74px"> Nov</td> <td style="font-weight:bold;text-align:center;" width="74px"> Dec</td> </tr> </table> <table align="center" style="font-size:13px;" width="960px"> <tr> <td height="5px"></td> </tr> <% for b = 1 to 12 strSQL = "select sum(Indskud) as sum_ind, sum(Debit) as sum_deb, sum(Kredit) as sum_kre from Regnskab Where Maaned = "& b Set rs = Conn.Execute(strSQL) if not rs.eof then do SUM_IN = FormatNumber(Rs("sum_ind"),2) SUM_DE = FormatNumber(Rs("sum_deb"),2) SUM_KR = FormatNumber(Rs("sum_kre"),2) SALDO = FormatNumber(Rs("sum_ind") + Rs("sum_deb") - Rs("sum_kre"),2)
if b = 1 then %> <tr> <td width="72px">Indskud:</td> <% end if
if SUM_IN = "" then SUM_IN = " " %> <td style="text-align:right;" width="74px"><%=SUM_IN%></td> <% if b = 12 then %> </tr> <% end if
if SUM_DE = "" then SUM_DE = " " if b = 1 then %> <tr> <td width="72px">Indtægt:</td> <% end if %> <td style="text-align:right;" width="74px"><%=SUM_DE%></td> <% if b = 12 then %> </tr> <% end if
if SUM_KR = "" then SUM_KR = " " if b = 1 then %> <tr> <td width="72px">Udgift:</td> <% end if %> <td style="text-align:right;" width="74px"><%=SUM_KR%></td> <% if b = 12 then %> </tr> <% end if
if SALDO = "" then SALDO = " " if b = 1 then %> <tr> <td width="72px">Saldo:</td> <% end if %> <td style="text-align:right;" width="74px"><%=SALDO%></td> <% if b = 12 then %> </tr> <% end if
rs.movenext loop while not rs.eof set rs= nothing end if
Hej, alle tal kommer på samme linie ud for saldo...
<table align="center" style="font-size:13px;" width="960px"> <tr> <td style="font-weight:bold;text-align:center;" width="72px"></td> <td style="font-weight:bold;text-align:center;" width="74px"> jan</td> <td style="font-weight:bold;text-align:center;" width="74px"> Feb</td> <td style="font-weight:bold;text-align:center;" width="74px"> Mar</td> <td style="font-weight:bold;text-align:center;" width="74px"> Apr</td> <td style="font-weight:bold;text-align:center;" width="74px"> Maj</td> <td style="font-weight:bold;text-align:center;" width="74px"> Jun</td> <td style="font-weight:bold;text-align:center;" width="74px"> Jul</td> <td style="font-weight:bold;text-align:center;" width="74px"> Aug</td> <td style="font-weight:bold;text-align:center;" width="74px"> Sep</td> <td style="font-weight:bold;text-align:center;" width="74px"> Okt</td> <td style="font-weight:bold;text-align:center;" width="74px"> Nov</td> <td style="font-weight:bold;text-align:center;" width="74px"> Dec</td> </tr> </table> <table align="center" style="font-size:13px;" width="960px"> <tr> <td height="5px"></td> </tr> <!--#include file="connection.inc"--> <% for b = 1 to 12 strSQL = "select sum(Indskud) as sum_ind, sum(Debit) as sum_deb, sum(Kredit) as sum_kre from Regnskab Where Aar = '2007' AND Maaned = "& b Set rs = Conn.Execute(strSQL) if not rs.eof then do SUM_IN = Rs("sum_ind") SUM_DE = Rs("sum_deb") SUM_KR = Rs("sum_kre") SALDO = Rs("sum_ind") + Rs("sum_deb") - Rs("sum_kre")
if b = 1 then %> <tr> <td width="72px">Indskud:</td> <% end if
if SUM_IN = "" then SUM_IN = " " %> <td style="text-align:right;" width="74px"><%=SUM_IN%></td> <% if b = 12 then %> </tr> <% end if
if SUM_DE = "" then SUM_DE = " " if b = 1 then %> <tr> <td width="72px">Indtægt:</td> <% end if %> <td style="text-align:right;" width="74px"><%=SUM_DE%></td> <% if b = 12 then %> </tr> <% end if
if SUM_KR = "" then SUM_KR = " " if b = 1 then %> <tr> <td width="72px">Udgift:</td> <% end if %> <td style="text-align:right;" width="74px"><%=SUM_KR%></td> <% if b = 12 then %> </tr> <% end if
if SALDO = "" then SALDO = " " if b = 1 then %> <tr> <td width="72px">Saldo:</td> <% end if %> <td style="text-align:right;" width="74px"><%=SALDO%></td> <% if b = 12 then %> </tr> <% end if
rs.movenext loop while not rs.eof set rs= nothing end if
du skal selvfølgelige lige fjerne & b i disse sætninger
if SUM_IN = "" then SUM_IN = " " & b if SUM_DE = "" then SUM_DE = " "& b if SUM_KR = "" then SUM_KR = " "& b if SALDO = "" then SALDO = " "& b
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.