<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<table id="table" cellspacing="0" cellpadding="0" border="0">
    <tbody>
        <tr>
            <td>
                <img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts" width="16" border="0" height="16">
            </td>
            <td>
                <h2>Analiza Ofert </h2>
            </td>
        </tr>
</table>
<br>

<form action="index.php" method="get" class="EditView" name="AnalysisProductSale">
    <input type="hidden" name="module" value="EcmReports" />
    <input type="hidden" name="action" value="AnalysisProductSale" />
    <table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0" cellspacing="0">
        <tbody>
            <tr>
                <td class="dataField" nowrap="nowrap">
                    {$MOD.LBL_CONTRACTOR}:
					<input type="text" id="accountName" name="accountName" value="{$accountName}" style="width:50%">
					<input type="hidden" id="accountId" name="accountId" value="{$accountId}">
					<button 
						type="button"  
						id="selectAccount"
						value="{$APP.LBL_ADD_BUTTON}"
						title="Wybierz kontrahenta">
						<img src="{sugar_getimagepath file="id-ff-select.png"}">
					</button>
					<button 
						type="button"  
						id="clearAccount"
						value="Wyczyść"
						title="Wyczyść">
						<img src="{sugar_getimagepath file="id-ff-clear.png"}">
					</button>
                </td>
            </tr>
        </tbody>
    </table>
	<input type="submit" value="{$MOD.LBL_EXECUTE}">
<input class="button" name="clear" value="Wyczyść" type="button" onclick="location.href = 'index.php?module=EcmReports&action=AnalysisProductSale';">
<input id="pdfEksport" class="button" name="importToPDF" value="{$MOD.BTN_PDF_EXPORT}" type="button">
</form>

<table id="myTable" class="tablesorter tablesorter-blue">
    <thead>
		<tr>
		<th>Nazwa</th>
		{foreach from=$DATA key=key item=item}
		<th>{$key}</th>
		{/foreach}
		<th>Suma</th>
		</tr>
    </thead>
    <tbody>
		<tr>
			<td>Utworzona/Wysłana</td>
			{foreach from=$ROWS.created key=key item=item}
				{assign var=sumacreated value=$sumacreated+$item}
				<td style="text-align: right;">{$item|number_format:0:",":"."}</td>
			{/foreach}
			<td style="text-align: right;">{$sumacreated|number_format:0:",":"."}</td>
		</tr>

	<tr>
			<td>Przyjęta</td>
			{foreach from=$ROWS.accepted key=key item=item}
				{assign var=sumaaccepted value=$sumaaccepted+$item}
				<td style="text-align: right;">{$item|number_format:0:",":"."}</td>
			{/foreach}
			<td style="text-align: right;">{$sumaaccepted|number_format:0:",":"."}</td>
		</tr>
		<tr>
			<td>Odrzucona</td>
			{foreach from=$ROWS.not_accepted key=key item=item}
				{assign var=sumanot_accepted value=$sumanot_accepted+$item}
				<td style="text-align: right;">{$item|number_format:0:",":"."}</td>
			{/foreach}
			<td style="text-align: right;">{$sumanot_accepted|number_format:0:",":"."}</td>
		</tr>
    </tbody>
</table>

<div id="chart_div" style="width: 100%; height: 500px;"></div>
<!-- Tablesorter script: required -->
<script src="modules/EcmReports/TableSorterNew/js/jquery.tablesorter.js"></script>
<script src="modules/EcmReports/javascript/AnalysisEcmQuote.js"></script>
<script src="modules/EcmReports/TableSorterNew/js/jquery.tablesorter.widgets.js"></script>
<link class="theme" rel="stylesheet" href="modules/EcmReports/TableSorter/css/theme.blue.css">
