{popup_init src="overlib/overlib.js"}

{* title *}
{include file="reportHeader.tpl"}

{*Edited*}
<div class="report_filter">

{if $columnCount > 0}
	{* parameter *}
	{* FLDAT_von:datefrom:date,FLDAT_bis:dateuntil:date,Betrieb:betr:select,Stufe5:stufe_5:select,O500_Mahnstufe:mahnst:select,Stufe2:stufe_2:select,KNAME:k_name:select,wochen:woch:select,Versicherung:vers:select,Reklamation:rekl:select *}

		<form method="POST" action="{$smarty.server.PHP_SELF}" onSubmit="return dateFormat('datefrom:dateuntil');">
		<table id="report_filter_table" class="report_filter_table"><tr>
        <tr id="report_filter_table_input">
		<td>{$filter_betrTxt}</td>
		<td>{$filter_betrVal}</td>
		<td>{$filter_stufe_2Txt}</td>
		<td>{$filter_stufe_2Val}</td>
		<td>{$filter_stufe_5Txt}</td>
		<td>{$filter_stufe_5Val}</td>
		<td>{$filter_mahnstTxt}</td>
		<td colspan="3">{$filter_mahnstVal}</td>
        <td><input type=submit class="pme-filter" value="{$Query}"></td>
        </tr><tr>
		<td>{$filter_k_nameTxt}</td>
		<td>{$filter_k_nameVal}</td>
		<td>{$filter_wochTxt}</td>
		<td>{$filter_wochVal}</td>
		<td>{$filter_versTxt}</td>
		<td>{$filter_versVal} RA: {$filter_raVal}</td>
		<td>{$filter_reklTxt}</td>
		<td>{$filter_reklVal}</td>
		<td>{$filter_WiedervorlTxt}</td>
		<td>{$filter_WiedervorlVal}</td>
		<td><input type=button onClick="clearCache();" class="pme-filter" value="{$Reset}"></td>
        </tr><tr>
        <td>{$filter_datefromTxt}</td><td>{$filter_datefromVal}</td><td>{$filter_dateuntilTxt}</td><td>{$filter_dateuntilVal}</td>
		<td>{$filter_Mahnen_entTxt}</td>
		<td>{$filter_Mahnen_entVal}</td>
		<td>{$filter_rechgutTxt}</td>
		<td>{$filter_rechgutVal}</td>
		</tr>
		</table>
		</form>

{/if}

{*Edited*}
</div>

{* variable *}
{* {$REPORT_COUNT} *}

{* field *}
{* Betrieb, Stufe2, FAGNR, FTYPE, KNDNR, KNAME, Stufe5, REDAT, O500_HW2BUCHGBETR, FLDAT, FLDAT_von, FLDAT_bis, O500_MAHNSTUFE, Next_MAHNSTUFE, O500_HW2BETR_OFFEN, OPDAT, O500_BELEGNR1, Ktelf, Kstra, Kdplz, Kdort, Bemerkung, Wiedervorlage, Bemerkung_2, Bearbeitet, Mahnen, User, Aenderungsdatum, User_2, Aenderungsdatum_u2, Fäll_Tage, Wochen, KZALA, Versicherung, Reklamation, Selbstbeteiligung, SelbstbeteiligungBetrag, Mwst, MwstBetrag, qb_id *}

{* group *}
{* ALL:SUM.O500_HW2BETR_OFFEN; *}

{* pageHeader *}
{* <p>{$Total}: {$REPORT_COUNT}</p> *}
{$form_begin}

{*Edited*}
	<!--<hr>-->

{*Edited*}
	<div id="report_content" class="report_content">

{if $columnCount > 0}

{php}
	global $phpme;
	while ($phpme->assign_rows()) {
{/php}

		{* columnHeader *}
		{if $rows_count == 1}
			<div id="report_content_header" class="report_content_header">
			<table id="report_content_header_table" class="report_content_header_table">
			<tr><td width="2%">&nbsp;</td>
			<td width="3%">{$BetriebTxt2}</td>
		<td width="3%">{$Stufe2Txt2}</td>
		<td width="12%">{$KNAMETxt2}</td>
		<td width="6%">{$Stufe5Txt2}</td>
		<td width="5%">{$REDATTxt2}</td>
		<td width="6%">{$O500_HW2BUCHGBETRTxt2}</td>
		<td style="text-align: center;" width="6%">{$FLDATTxt2}</td>
		<td width="7%">{$O500_MAHNSTUFETxt2}</td>
		<td width="5%">{$O500_HW2BETR_OFFENTxt2}</td>
		<td width="14%">{$BemerkungTxt2}</td>
		<td width="6%">{$WiedervorlageTxt2}</td>
		<td width="14%">{$Bemerkung_2Txt2}</td>
		<td style="text-align: left;" width="3%">{$BearbeitetTxt2}</td>
		<td width="6%">{$MahnenTxt2}</td>


			</tr>
			</table>
			{if strlen($sortInfo) > 0}
				{$sortInfo}
			{/if}
			</div>
			<div id="report_content_table" class="report_content_table">
			<table id="report_content_table_table" class="report_content_table_table">

		{/if}

		{* detail *}
                {if $rows.FAGNR|count_characters == 6 && $rows.O500_BELEGNR1|cat:$rows.OPDAT eq $thisrec}
                        <tr bgcolor=#99CCFF>
                {elseif $rows.FAGNR|count_characters == 7 && $rows.O500_BELEGNR1|cat:$rows.OPDAT|cat:$rows.FAGNR eq $thisrec}
                        <tr bgcolor=#99CCFF>
                {elseif ($rows.User == $smarty.session.userid && $rows.Aenderungsdatum|date_format:'%d.%m.%Y' == $smarty.now|date_format:'%d.%m.%Y') || ($rows.User_2 == $smarty.session.userid && $rows.Aenderungsdatum_u2|date_format:'%d.%m.%Y' == $smarty.now|date_format:'%d.%m.%Y') }
                        <tr bgcolor=#99CCFF> {*E8EEFF*}
                {elseif $rows_count % 2 == 0}
                        <tr bgcolor=#E8EEFF>
                {else}
                        <tr>
                {/if}

			<td nowrap width="2%">
			{$rows.link_change}
		</td>
			<td width="3%">{$rows.Betrieb}</td>
		<td width="3%">{$rows.Stufe2}</td>
		<td width="12%">{$rows.KNAME}</td>
		<td width="6%">{$rows.Stufe5}</td>
		<td style="text-align: right;"width="5%">{$rows.REDAT|date_format:'%d.%m.%Y'}</td>
		<td style="text-align: right;"width="6%">{$rows.O500_HW2BUCHGBETR|number_format:2:",":"."}</td>
		<td style="text-align: center;" width="6%">{$rows.FLDAT|date_format:'%d.%m.%Y'}</td>
		<td width="7%">{$rows.O500_MAHNSTUFE}</td>
		<td style="text-align: right;"width="5%">{$rows.O500_HW2BETR_OFFEN|number_format:2:",":"."}</td>
		<td width="14%">{$rows.Bemerkung}</td>
		<td width="6%">{if $rows.Wiedervorlage != '0000-00-00' && $rows.Wiedervorlage != '&nbsp;'}{$rows.Wiedervorlage|date_format:'%d.%m.%Y'}{/if}</td>
		<td width="14%">{$rows.Bemerkung_2}</td>
		<td style="text-align: left;" width="3%">{$rows.Bearbeitet}</td>
		<td width="6%">{$rows.Mahnen}</td>

			</tr>

		{* groupFooter *}


		{* columnFooter *}
		{if ! $rows_next}

			</table>
            </div>
			</div>
			<div id="report_gesamt_berechnung" class="report_gesamt_berechung">


		<tr><td colspan={$columnCount}>
		{$grandTotal}
		{$O500_HW2BETR_OFFENTxt} = {$ALLGroup_SUM|number_format:2:",":"."}
		</td></tr>

			</div>
		{/if}

{php}
	}
{/php}

	{if $rows_count == 0}
		<h1>Keine Datensätze ausgewählt.</h1>
        {/if}
	</div>
{else}
	{section name=html loop=$form_hidden}
		{$form_hidden[html]}
	{/section}
	<table class='report_content_formular_table' cellspacing='0px'>

                <tr style="background-Color: #E8EEFF;">
                        <td>{$BetriebTxt}:</td>
                        <td>{$BetriebVal}</td>

                        <td>{$FTYPETxt}:</td>
                        <td>{$FTYPEVal}</td>

                        <td>{$Faell_TageTxt}</td>
                        <td><input class="pme-input--1" type="text" disabled name="Faell_Tage" value="{$rows.Faell_Tage}"  size="10" maxlength="10"></td>

                        <td>{$FLDATTxt}:</td>
                        <td><input class="pme-input--1" type="text" disabled name="FLDAT" value="{$rows.FLDAT|date_format:'%d.%m.%Y'}"  size="10" maxlength="10"></input></td>

                        <td>{$KNAMETxt}:</td>
                        <td>{$KNAMEVal}</td>


                </tr>
                <tr style="background-Color: #E8EEFF;">
                        <td>{$Stufe2Txt}:</td>
                        <td>{$Stufe2Val}</td>

                        <td>{$FAGNRTxt}:</td>
                        <td>{$FAGNRVal}</td>

                        <td>{$REDATTxt}:</td>
                        <td><input class="pme-input--1" type="text" disabled name="REDAT" value="{$rows.REDAT|date_format:'%d.%m.%Y'}"  size="10" maxlength="10"></input></td>

                        <td>{$WochenTxt}:</td>
                        <td>{$WochenVal}</td>

                        <td>{$KstraTxt}</td>
                        <td>{$KstraVal}</td>

                </tr>
                <tr style="background-Color: #E8EEFF;">
                        <td>{$Stufe5Txt}:</td>
                        <td>{$Stufe5Val}</td>

                        <td>{$O500_HW2BUCHGBETRTxt}:</td>
		            <td><input class="pme-input--1" type="text" disabled name="O500_HW2BUCHGBETR" value={$rows.O500_HW2BUCHGBETR|number_format:2:",":"."} size="11" maxlength="11"></input></td>

                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <td>{$KdplzTxt}</td>
                        <td>{$KdplzVal}</td>

                </tr>

                <tr style="background-Color: #E8EEFF;">
                        <td>{$KNDNRTxt}:</td>
                        <td>{$KNDNRVal}</td>

                        <td>&nbsp;</td>
                        <td colspan="3">&nbsp;</td>

                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <td>{$KdortTxt}</td>
                        <td>{$KdortVal}</td>
                </tr>

                <tr style="background-Color: #E8EEFF;">
                        <td>{$O500_BELEGNR1Txt}</td>
                        <td>{$O500_BELEGNR1Val}</td>

                        <td>&nbsp;</td>
                        <td colspan="3">&nbsp;</td>

                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <td>{$KtelfTxt}</td>
                        <td>{$KtelfVal}</td>

                </tr>
                <tr>
						<td><b>{$VersicherungTxt}</b></td>
						<td><SELECT class="pme-input--1" type="text" name="Versicherung" size="1" maxlength="1">
                        		<option value='N'>Nein</option>
                                <option value='J' {if $rows.Versicherung=="J"} selected {/if} >Ja</option>
                        </SELECT></td>

						<td><b>{$RechtsanwaltTxt}</b></td>
						<td><SELECT class="pme-input--1" type="text" name="Rechtsanwalt" size="1" maxlength="1">
                        		<option value='N'>Nein</option>
                                <option value='J' {if $rows.Rechtsanwalt=="J"} selected {/if} >Ja</option>
                        </SELECT></td>

						<td><b>{$ReklamationTxt}</b></td>
						<td><SELECT class="pme-input--1" type="text" name="Reklamation" size="1" maxlength="1">
                                              	<option value='N'>Nein</option>
                                                <option value='J' {if $rows.Reklamation=="J"} selected {/if} >Ja</option>
                                              </SELECT>
                    	</td>

                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <td style="background-Color: #E8EEFF;">&nbsp;</td>
                        <td style="background-Color: #E8EEFF;">&nbsp;</td>
                </tr>
                <tr>
						<td><b>&nbsp;> {$SelbstbeteiligungTxt}</b></td>
						<td><SELECT class="pme-input--1" name="Selbstbeteiligung" size="1" maxlength="10">
                        								<option value=''></option>
                        								<option value='Kunde' {if $rows.Selbstbeteiligung=="Kunde"} selected {/if} >Kunde</option>
                                                        <option value='Versicherung' {if $rows.Selbstbeteiligung=="Versicherung"} selected {/if} >Versicherung</option>
                                                        <option value='AHR' {if $rows.Selbstbeteiligung=="AHR"} selected {/if} >AHR</option>
                                                    </SELECT>
                    	</td>

						<td><b>{$SelbstbeteiligungBetragTxt}</b></td>
						<td>{$SelbstbeteiligungBetragVal}</td>

						<td>&nbsp;</td>
                        <td>&nbsp;</td>

						<td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <td style="background-Color: #E8EEFF;">&nbsp;</td>
                        <td style="background-Color: #E8EEFF;">&nbsp;</td>
                </tr>
                <tr>
						<td><b>&nbsp;> {$MwstTxt}</b></td>
						<td><SELECT class="pme-input--1" name="Mwst" size="1" maxlength="10">
                        								<option value=''></option>
                        								<option value='Kunde' {if $rows.Mwst=="Kunde"} selected {/if} >Kunde</option>
                                                        <option value='Versicherung' {if $rows.Mwst=="Versicherung"} selected {/if} >Versicherung</option>
                                                        <option value='AHR' {if $rows.Mwst=="AHR"} selected {/if} >AHR</option>
                                                    </SELECT></td>

						<td><b>{$MwstBetragTxt}</b></td>
						<td>{$MwstBetragVal}</td>

                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <td style="background-Color: #E8EEFF;">&nbsp;</td>
						<td style="background-Color: #E8EEFF;">&nbsp;</td>
                </tr>
                <tr>

                        <td>{$O500_MAHNSTUFETxt}:</td>
                        <td colspan="5">{$O500_MAHNSTUFEVal}</td>

                        <td>&nbsp;</td>
                        <td>&nbsp;</td>


                        <td style="background-Color: #E8EEFF;">{$KZALATxt}:</td>
                        <td style="background-Color: #E8EEFF;">{$KZALAVal}</td>
                </tr>

                <tr>

                        <td><b>{$BemerkungTxt}:</b></td>
                        <td colspan="5"><textarea class="pme-input--1" {if $smarty.session.group_name == ABTEILUNG} disabled {/if} name="Bemerkung" rows="5" cols="50" wrap="virtual">{$rows.Bemerkung}</textarea></td>

                        <td>{$Aenderungsdatum_u2Txt}:<br>{$User_2Txt}:</td>
                        <td><input class="pme-input--1" type="text" disabled name="Aenderungsdatum_u2" value="{if $rows.Aenderungsdatum_u2 != '0000-00-00'}{$rows.Aenderungsdatum_u2|date_format:'%d.%m.%Y'}{/if}"  size="10" maxlength="10"><br><input class="pme-input--1" disabled type="text" name="User_2" value="{$rows.User_2}"  size="30" maxlength="30"></td>

                        <td style="background-Color: #E8EEFF;">&nbsp;</td>
                        <td style="background-Color: #E8EEFF;">&nbsp;</td>
                </tr>
                <tr>
                        <td>{$Next_MAHNSTUFETxt}:</td>
                        <td colspan="7">{$Next_MAHNSTUFEVal}</td>

                        <td colspan="2" style="background-Color: #E8EEFF;">&nbsp;</td>
                </tr>
                <tr>

                        <td><b>{$MahnenTxt}:</b></td>
                        <td colspan="7">	<select class="pme-input--1" type="text" name="Mahnen" size="1" maxlength="1">
                        				<option value="N">Nein</option>
                        				<option value="J" {if $rows.Mahnen=="J"} selected {/if} >Ja</option>
                        			</select>
                        </td>

                        <td style="background-Color: #E8EEFF;">&nbsp;</td>
                		<td style="background-Color: #E8EEFF;">&nbsp;</td>

		    </tr>
                <tr>

                        <td><b>{$Bemerkung_2Txt}:</b></td>
                        <td colspan="5"><textarea class="pme-input--1" {if $smarty.session.group_name == FIBU} disabled {/if} name="Bemerkung_2" rows="5" cols="50" wrap="virtual">{$rows.Bemerkung_2}</textarea></td>


		            <td>{$AenderungsdatumTxt}:<br>{$UserTxt}:</td>
                        <td><input class="pme-input--1" type="text" disabled name="Aenderungsdatum" value="{if $rows.Aenderungsdatum != '0000-00-00'}{$rows.Aenderungsdatum|date_format:'%d.%m.%Y'}{/if}"  size="10" maxlength="10"><br><input class="pme-input--1" disabled type="text" name="User" value="{$rows.User}"  size="30" maxlength="30"></td>

                        <td style="background-Color: #E8EEFF;">&nbsp;</td>
                        <td style="background-Color: #E8EEFF;">&nbsp;</td>
                </tr>

                <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>


                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <td colspan="2" style="background-Color: #E8EEFF;">&nbsp;</td>
                </tr>
                <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

              		<td style="border-top: 1px solid #45458D;"><b>{$WiedervorlageTxt}:</b></td>
                        <td style="border-top: 1px solid #45458D;"><input class="pme-input--1" type="text" date="date" name="Wiedervorlage" value="{if $rows.Wiedervorlage != '0000-00-00'}{$rows.Wiedervorlage|date_format:'%d.%m.%Y'}{/if}"  size="10" maxlength="10"><image src="images/dynCalendar.gif" name='calendar' onclick="startCalendar(this,'Wiedervorlage','up');"></td>


                        <td style="background-Color: #E8EEFF; border-top: 1px solid #45458D;">{$O500_HW2BETR_OFFENTxt}</td>
                        <td style="background-Color: #E8EEFF; border-top: 1px solid #45458D;"</td><input class="pme-input--1" type="text" disabled name="O500_HW2BETR_OFFEN" value={$rows.O500_HW2BETR_OFFEN|number_format:2:",":"."} size="11" maxlength="11"></input></td>

                </tr>

                <tr style="display: none;">
                        <td>{$OPDATTxt}</td>
                        <td>{$OPDATVal}</td>
                        <td>{$FLDAT_oriTxt}:</td>
                        <td>{$FLDAT_oriVal}</td>
                        <td><input class="pme-input--1" type="text" name="Bearbeitet" value='J'  size="1" maxlength="1"></td>
                        <td><input class="pme-input--1" type="hidden" name="User_2" value="{if $smarty.session.group_name == FIBU}{$smarty.session.userid}{else}{$rows.User_2}{/if}"  size="30" maxlength="30"></td>
                        <td><input class="pme-input--1" type="hidden" name="User" value="{if $smarty.session.group_name == ABTEILUNG}{$smarty.session.userid}{else}{$rows.User}{/if}"  size="30" maxlength="30"></td>
                        <td><input class="pme-input--1" type="text" name="Aenderungsdatum_u2" value="{if $smarty.session.group_name == FIBU}{$curdate|date_format:'%Y-%m-%d'}{else}{$rows.Aenderungsdatum_u2}{/if}"  size="10" maxlength="10"></td>
                        <td><input class="pme-input--1" type="text" name="Aenderungsdatum" value="{if $smarty.session.group_name == ABTEILUNG}{$curdate|date_format:'%Y-%m-%d'}{else}{$rows.Aenderungsdatum}{/if}"  size="10" maxlength="10"></td>
                        <td>{if $smarty.session.group_name == ABTEILUNG}<textarea type="hidden" class="pme-input--1" name="Bemerkung" rows="5" cols="50" wrap="virtual">{$rows.Bemerkung}</textarea>{/if}</td>
                        <td>{if $smarty.session.group_name == FIBU}<textarea type="hidden" class="pme-input--1" name="Bemerkung_2" rows="5" cols="50" wrap="virtual">{$rows.Bemerkung_2}</textarea>{/if}</td>
                </tr>

	</table>
	</div>

        {* using translate : {'add'|__} *}
        {* for value : $rows.keyname *}
{/if}




{if $columnCount > 0}
        {include file="listButtons.tpl"}
{else}
        {include file="recordButtons.tpl"}
{/if}


{* summary *}

{* pageFooter *}
{$form_end}
{include file="reportFooter.tpl"}

