Перейти к содержимому


Доработать шаблоны писем в разделе конфигурация/дополнительно


Сообщений в теме: 2

#1 Leskov

    Активный участник

  • Пользователи
  • PipPipPip
  • 95 сообщений
  • Пол:Мужчина
  • Город:Санкт-Петербург

Отправлено 11 Март 2013 - 22:52

при рассылке отчетов по email должны использоваться шаблоны писем.

Шаблоны писем можно создать в разделе Конфигурация/Дополнительно

для примера я взял отчет "Холодные продажи" стандартной конфигурации.
вставил код Отображения в шаблон письма, но отображается некорректно.

{literal}
<link rel="stylesheet" type="text/css" href="include/jquery/jquery-ui.css" />
<script type='text/javascript' src='include/jquery/jquery-ui.min.js'></script>
<script type='text/javascript' src='include/jquery/jquery.ui.datepicker.js'></script>
<script type='text/javascript' src='include/jquery/i18n/jquery.ui.datepicker-ru.js'></script>
<script type="text/javascript" src="include/jqplot/jquery.jqplot.min.js"></script>
<script type="text/javascript" src="include/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script>
<script type="text/javascript" src="include/jqplot/plugins/jqplot.pointLabels.min.js"></script>
<script type="text/javascript" src="include/jqplot/plugins/jqplot.dateAxisRenderer.min.js"></script>
<script type="text/javascript" src="include/jqplot/plugins/jqplot.cursor.min.js"></script>
<script type="text/javascript" src="include/jqplot/plugins/jqplot.enhancedLegendRenderer.js"></script>
<link rel="stylesheet" type="text/css" href="include/jqplot/jquery.jqplot.css" />

<script type="text/javascript">

$(function() {
$('.datepicker').datepicker({
showOn:"button",
showAlways: true,
buttonImage: "images/calbtn.png",
buttonImageOnly: true,
buttonText: "Calendar",
showAnim: (('\v'=='v')?"":"show"), // в ie не включаем анимацию, тормозит
})
});
</script>

<script type="text/javascript">

function highlightTr(trId, hlMode) {
if (hlMode) hlColor = "{/literal}{$color3}{literal}";
else hlColor = "#ffffff";
document.getElementById('submain_td' + trId).style.background = hlColor;
}

</script>

<style type="text/css">
.title {
margin: 20px 0px;
font-size: 23px;
font-weight: bold;
}
.top {
border-top: 1px solid #E3E3E3;
border-bottom: 1px solid #E3E3E3;
background-color: #F5F5F5;
text-align: center;
padding: 15px 52px;
}

.top table {
margin: 0px;
padding: 0px;
border: none;
border-collapse: collapse;
}

.top td {
border: none;
padding: 0px;
margin: 0px;
}

span.input_element {
white-space: nowrap;
padding: 0px 35px 0px 0px;
line-height: 32px;
float: left;
}

.main {
margin-top: 35px;
margin-bottom: 25px;
}
.mainTable {
border-collapse: collapse;
border: none;
text-align: center;
width: 100%;
}
.mainTable td{
padding: 10px 20px;
vertical-align: middle;
border-top: 1px solid #B3BFC9;
border-bottom: 1px solid #B3BFC9;
border-left: 1px dashed #B3BFC9;
border-right: 1px dashed #B3BFC9;
text-align: center;
}
</style>

<script type="text/javascript">
function go_table(manager, type, dates)
{
document.getElementById('_manager').value = manager;
document.getElementById('_type').value = type;
document.getElementById('_dates').value = dates;
document.getElementById('report_form').submit();
}
</script>
{/literal}

<div class="title">
<span style="float: right; font-size: 12px; margin-top: 5px;" class="no_print">
<a href="#" onclick="document.getElementById('xsl_ex').value='1'; document.getElementById('report_form').submit(); return false"><img src="images/xsl.gif" style="vertical-align: bottom; border: none; margin-right: 3px;">Экспорт в Excel</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="javascript:window.print()"><img src="images/print.gif" style="vertical-align: bottom; border: none; margin-right: 3px;">Печать отчёта</a>
</span>
Холодные звонки
{if $adm_rules}<a href="edit_field.php?table=62&field=773" title="Редактировать типы" class="no_print" style="text-decoration: none"><img class="settings_t" style="margin:0 0 -3px 0px;" src="images/settings_b.gif" border="0" /></a>{/if}
</div>

<div class="top">
<table style="margin: 0px auto;">
<tr>
<td>
<span class="input_element">
Период с <input type="text" name="date1" id="date1" value="{$date1}" size="10" class="datepicker" />
по <input type="text" name="date2" id="date2" value="{$date2}" size="10" class="datepicker" />
</span>
{if $user_group==1}
<span class="input_element">
Менеджеры: <select name="manager">{$sel_manager}</select>
</span>
{/if}
<div style="clear: both"></div>
</td>
<td>
<input type="submit" value="Обновить" class="no_print" onclick="document.getElementById('xsl_ex').value='0'; document.getElementById('report_form').submit(); return false" />
</td>
</tr>
</table>
</div>

<div class="main" style="color:white">
<table class="mainTable" cellspacing="0" cellpadding="0">
<tr>
<td style="border-right: 1px solid #B3BFC9; border-left: 0px; border-top: 0px;">&nbsp;</td>
{foreach from=$h_pos item=s_pos name=table_header}
<td style="border-top-color: #fff;{if $smarty.foreach.table_header.first}border-left: none{/if}{if $smarty.foreach.table_header.last}border-right: none{/if}">{$s_pos}</td>
{/foreach}
</tr>
{foreach from=$data key=m_id item=m_data name=m_rows}
<tr id="submain_td{$smarty.foreach.m_rows.iteration}" onmouseover="highlightTr({$smarty.foreach.m_rows.iteration}, 1)" onmouseout="highlightTr({$smarty.foreach.m_rows.iteration}, 0)">
{foreach from=$m_data key=type item=value name=m_values}
{if $smarty.foreach.m_values.first || $smarty.foreach.m_values.last}
<td style={if $smarty.foreach.m_values.last}"border-right: none;border-left: 0px;"{else}"border-right: 1px solid #B3BFC9;border-left: 0px;"{/if}>{if !$smarty.foreach.m_values.first}<a href="javascript:go_table({$m_id},'',1)"><b>{$value}</b></a>{else}<b>{$value}</b>{/if}</td>
{else}
<td{if $smarty.foreach.m_values.iteration eq 2} style="border-left: none"{/if}{if $smarty.foreach.m_values.last} style="border-right: none"{/if}><a href="javascript:go_table({$m_id},'{$type}',1)">{$value}</a></td>
{/if}
{/foreach}
</tr>
{/foreach}

<tr id="submain_td9999" onmouseover="highlightTr(9999, 1)" onmouseout="highlightTr(9999, 0)">
{foreach from=$data_total key=type item=value name=m_values}
{if $smarty.foreach.m_values.first}
<td style="border-right: 1px solid #B3BFC9; border-left: 0px;"><b>{$value}</b></td>
{else}
<td{if $smarty.foreach.m_values.iteration eq 2} style="border-left: none"{/if}{if $smarty.foreach.m_values.last} style="border-right: none"><a href="javascript:go_table('','',1)"><b>{$value}</b></a>{else}><a href="javascript:go_table('','{$type}',1)"><b>{$value}</b></a>{/if}</td>
{/if}
{/foreach}
</tr>

</table>
</div>

<input type=hidden name="_dates" id="_dates">
<input type=hidden name="_date1" value="{$date1}">
<input type=hidden name="_date2" value="{$date2}">
<input type=hidden name="_manager" id="_manager">
<input type=hidden name="xsl" id="xsl_ex" value="0" />
<input type=hidden name="_type" id="_type">

{if $is_graph}
<table align="center"><tr><td align="center">
<div id="chart1" style="margin-top:20px; margin-left:20px; width:1000px; max-height:300px;"></div>
</td></tr></table>
{$graph}{/if}


#2 CbCoder

    Активный участник

  • Программист ООО "КБ"
  • PipPipPip
  • 8 759 сообщений
  • Пол:Мужчина
  • Город:Казань

Отправлено 12 Март 2013 - 10:50

Не совсем понял вас, это предложение или замечание? Если предложение - то шаблоны писем для рассылки отчетов уже добавлены в версии 1.9.6. Если замечание по поводу некорректного отображения письма, то да - такая проблема существует. Связана она с тем что весьма затруднительно сделать одновременно корректный вывод сложного html (включающего таблицы, стили и т.д.) на экран в программе и в теле письма. К сожалению, пока универсального решения мы не нашли. Одним из вариантом является использование переменной $send_report в отображении отчета с отдельным выводом для экрана и письма:

{if $send_report}
этот текст будет выводиться в письме
{else}
этот текст будет выводиться в программе
{/if}


#3 Leskov

    Активный участник

  • Пользователи
  • PipPipPip
  • 95 сообщений
  • Пол:Мужчина
  • Город:Санкт-Петербург

Отправлено 12 Март 2013 - 11:38

решение интересное.
идеально было бы, если б это было в шаблоне.
{if $send_report}
этот текст будет выводиться в письме ([b]этой части не хватает[/b])
{else}
этот текст будет выводиться в программе
{/if}
хотя бы для одного какого-нибудь стандартного отчета из демо-версии

Сообщение отредактировал Leskov: 12 Март 2013 - 11:46






Количество пользователей, читающих эту тему: 2

0 пользователей, 2 гостей, 0 анонимных