1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746
| <?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:fx="#fx-functions" exclude-result-prefixes="msxsl fx">
<xsl:output method="html" version="4.0" indent="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<xsl:template match="//dataroot" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8"/>
<title>Sale</title>
<style type="text/css"></style>
</head>
<body link="#0c0000" vlink="#050000">
<table border="1" bgcolor="#ffffff" cellspacing="0" cellpadding="0" id="CTRL1">
<colgroup>
<col style="TEXT-ALIGN: right; WIDTH: 2.499cm"/>
<col style="WIDTH: 2.499cm"/>
<col style="WIDTH: 2.499cm"/>
<col style="WIDTH: 2.499cm"/>
<col style="WIDTH: 2.499cm"/>
<col style="TEXT-ALIGN: right; WIDTH: 2.499cm"/>
<col style="WIDTH: 2.499cm"/>
<col style="WIDTH: 2.499cm"/>
<col style="WIDTH: 2.499cm"/>
<col style="WIDTH: 2.499cm"/>
<col style="TEXT-ALIGN: right; WIDTH: 2.499cm"/>
<col style="TEXT-ALIGN: right; WIDTH: 2.499cm"/>
<col style="WIDTH: 2.499cm"/>
<col style="WIDTH: 2.499cm"/>
<col style="WIDTH: 2.499cm"/>
<col style="WIDTH: 2.499cm"/>
<col style="TEXT-ALIGN: right; WIDTH: 2.499cm"/>
<col style="WIDTH: 2.499cm"/>
<col style="TEXT-ALIGN: right; WIDTH: 2.499cm"/>
</colgroup>
<tbody>
<tr>
<td>
<div align="center">
<strong>N°</strong>
</div>
</td>
<td>
<div align="center">
<strong>Journal_Prime</strong>
</div>
</td>
<td>
<div align="center">
<strong>Customer_Prime</strong>
</div>
</td>
<td>
<div align="center">
<strong>CurrencyCode</strong>
</div>
</td>
<td>
<div align="center">
<strong>DocType</strong>
</div>
</td>
<td>
<div align="center">
<strong>DocNumber</strong>
</div>
</td>
<td>
<div align="center">
<strong>DocDate</strong>
</div>
</td>
<td>
<div align="center">
<strong>DueDate</strong>
</div>
</td>
<td>
<div align="center">
<strong>OurRef</strong>
</div>
</td>
<td>
<div align="center">
<strong>YourRef</strong>
</div>
</td>
<td>
<div align="center">
<strong>Amount</strong>
</div>
</td>
<td>
<div align="center">
<strong>Discount</strong>
</div>
</td>
<td>
<div align="center">
<strong>AccountingPeriod</strong>
</div>
</td>
<td>
<div align="center">
<strong>VATMonth</strong>
</div>
</td>
<td>
<div align="center">
<strong>Year_Alfa</strong>
</div>
</td>
<td>
<div align="center">
<strong>Ventil</strong>
</div>
</td>
<td>
<div align="center">
<strong>VATAmount</strong>
</div>
</td>
<td>
<div align="center">
<strong>Status</strong>
</div>
</td>
<td>
<div align="center">
<strong>RateTaux</strong>
</div>
</td>
</tr>
</tbody>
<tbody id="CTRL2">
<xsl:for-each select="Sale">
<!-- Cache the current node incase the a field is formatted -->
<xsl:value-of select="fx:CacheCurrentNode(.)"/>
<tr>
<td>
<xsl:value-of select="N_x00B0_"/>
</td>
<td>
<xsl:value-of select="Journal_Prime"/>
</td>
<td>
<xsl:value-of select="Customer_Prime"/>
</td>
<td>
<xsl:value-of select="CurrencyCode"/>
</td>
<td>
<xsl:value-of select="DocType"/>
</td>
<td>
<xsl:value-of select="DocNumber"/>
</td>
<td>
<xsl:value-of select="DocDate"/>
</td>
<td>
<xsl:value-of select="DueDate"/>
</td>
<td>
<xsl:value-of select="OurRef"/>
</td>
<td>
<xsl:value-of select="YourRef"/>
</td>
<td>
<xsl:value-of select="Amount"/>
</td>
<td>
<xsl:value-of select="Discount"/>
</td>
<td>
<xsl:value-of select="AccountingPeriod"/>
</td>
<td>
<xsl:value-of select="VATMonth"/>
</td>
<td>
<xsl:value-of select="Year_Alfa"/>
</td>
<td>
<xsl:value-of select="Ventil"/>
</td>
<td>
<xsl:value-of select="VATAmount"/>
</td>
<td>
<xsl:value-of select="Status"/>
</td>
<td>
<xsl:value-of select="RateTaux"/>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</body>
</html>
</xsl:template>
<msxsl:script language="VBScript" implements-prefix="fx" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><![CDATA[ Option Explicit
' **********************************************************************************
' ** Functions dynamically generated to evaluate expressions used as a Control Source
' **********************************************************************************
' **********************************************************************************
' ** Functions dynamically generated to evaluate running sums
' **********************************************************************************
' This function will calculate the running sums and expressions for the Detail section
Function CalculateExpressions_Detail(CurrentNode, GroupNodes)
PrepExpressions CurrentNode, GroupNodes
On Error Resume Next
CalculateExpressions_Detail = ""
End Function
' This function will calculate the running sums and expressions for the Global section
Function CalculateExpressions_Global(CurrentNode, GroupNodes)
PrepExpressions CurrentNode, GroupNodes
On Error Resume Next
CalculateExpressions_Global = ""
End Function
' **********************************************************************************
' ** Functions dynamically generated to be used for sorting and grouping
' **********************************************************************************
' **********************************************************************************
' ** Code staticly copied for expressions to use
' **********************************************************************************
'variable declaration
Dim objCurrNode
Dim objCurrNodeT
Dim cGroupCount
Dim objGroupNodes
Set objGroupNodes = Nothing
Set objCurrNode = Nothing
cGroupCount = 0
Function PrepExpressions(CurrentNode, GroupNodes)
CacheCurrentNode CurrentNode
CacheGroupNodes GroupNodes
PrepExpressions = ""
End Function
Function CacheCurrentNode(objNodeList)
Set objCurrNode = objNodeList.item(0)
CacheCurrentNode = ""
End Function
Function CacheGroupNodes(objNodeList)
Set objGroupNodes = objNodeList
cGroupCount = objGroupNodes.length
CacheGroupNodes = ""
End Function
Function GroupValue_quarter(strValue)
GroupValue_quarter = Left(strValue, 4) & DatePart("q", BuildDateFromStr(strValue, False))
End Function
Function GroupValue_week(strValue)
GroupValue_week = Left(strValue, 4) & DatePart("ww", BuildDateFromStr(strValue, False))
End Function
Function GroupValue_interval(nValue, nInterval)
GroupValue_interval = Int(nValue / nInterval)
End Function
Function Page()
Page = 1
End Function
Function Pages()
Pages = 1
End Function
Function ToString(varValue)
On Error Resume Next
ToString = ""
ToString = CStr(varValue)
End Function
Function ToNumber(varValue)
On Error Resume Next
ToNumber = 0
ToNumber = CDbl(varValue)
End Function
Function FormatFromXSL(strRef, strFormat, iNumDecimals, LCID, nType)
FormatFromXSL = ToString(Format(GetValue(strRef, nType), strFormat, iNumDecimals, LCID, nType))
End Function
Function Format(varValue, strFormat, iNumDecimals, LCID, nType)
Dim FormatTemp
Dim strTemp
If IsDate(varValue) Then
Select Case strFormat
Case "General Date"
FormatTemp = FormatDateTime(varValue, vbGeneralDate)
Case "Long Date"
FormatTemp = FormatDateTime(varValue, vbLongDate)
Case "Medium Date"
If GetLocale = 1054 Then ' Special case for thai year
FormatTemp = Day(varValue) & "-" & MonthName(Month(varValue), True) & "-" & Right(FormatDateTime(varValue, vbShortDate), 2)
Else
FormatTemp = Day(varValue) & "-" & MonthName(Month(varValue), True) & "-" & Mid(Year(varValue), 3, 2)
End If
Case "Short Date"
FormatTemp = FormatDateTime(varValue, vbShortDate)
Case "Long Time"
FormatTemp = FormatDateTime(varValue, vbLongTime)
Case "Medium Time"
strTemp = FormatDateTime(varValue, vbLongTime)
If (IsNumeric(Mid(strTemp, 2, 1))) Then
FormatTemp = Mid(strTemp,1,5) & Mid(strTemp, 9)
Else
FormatTemp = Mid(strTemp,1,4) & Mid(strTemp, 9)
End If
Case "Short Time"
FormatTemp = FormatDateTime(varValue, vbShortTime)
Case Else
Select Case LCase(strFormat)
Case "yyyy", "q", "m", "y", "d", "w", "ww", "h", "n", "s"
FormatTemp = DatePart(LCase(strFormat), varValue)
Case Else
' This does not currently support custom formats such as dd-mmm-yyyy
FormatTemp = FormatDateTime(varValue, vbGeneralDate)
End Select
End Select
ElseIf IsNumeric(varValue) Then
Select Case strFormat
Case "General Number"
FormatTemp = varValue
Case "Currency"
FormatTemp = FormatCurrencyPerLocale(varValue, iNumDecimals, LCID)
Case "Euro"
' This does not really support the Euro format.
FormatTemp = FormatCurrencyPerLocale(varValue, iNumDecimals, LCID)
Case "Fixed"
If IsNumeric(iNumDecimals) Then
FormatTemp = FormatNumber(varValue, iNumDecimals, vbTrue, vbUseDefault, vbFalse)
Else
FormatTemp = FormatNumber(varValue, 2, vbTrue, vbUseDefault, vbFalse)
End If
Case "Standard"
If IsNumeric(iNumDecimals) Then
FormatTemp = FormatNumber(varValue, iNumDecimals, vbUseDefault, vbUseDefault, vbTrue)
Else
FormatTemp = FormatNumber(varValue, 2, vbUseDefault, vbUseDefault, vbTrue)
End If
Case "Percent"
If IsNumeric(iNumDecimals) Then
FormatTemp = FormatPercent(varValue, iNumDecimals)
Else
FormatTemp = FormatPercent(varValue)
End If
Case "Scientific"
Dim nExp
Dim nValue
If (varValue = 0) Then
nExp = 0
Else
nExp = Int(Log(Abs(varValue)) / Log(10))
End If
nValue = Round(CDbl(varValue)/(10^CDbl(nExp)), 2)
If (Sgn(nExp) < 0) Then
FormatTemp = FormatNumber(nValue, 2, vbTrue, vbFalse, vbFalse) & "E" & nExp
Else
FormatTemp = FormatNumber(nValue, 2, vbTrue, vbFalse, vbFalse) & "E+" & nExp
End If
Case "True/False"
If (CBool(varValue)) Then
FormatTemp = "True"
Else
FormatTemp = "False"
End If
Case "Yes/No"
If (CBool(varValue)) Then
FormatTemp = "Yes"
Else
FormatTemp = "No"
End If
Case "On/Off"
If (CBool(varValue)) Then
FormatTemp = "On"
Else
FormatTemp = "Off"
End If
Case Else ' This is a custom format
If nType = 6 Then ' This is a currency
FormatTemp = FormatCurrencyPerLocale(varValue, iNumDecimals, LCID)
End If
End Select
End If
If IsEmpty(FormatTemp) Then
FormatTemp = varValue
End If
If FHasNoContent(FormatTemp) Then
Format = " "
Else
Format = FormatTemp
End If
End Function
Function FormatCurrencyPerLocale(varValue, iNumDecimals, LCID)
Dim CurrentLCID
If LCID >< "" Then CurrentLCID = SetLocale(LCID)
If IsNumeric(iNumDecimals) Then
FormatCurrencyPerLocale = FormatCurrency(varValue, iNumDecimals)
Else
FormatCurrencyPerLocale = FormatCurrency(varValue)
End If
If Not IsEmpty(CurrentLCID) Then SetLocale CurrentLCID
End Function
Function FHasNoContent(objValue)
FHasNoContent = True
If IsNull(objValue) Then Exit Function
If IsEmpty(objValue) Then Exit Function
If Not IsObject(objValue) Then
If objValue = "" Then Exit Function
Else
If objValue Is Nothing Then Exit Function
End if
FHasNoContent = False
End Function
Function IIf(fCond, varTrue, varFalse)
If fCond Then
IIf = varTrue
Else
IIf = varFalse
End If
End Function
Function Nz(varValue, varReplace)
If FHasNoContent(varValue) Then
Nz = varReplace
Else
Nz = varValue
End If
End Function
Function Sum(strExpr)
Dim nSum, i
nSum = 0
Set objCurrNodeT = objCurrNode
For i = 0 To cGroupCount - 1
Set objCurrNode = objGroupNodes.item(i)
nSum = nSum + ToNumber(Eval(strExpr))
Next
Set objCurrNode = objCurrNodeT
Sum = nSum
End Function
Function Count(strExpr)
Dim nCount, i
If strExpr = "*" Then
Count = cGroupCount
Exit Function
End If
Set objCurrNodeT = objCurrNode
nCount = 0
For i = 0 To cGroupCount - 1
Set objCurrNode = objGroupNodes.item(i)
If Not FHasNoContent(Eval(strExpr)) Then
nCount = nCount + 1
End If
Next
Set objCurrNode = objCurrNodeT
Count = nCount
End Function
Function Avg(strExpr)
Dim nSum
Dim nCount
nSum = Sum(strExpr)
nCount = Count(strExpr)
If nCount > 0 Then
Avg = nSum / nCount
Else
Avg = nSum
End If
End Function
Function Min(strExpr)
Dim varMin, i
Dim varTemp
Set objCurrNodeT = objCurrNode
For i = 0 To cGroupCount - 1
Set objCurrNode = objGroupNodes.item(i)
varTemp = Eval(strExpr)
If IsEmpty(varMin) Or (varTemp < varMin) Then
varMin = varTemp
End If
Next
Set objCurrNode = objCurrNodeT
Min = varMin
End Function
Function Max(strExpr)
Dim varMax, i
Dim varTemp
varMax = Eval(strExpr)
Set objCurrNodeT = objCurrNode
For i = 0 To cGroupCount - 1
Set objCurrNode = objGroupNodes.item(i)
varTemp = Eval(strExpr)
If IsEmpty(varMax) Or (varTemp > varMax) Then
varMax = varTemp
End If
Next
Set objCurrNode = objCurrNodeT
Max = varMax
End Function
Function GetValue(strRef, nType)
' Set Null as the default return value
GetValue = Null
' Return Null if anything goes wrong
On Error Resume Next
Dim objNode
Set objNode = objCurrNode.selectSingleNode(strRef)
If (objNode Is Nothing) Or IsNull(objNode) Or IsEmpty(objNode) Or Not IsObject(objNode) Then
Exit Function
End If
Dim CurrentLCID
CurrentLCID = SetLocale(1033)
Select Case nType
Case 2 ' adSmallInt
GetValue = CLng(objNode.text)
Case 3 ' adInteger
GetValue = CLng(objNode.text)
Case 20 ' adBigInt
GetValue = CLng(objNode.text)
Case 17 ' adUnsignedTinyInt
GetValue = CLng(objNode.text)
Case 18 ' adUnsignedSmallInt
GetValue = CLng(objNode.text)
Case 19 ' adUnsignedInt
GetValue = CLng(objNode.text)
Case 21 ' adUnsignedBigInt
GetValue = CLng(objNode.text)
Case 4 ' adSingle
GetValue = CDbl(objNode.text)
Case 5 ' adDouble
GetValue = CDbl(objNode.text)
Case 6 ' adCurrency
GetValue = CCur(objNode.text)
Case 14 ' adDecimal
GetValue = CDbl(objNode.text)
Case 131 ' adNumeric
GetValue = CDbl(objNode.text)
Case 139 ' adVarNumeric
GetValue = CDbl(objNode.text)
Case 11 ' adBoolean
GetValue = CBool(objNode.text)
Case 7 ' adDate
GetValue = BuildDateFromStr(objNode.text, True)
Case 133 ' adDBDate
GetValue = BuildDateFromStr(objNode.text, True)
Case 134 ' adDBTime
GetValue = BuildDateFromStr(objNode.text, True)
Case 135 ' adDBTimeStamp
GetValue = BuildDateFromStr(objNode.text, True)
Case 8 ' adBSTR
GetValue = objNode.text
Case 120 ' adChar
GetValue = objNode.text
Case 200 ' adVarChar
GetValue = objNode.text
Case 201 ' adLongVarChar
GetValue = objNode.text
Case 130 ' adWChar:
GetValue = objNode.text
Case 202 ' adVarWChar
GetValue = objNode.text
Case 203 ' adLongVarWChar
GetValue = objNode.text
Case -7 ' Special value used to get just the date.
GetValue = BuildDateFromStr(objNode.text, False)
Case Else
GetValue = objNode.text
End Select
SetLocale CurrentLCID
End Function
Dim gStaticDate
Function StaticDate()
If IsEmpty(gStaticDate) Then gStaticDate = GetValue("/*/@generated", -7)
StaticDate = gStaticDate
End Function
Dim gStaticNow
Function StaticNow()
If IsEmpty(gStaticNow) Then gStaticNow = GetValue("/*/@generated", 7)
StaticNow = gStaticNow
End Function
Function BuildDateFromStr(strDate, fIncludeTime)
Dim CurrentLCID
CurrentLCID = SetLocale(1033)
' This requires that the Locale be set to en-us (1033).
BuildDateFromStr = CDate(Left(strDate,10))
If (fIncludeTime) Then
BuildDateFromStr = BuildDateFromStr + CDate(Right(strDate,8))
End If
SetLocale CurrentLCID
End Function
Function ArrayItem(arr, index)
If index > UBound(arr) Then
ArrayItem = ""
Else
ArrayItem = arr(index)
End If
End Function
Function HyperlinkPartFromNodeList(nodelist, nPart)
If nodelist.length = 0 Then
HyperlinkPartFromNodeList = ""
Else
HyperlinkPartFromNodeList = HyperlinkPartFromString(nodelist.item(0).text, nPart)
End If
End Function
Function HyperlinkPart(strRef, nPart)
HyperlinkPart = HyperlinkPartFromString(GetValue(strRef, 200), nPart)
End Function
Function HyperlinkPartFromString(strHyperlink, nPart)
Dim arrParts
Dim strHyperlinkPart
Dim strAddress, strSubAddress
arrParts = Split(strHyperlink, "#")
Select Case nPart
Case 0 ' acDisplayedValue
strHyperlinkPart = ArrayItem(arrParts, 0)
If strHyperlinkPart = "" Then
strAddress = ArrayItem(arrParts, 1)
strSubAddress = ArrayItem(arrParts, 2)
If strAddress = "" and strSubAddress = "" Then
strHyperlinkPart = ""
ElseIf strSubAddress = "" Then
strHyperlinkPart = strAddress
ElseIf strAddress = "" Then
strHyperlinkPart = strSubAddress
Else
strHyperlinkPart = strAddress & " - " & strSubAddress
End If
End If
Case 1 ' acDisplayText
strHyperlinkPart = ArrayItem(arrParts, 0)
Case 2 ' acAddress
strHyperlinkPart = ArrayItem(arrParts, 1)
Case 3 ' acSubAddress
strHyperlinkPart = ArrayItem(arrParts, 2)
Case 4 ' acScreenTip
strHyperlinkPart = ArrayItem(arrParts, 3)
Case 5 ' acFullAddress
strAddress = ArrayItem(arrParts, 1)
strSubAddress = ArrayItem(arrParts, 2)
If strAddress = "" and strSubAddress = "" Then
strHyperlinkPart = "#"
ElseIf strSubAddress = "" Then
strHyperlinkPart = strAddress
Else
strHyperlinkPart = strAddress & "#" & strSubAddress
End If
End Select
HyperlinkPartFromString = strHyperlinkPart
End Function
]]></msxsl:script>
</xsl:stylesheet> |