<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<xsl:output version="4.0" method="html" indent="no" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN" />
	<xsl:param name="SV_OutputFormat" select="HTML"/>
	<xsl:template match="/">
		<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
			<head>
				<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
				<meta name="copyright" content="2007 Stratus Technologies"></meta>
				<script type="text/javascript">
					// <![CDATA[
					function toggle_display(tree_td, $item_id)
					{
						$item = document.getElementById($item_id);

						if ($item.style.display == 'none')
						{
							$item.style.display = '';
							tree_td.innerHTML = '-';
						}
						else
						{
							$item.style.display = 'none';
							tree_td.innerHTML = '+';
						}
					}
					// ]]>
				</script>
				<style type="text/css">
				<xsl:comment>
					// <![CDATA[
						body {
							width: 100%;
							text-align: center;
						}
					
					/* Page Definition */
						.page {
							width: 7.50in;
							height: 10in;
							font-family: Verdana,Helvetica,Arial,sans-serif;
							font-size: 10pt;
							margin-left: auto;
							margin-right: auto;
							position: relative;
							overflow: hidden;
							text-align: left;
						}
						div.page:not(:first-child) {
							page-break-before: always;
						}
						#header {
							height: 2.25in;
							clear: both;
						}
						.body.small {
							height: 5.125in;
							clear: both;
						}
						.body.large {
							height: 7.75in;
							clear: both;
						}
						#footer {
							height: 2.625in;
							clear: both;
						}
						
						table {
							font-family: Verdana,Helvetica,Arial,sans-serif;
							font-size: 10pt;
							width: 100%;
							border:1px solid black;
						}
						thead td {
							border-bottom:1px solid black;
							background-color: #70AED3;
							font-weight: bold;
						}
						tbody td {
							padding-left: 5px;
						}
						tfoot td {
							border-top: 1px solid black;
							font-size: 11pt;
						}
						
						table td:last-child {
							width: 1in;
							text-align: right;
						}
						
						div.container {
							overflow: hidden;
							width: auto;
						}
						
						h1 {
							font-size: 14pt;
							height: .325in;
							margin: 0;
							padding: 5px 0 0 0;
							background-color: #70AED3;
						}
						h2 {
							font-size: 12px;
							height: .325in;
							margin: 0;
							padding: 5px 10px 0 0;
							background-color: #70AED3;
							text-align: right;
						}
						h3 {
							font-size: 14pt;
							height: .325in;
							margin: 0;
							padding: 5px 0 0 0;
						}
						
					/* Locational Setting */
						.left {
							float: left;
							text-align: left;
						}
						.right {
							float: right;
							text-align: right;
						}
						.center {
							text-align: center;
						}
						
					/* Columnize dl */
						dl.columnize {
							width: 100%;
							margin: 0;
							overflow: hidden;
						}
						dl.columnize dt {
							width: 40%;
							float: left;
							clear: left;
							padding-top: 1%;
						}
						dl.columnize.inside dt {
							text-align: right;
						}
						dl.columnize dd {
							width: 58%;
							float: left;
							margin: 0 0 0 1%;
							padding-top: 1%;
						}
						dl.columnize.inside dd {
							text-align: left;
						}
						dl.columnize.outside dd {
							text-align: right;
						}
						
					/* Spacers */
						hr.divider {
							border:0 none;
							padding: 3px;
							visibility: hidden;
							clear: both;
						}
						// ]]>
					</xsl:comment>
					</style>
					<xsl:comment><![CDATA[[if IE]>
					<style type="text/css">
						div.container {
							width: 100%;
						}
						h2 {
							padding: 0px 10px 0 0;
						}
					</style>
					<![endif]]]></xsl:comment>

				</head>
				<body>
				<div class="page">
					<div id="header" class="container">
						<div class="left" style="width:50%">
							<xsl:element name="img">
								<xsl:attribute name="src">http://-RESELLER_URL-/upload_images/<xsl:value-of select = "/subscriber_invoice/reseller_id" />/logo.jpg</xsl:attribute>
								<xsl:attribute name="width">281</xsl:attribute>
								<xsl:attribute name="height">72</xsl:attribute>
							</xsl:element>
						</div>
						<div class="right" style="width:50%"><span style="color:gray;font-family:Trebuchet MS;font-weight:bold;font-size:35pt;height:100%;vertical-align:baseline;">INVOICE</span></div>
						<hr class="divider"></hr>
						<hr class="divider"></hr>
						<div id="addressData">
							<div id="column1" class="left" style="width:26%; margin-left:1%;">
								<span id="pay_to_addr">
									<xsl:value-of select="subscriber_invoice/pay_to_address/address1"/><br />
									<xsl:if test="subscriber_invoice/pay_to_address/address2/@nil = false">
										<xsl:value-of select="subscriber_invoice/pay_to_address/address2"/><br />
									</xsl:if>
									<xsl:if test="subscriber_invoice/pay_to_address/address3/@nil = false">
										<xsl:value-of select="subscriber_invoice/pay_to_address/address3"/><br />
									</xsl:if>
									<xsl:value-of select="subscriber_invoice/pay_to_address/city"/>, <xsl:value-of select="subscriber_invoice/pay_to_address/state"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="subscriber_invoice/pay_to_address/postal"/><br />
									<xsl:value-of select="subscriber_invoice/pay_to_address/phone_num"/><br />
								</span>
							</div>
							<div id="column2" class="left" style="width:26%; margin-left:1%">
								<span id="payee_addr">
									<span style="font-weight: bold;font-size:11pt;"><xsl:value-of select="subscriber_invoice/billing_address/firstname"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="subscriber_invoice/billing_address/lastname"/></span><br />
									<xsl:value-of select="subscriber_invoice/billing_address/address1"/><br />
									<xsl:if test="subscriber_invoice/billing_address/address2/@nil = false">
										<xsl:value-of select="subscriber_invoice/billing_address/address2"/><br />
									</xsl:if>
									<xsl:if test="subscriber_invoice/billing_address/address3/@nil = false">
										<xsl:value-of select="subscriber_invoice/billing_address/address3"/><br />
									</xsl:if>
									<xsl:value-of select="subscriber_invoice/billing_address/city"/>, <xsl:value-of select="subscriber_invoice/billing_address/state"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="subscriber_invoice/billing_address/postal"/><br />
									<xsl:value-of select="subscriber_invoice/billing_address/phone_num"/><br />
								</span>
							</div>
							<div id="column3" class="left" style="width:44%; margin-left:1%">
								<dl class="columnize inside">
									<dt style="font-weight:bold">Subscriber ID:</dt>
										<dd><xsl:value-of select="subscriber_invoice/subscriber_id"/></dd>
									<dt style="font-weight:bold">Invoice Number:</dt>
										<dd><xsl:value-of select="subscriber_invoice/period_summary/invoice_no"/></dd>
									<dt style="font-weight:bold">Bill Period:</dt>
										<dd><xsl:value-of select="subscriber_invoice/start_date"/> to <xsl:value-of select="subscriber_invoice/end_date"/></dd>
									<dt style="font-weight:bold">Invoice Date:</dt>
										<dd><xsl:value-of select="subscriber_invoice/creation_date"/></dd>
								</dl>
							</div>
						</div>
					</div>
					<div id="body" class="body small container">
						<div id="summary" class="container" style="border: 1px solid black;">
							<div id="column1" class="container left" style="width:50%;">
								<h1 class="center" style="border-bottom: 1px solid black; border-right: 1px solid black;">Charge Summary</h1>
								<div style="padding: 10px; height: 2in; border-right: 1px solid black;">
									<hr class="divider"></hr>
									<dl class="columnize outside">
										<dt>Service Charges</dt>
											<dd><xsl:value-of select="subscriber_invoice/period_summary/service_total"/></dd>
										<dt>Usage Charges</dt>
											<dd><xsl:value-of select="subscriber_invoice/period_summary/usage_total"/></dd>
										<dt>Credits</dt>
											<dd><xsl:value-of select="subscriber_invoice/period_summary/credit_total"/></dd>
										<hr class="divider"></hr>
										<dt></dt>
											<dd style="border-bottom: 1px solid black; width:50%; float: right;"></dd>
										<dt>Sub Total</dt>
											<dd><xsl:value-of select="subscriber_invoice/period_summary/raw_amount"/></dd>
										<dt>Others</dt>
											<dd><xsl:value-of select="subscriber_invoice/period_summary/tax_amount"/></dd>
										<dt style="font-weight:bold; width:49%;">Total Current Charges</dt>
											<dd style="font-weight:bold; width:50%;"><xsl:value-of select="subscriber_invoice/period_summary/total_due"/></dd>
									</dl>
								</div>
							</div>
							<div id="column2" class="left" style="position: relative; width:50%;">
								<h2 style="border-bottom: 1px solid black;"><br />For Billing Inquires: <xsl:value-of select="subscriber_invoice/pay_to_address/phone_num"/></h2>
								<div style="padding: 10px; height: 2in;">
									<dl class="columnize outside">
										<dt>Previous Balance</dt>
											<dd><xsl:value-of select="subscriber_invoice/account_summary/previous_balance"/></dd>
										<dt>Payments Recieved</dt>
											<dd><xsl:value-of select="subscriber_invoice/account_summary/payments_recieved"/></dd>
										<dt>Carried Balance</dt>
											<dd><xsl:value-of select="subscriber_invoice/account_summary/balance_carried"/></dd>
										<!--<dt>Late Fees</dt>
											<dd></dd>-->
										<dt>Current Charges</dt>
											<dd><xsl:value-of select="subscriber_invoice/period_summary/total_due"/></dd>
										<hr class="divider"></hr>
										<hr class="divider"></hr>
										<dt style="font-weight:bold; width: 50%;">Total Amount Due</dt>
											<dd style="font-weight:bold; border: 1px solid black; width: 35%;"><xsl:value-of select="subscriber_invoice/account_summary/account_balance"/></dd>
										<dt style="font-weight:bold; width: 50%;">Payment Due Date</dt>
											<dd style="font-weight:bold; border: 1px solid black; width: 35%;"><xsl:value-of select="subscriber_invoice/due_date"/></dd>
									</dl>
								</div>
							</div>
						</div>
						<div id="notes" class="container" style="border: 1px solid black; height: 1.75in;">
							<p class="center">***Important News and Offers regarding your account***</p>
							<p class="left"><!-- Replace this area with your notfications --></p>
						</div>
						<div id="notes2" class="container" style="border: 1px solid black; height: .5in;">
							<p class="center">Login and pay online!!!</p>
						</div>
					</div>
					<div id="footer" class="mailTag container" style="overflow: display">
						<span>Please detach payment slip below and mail in with your check or money order.</span>	
						<div style="border-top: 1px dashed black; padding-top:5px;">
							<div class="left" style="width:50%">
								<xsl:element name="img">
									<xsl:attribute name="src">http://-RESELLER_URL-/upload_images/<xsl:value-of select = "/subscriber_invoice/reseller_id" />/logo.jpg</xsl:attribute>
									<xsl:attribute name="width">281</xsl:attribute>
									<xsl:attribute name="height">72</xsl:attribute>
								</xsl:element>
								<hr class="divider"></hr>
								<span id="payee_addr" class="left" style="">
									<span style="font-weight: bold;font-size:11pt;"><xsl:value-of select="subscriber_invoice/billing_address/firstname"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="subscriber_invoice/billing_address/lastname"/></span><br /><br />
									<xsl:value-of select="subscriber_invoice/billing_address/address1"/><br />
									<xsl:if test="subscriber_invoice/billing_address/address2/@nil = false">
										<xsl:value-of select="subscriber_invoice/billing_address/address2"/><br />
									</xsl:if>
									<xsl:if test="subscriber_invoice/billing_address/address3/@nil = false">
										<xsl:value-of select="subscriber_invoice/billing_address/address3"/><br />
									</xsl:if>
									<xsl:value-of select="subscriber_invoice/billing_address/city"/>, <xsl:value-of select="subscriber_invoice/billing_address/state"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="subscriber_invoice/billing_address/postal"/><br />
									<xsl:value-of select="subscriber_invoice/billing_address/phone_num"/><br />
								</span>
								<span id="send_to" style="float:right;">
									<span style="text-decoration:underline;">Send payments to:</span><br /><br />
									<span style="font-weight: bold"><xsl:value-of select="subscriber_invoice/pay_to_address/company"/></span><br />
									<xsl:value-of select="subscriber_invoice/pay_to_address/address1"/><br />
									<xsl:if test="subscriber_invoice/pay_to_address/address2/@nil = false">
										<xsl:value-of select="subscriber_invoice/pay_to_address/address2"/><br />
									</xsl:if>
									<xsl:if test="subscriber_invoice/pay_to_address/address3/@nil = false">
										<xsl:value-of select="subscriber_invoice/pay_to_address/address3"/><br />
									</xsl:if>
									<xsl:value-of select="subscriber_invoice/pay_to_address/city"/>, <xsl:value-of select="subscriber_invoice/pay_to_address/state"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="subscriber_invoice/pay_to_address/postal"/><br />
								</span>
							</div>
							<div class="right" style="width:44%">
									<dl class="columnize inside">
										<dt style="font-weight:bold">Subscriber ID:</dt>
											<dd><xsl:value-of select="subscriber_invoice/subscriber_id"/></dd>
										<dt style="font-weight:bold">Invoice Number:</dt>
											<dd><xsl:value-of select="subscriber_invoice/period_summary/invoice_no"/></dd>
										<dt style="font-weight:bold">Bill Period:</dt>
											<dd><xsl:value-of select="subscriber_invoice/start_date"/> to <xsl:value-of select="subscriber_invoice/end_date"/></dd>
										<dt style="font-weight:bold">Invoice Date:</dt>
											<dd><xsl:value-of select="subscriber_invoice/creation_date"/></dd>
									</dl>
								<hr class="divider"></hr>
								<dl class="columnize outside">
									<dt style="font-weight:bold; width: 50%;">Total Amount Due</dt>
										<dd style="font-weight:bold; border: 1px solid black; width: 35%;"><xsl:value-of select="subscriber_invoice/account_summary/account_balance"/></dd>
									<dt style="font-weight:bold; width: 50%;">Payment Due Date</dt>
										<dd style="font-weight:bold; border: 1px solid black; width: 35%;"><xsl:value-of select="subscriber_invoice/due_date"/></dd>
								</dl>
								<hr class="divider"></hr>
								<dl class="columnize outside">
									<dt style="font-weight:bold; width: 50%;">Amount Enclosed</dt>
										<dd style="font-weight:bold; border: 1px solid black; width: 35%;"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></dd>
								</dl>
							</div>
						</div>
					</div>
				</div>
				
				<div class="page" style="overflow: visible; ">
					<div id="header" class="container">
						<div class="left" style="width:50%">
							<xsl:element name="img">
								<xsl:attribute name="src">http://-RESELLER_URL-/upload_images/<xsl:value-of select = "/subscriber_invoice/reseller_id" />/logo.jpg</xsl:attribute>
								<xsl:attribute name="width">281</xsl:attribute>
								<xsl:attribute name="height">72</xsl:attribute>
							</xsl:element>
						</div>
						<div class="right" style="width:50%"><span style="color:gray;font-family:Trebuchet MS;font-weight:bold;font-size:35pt;height:100%;vertical-align:baseline;">INVOICE</span></div>
						<hr class="divider"></hr>
						<hr class="divider"></hr>
						<div id="addressData">
							<div id="column1" class="left" style="width:26%; margin-left:1%;">
								<span id="pay_to_addr">
									<xsl:value-of select="subscriber_invoice/pay_to_address/address1"/><br />
									<xsl:if test="subscriber_invoice/pay_to_address/address2/@nil = false">
										<xsl:value-of select="subscriber_invoice/pay_to_address/address2"/><br />
									</xsl:if>
									<xsl:if test="subscriber_invoice/pay_to_address/address3/@nil = false">
										<xsl:value-of select="subscriber_invoice/pay_to_address/address3"/><br />
									</xsl:if>
									<xsl:value-of select="subscriber_invoice/pay_to_address/city"/>, <xsl:value-of select="subscriber_invoice/pay_to_address/state"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="subscriber_invoice/pay_to_address/postal"/><br />
									<xsl:value-of select="subscriber_invoice/pay_to_address/phone_num"/><br />
								</span>
							</div>
							<div id="column2" class="left" style="width:26%; margin-left:1%">
								<span id="payee_addr">
									<span style="font-weight: bold;font-size:11pt;"><xsl:value-of select="subscriber_invoice/billing_address/firstname"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="subscriber_invoice/billing_address/lastname"/></span><br />
									<xsl:value-of select="subscriber_invoice/billing_address/address1"/><br />
									<xsl:if test="subscriber_invoice/billing_address/address2/@nil = false">
										<xsl:value-of select="subscriber_invoice/billing_address/address2"/><br />
									</xsl:if>
									<xsl:if test="subscriber_invoice/billing_address/address3/@nil = false">
										<xsl:value-of select="subscriber_invoice/billing_address/address3"/><br />
									</xsl:if>
									<xsl:value-of select="subscriber_invoice/billing_address/city"/>, <xsl:value-of select="subscriber_invoice/billing_address/state"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="subscriber_invoice/billing_address/postal"/><br />
									<xsl:value-of select="subscriber_invoice/billing_address/phone_num"/><br />
								</span>
							</div>
							<div id="column3" class="left" style="width:44%; margin-left:1%">
								<dl class="columnize inside">
									<dt style="font-weight:bold">Subscriber ID:</dt>
										<dd><xsl:value-of select="subscriber_invoice/subscriber_id"/></dd>
									<dt style="font-weight:bold">Invoice Number:</dt>
										<dd><xsl:value-of select="subscriber_invoice/period_summary/invoice_no"/></dd>
									<dt style="font-weight:bold">Bill Period:</dt>
										<dd><xsl:value-of select="subscriber_invoice/start_date"/> to <xsl:value-of select="subscriber_invoice/end_date"/></dd>
									<dt style="font-weight:bold">Invoice Date:</dt>
										<dd><xsl:value-of select="subscriber_invoice/creation_date"/></dd>
								</dl>
							</div>
						</div>
					</div>
					
					<div id="body" class="body large">
						<div id="summary" class="container">
							<h3>Service Fee Details</h3>
							<table cellspacing="0">
								<thead>
									<tr>
										<td>Description</td>
										<td>Amount</td>
									</tr>
								</thead>
								<tbody>
									<xsl:choose>
										<xsl:when test="subscriber_invoice/recurring_charge or subscriber_invoice/one_time_charge">
											<xsl:for-each select="subscriber_invoice/recurring_charge">
												<xsl:variable name="recurring_charge" select="."/>
												<tr>
													<td><xsl:value-of select="description"/></td>
													<td>
														<xsl:if test="taxable">*</xsl:if>
														<xsl:value-of select="charge"/>
													</td>
												</tr>
											</xsl:for-each>
											<xsl:for-each select="subscriber_invoice/one_time_charge">
												<xsl:variable name="one_time_charge" select="."/>
												<tr>
													<td><xsl:value-of select="description"/></td>
													<td>
														<xsl:if test="taxable">*</xsl:if>
														<xsl:value-of select="charge"/>
													</td>
												</tr>
											</xsl:for-each>
										</xsl:when>
										<xsl:otherwise>
											<tr>
												<td colspan="3" style="text-align: left;">No Service Fees Durring Period</td>
											</tr>
										</xsl:otherwise>
									</xsl:choose>
								</tbody>
								<tfoot>
									<xsl:if test="subscriber_invoice/recurring_charge or subscriber_invoice/one_time_charge">
										<tr>
											<td>Total Service Charges</td>
											<td><xsl:value-of select="subscriber_invoice/period_summary/charge_total"/></td>
										</tr>
									</xsl:if>
								</tfoot>
							</table>
							<span class="right">* Denotes Taxable Charge</span>
							<hr class="divider"></hr>
							<h3>Payments</h3>
							<table cellspacing="0">
								<thead>
									<tr>
										<td>Date</td>
										<td>Description</td>
										<td>Amount</td>
									</tr>
								</thead>
								<tbody>
									<xsl:choose>
										<xsl:when test="subscriber_invoice/payments">
											<xsl:for-each select="subscriber_invoice/payments">
												<xsl:variable name="payments" select="."/>
												<tr>
													<td><xsl:value-of select="payment_date"/></td>
													<td><xsl:value-of select="description"/></td>
													<td><xsl:value-of select="payment_amount"/></td>
												</tr>
											</xsl:for-each>
										</xsl:when>
										<xsl:otherwise>
											<tr>
												<td colspan="3" style="text-align: left;">No Payments Durring Period</td>
											</tr>
										</xsl:otherwise>
									</xsl:choose>
								</tbody>
								<tfoot>
									<xsl:if test="subscriber_invoice/payments">
										<tr>
											<td colspan="2">Total Payments</td>
											<td><xsl:value-of select="subscriber_invoice/account_summary/payments_recieved"/></td>
										</tr>
									</xsl:if>
								</tfoot>
							</table>
							<hr class="divider"></hr>
							<h3>Usage Details</h3>
							<table cellspacing="0">
								<thead>
									<tr>
										<td>Call Time</td>
										<td>Clg Number</td>
										<td>Cld Number</td>
										<td>Call Duration</td>
										<td>Call Amount</td>
									</tr>
								</thead>
								<tbody>
									<xsl:choose>
										<xsl:when test="subscriber_invoice/call_record">
											<xsl:for-each select="subscriber_invoice/call_record">
												<xsl:variable name="call_record" select="."/>
												<tr>
													<td><xsl:value-of select="call_time"/></td>
													<td><xsl:value-of select="clg_num"/></td>
													<td><xsl:value-of select="cld_num"/></td>
													<td><xsl:value-of select="call_duration"/></td>
													<td><xsl:value-of select="call_amount"/></td>
												</tr>
											</xsl:for-each>
										</xsl:when>
										<xsl:otherwise>
											<tr>
												<td colspan="5" style="text-align: left;">No Calls Durring Period</td>
											</tr>
										</xsl:otherwise>
									</xsl:choose>
								</tbody>
								<tfoot>
									<xsl:if test="subscriber_invoice/call_record">
										<tr>
											<td colspan="4">Total Usage Charges</td>
											<td><xsl:value-of select="subscriber_invoice/period_summary/usage_total"/></td>
										</tr>
									</xsl:if>
								</tfoot>
							</table>
						</div>
					</div>
				</div>
			</body>
		</html>
    </xsl:template>
</xsl:stylesheet>