<?php

	/**
	 * HTML E-Mail Template für die Daten der Anfrage
	 * wird von adminmail_html.phtml und customermail_html.phtml verwendet
	 */

?>
<div class="baskettable_wrap">
	<table class="baskettable" cellpadding="2" cellspacing="0" style="cell-padding:4px;">
		<tr>
			<td><?php echo __('Pos', 'wpsg'); ?></td>
			<td><?php echo __('Produkt', 'wpsg'); ?></td>
			<td><?php echo __('Stückpreis', 'wpsg'); ?></td>
			<?php if (sizeof($this->view['requestlist']['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
			<td><?php echo __('MwSt.', 'wpsg'); ?></td>
			<?php } ?>
			<td><?php echo __('Anzahl', 'wpsg'); ?></td>
			<td class="col_sum"><?php echo __('Summe', 'wpsg'); ?></td> 
		</tr>
		<?php $i = 0; foreach ((array)$this->view['requestlist']['products'] as $product_index => $request_product) { $i ++; ?>
		<tr>
			<td><?php echo $i; ?>.</td>
			<td><?php echo ((wpsg_isSizedString($request_product['product_data']['detailname']))?$request_product['product_data']['detailname']:$request_product['product_data']['name']); ?></td>
			<td><?php echo wpsg_ff($request_product['price'], $this->get_option('wpsg_currency')); ?></td>
			<?php if (sizeof($this->view['requestlist']['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
			<td><?php echo wpsg_ff($request_product['product_data']['mwst_value'], '%'); ?></td>
			<?php } ?>
			<td><?php echo $request_product['amount']; ?></td>
			<td class="col_sum"><?php echo wpsg_ff($request_product['price'] * $request_product['amount'], $this->get_option('wpsg_currency')); ?></td> 
		</tr>
		
		<?php /* Variantenanzeige im Produkt BEGIN */ ?>
		<?php if ($this->hasMod('wpsg_mod_varianten') && $this->callMod('wpsg_mod_varianten', 'isVariantsProductKey', array($request_product['product_key']))) { ?>
		<tr>
			<td colspan="2"><?php echo __('Variante', 'wpsg'); ?>:</td>
			<td colspan="<?php echo (3 + $this->view['addColspan']); ?>"><?php echo wpsg_hspc($request_product['variantenInfo']['key']); ?></td>
		</tr>
		<?php } ?>
		<?php /* Variantenanzeige im Produkt ENDE */ ?>
			
		<?php /* Gewichtsanzeige im Produkt BEGIN */ ?>
		<?php if ($this->hasMod('wpsg_mod_weight') && wpsg_isSizedInt($this->get_option('wpsg_mod_weight_showRequestPageProduct'))) { ?>
		<tr>
			<td colspan="2"><?php echo __('Gewicht', 'wpsg'); ?>:</td>
			<td colspan="<?php echo (3 + $this->view['addColspan']); ?>"><?php echo wpsg_ff($request_product['product_data']['weight'], $this->get_option('wpsg_mod_weight_unit')); ?></td>
		</tr>
		<?php } ?>
		<?php /* Gewichtsanzeige im Produkt ENDE */ ?>
		
		<?php /* Produktvariablen BEGIN */ ?>
		<?php if ($this->hasMod('wpsg_mod_productvars') && wpsg_isSizedInt($this->get_option('wpsg_mod_request_productvars')) && wpsg_isSizedArray($request_product['pv'])) { ?>
		<?php foreach ($request_product['product_data']['pv'] as $pv) { ?>
		<tr>
			<td colspan="2"><?php echo wpsg_hspc($pv['name']); ?>:</td>
			<td colspan="<?php echo (3 + $this->view['addColspan']); ?>">
				<?php if ($pv['typ'] === '3') { ?>
					<?php if (wpsg_isSizedInt($request_product['pv'][$pv['id']])) { ?><?php echo __('Ja', 'wpsg'); ?><?php } else { ?><?php echo __('Nein', 'wpsg'); ?><?php } ?>
				<?php } else { ?>
					<?php echo wpsg_hspc($request_product['pv'][$pv['id']]); ?>
				<?php } ?>
			</td>
		</tr> 
		<?php } ?>
		<?php } ?>
		<?php /* Produktvariablen ENDE */ ?>
		
		<?php } ?>
		<tr><td colspan="<?php echo (5 + $this->view['addColspan']); ?>">&nbsp;</td></tr>
		
		<?php if ($this->getFrontendTaxview() == WPSG_NETTO) { ?>
		<tr>
			<td colspan="<?php echo (4 + $this->view['addColspan']); ?>"><?php echo __('Gesamtpreis (Netto)', 'wpsg'); ?>:</td>
			<td class="col_sum"><?php echo wpsg_ff($this->view['requestlist']['sum']['price_netto'], $this->get_option('wpsg_currency')); ?></td>
		</tr>
		<?php foreach ((array)$this->view['requestlist']['tax'] as $tax_key => $tax) { ?>
		<tr>
			<td colspan="<?php echo (4 + $this->view['addColspan']); ?>"><?php echo wpsg_translate(__('zuzüglich MwSt. (#1#)', 'wpsg'), $tax['name']); ?>:</td>
			<td class="col_sum"><?php echo wpsg_ff($tax['tax_calc_value'], $this->get_option('wpsg_currency')); ?></td>
		</tr>
		<?php } ?>
		<tr>
			<td colspan="<?php echo (4 + $this->view['addColspan']); ?>"><?php echo __('Gesamtpreis (Brutto)', 'wpsg'); ?>:</td>
			<td class="col_sum"><?php echo wpsg_ff($this->view['requestlist']['sum']['price_brutto'], $this->get_option('wpsg_currency')); ?></td>
		</tr> 
		<?php } else { ?>
		<tr>
			<td colspan="<?php echo (4 + $this->view['addColspan']); ?>"><?php echo __('Gesamtpreis (Brutto)', 'wpsg'); ?>:</td>
			<td class="col_sum"><?php echo wpsg_ff($this->view['requestlist']['sum']['price_brutto'], $this->get_option('wpsg_currency')); ?></td>
		</tr>		
		<?php foreach ((array)$this->view['requestlist']['tax'] as $tax_key => $tax) { ?>
		<tr>
			<td colspan="<?php echo (4 + $this->view['addColspan']); ?>"><?php echo wpsg_translate(__('darin enthaltene MwSt. (#1#)', 'wpsg'), $tax['name']); ?>:</td>
			<td class="col_sum"><?php echo wpsg_ff($tax['tax_calc_value'], $this->get_option('wpsg_currency')); ?></td>
		</tr>
		<?php } ?>		
		<tr>
			<td colspan="<?php echo (4 + $this->view['addColspan']); ?>"><?php echo __('Gesamtpreis (Netto)', 'wpsg'); ?>:</td>
			<td class="col_sum"><?php echo wpsg_ff($this->view['requestlist']['sum']['price_netto'], $this->get_option('wpsg_currency')); ?></td>
		</tr> 
		<?php } ?>
		
		<?php /* Gewichtsanzeige BEGIN */ ?>
		<?php if ($this->hasMod('wpsg_mod_weight') && wpsg_isSizedInt($this->get_option('wpsg_mod_weight_showRequestPage'))) { ?>
		<tr><td colspan="<?php echo (5 + $this->view['addColspan']); ?>">&nbsp;</td></tr>
		<tr>
			<td colspan="<?php echo (4 + $this->view['addColspan']); ?>"><?php echo __('Gesamtgewicht', 'wpsg'); ?>:</td>
			<td class="col_sum"><?php echo wpsg_ff($this->view['requestlist']['sum']['weight'], $this->get_option('wpsg_mod_weight_unit')); ?></td>
		</tr> 
		<?php } ?>
		<?php /* Gewichtsanzeige ENDE */ ?>
 
	</table>
</div>

<?php /* Bestellvariablen BEGIN */ ?>
<?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_request_ordervars')) && wpsg_isSizedArray($this->view['orderVars'])) { ?>
<h2><?php echo __('Zusätzliche Angaben', 'wpsg'); ?>:</h2>

<table class="contenttable">
	<?php foreach ($this->view['orderVars'] as $ov_index => $ov) { ?>
	<tr>
		<td style="padding:2px; line-height:100%; vertical-align:middle;" class="col0"><?php echo wpsg_hspc($ov['name']); ?>:</td>
		<td style="padding:2px; line-height:100%; vertical-align:middle;" class="col1">
			<?php if ($ov['typ'] === '3') { ?>
				<?php if (wpsg_isSizedInt($this->view['requestlist']['ov'][$ov['id']])) { ?><?php echo __('Ja', 'wpsg'); ?><?php } else { ?><?php echo __('Nein', 'wpsg'); ?><?php } ?>
			<?php } else { ?>
				<?php echo wpsg_hspc($this->view['requestlist']['ov'][$ov['id']]); ?>
			<?php } ?>
		</td>
	</tr> 
	<?php } ?>
</table>
<?php } ?>
<?php /* Bestellvariablen ENDE */ ?>

<?php if (wpsg_isSizedString($this->view['requestlist']['customer']['comment'])) { ?>
<h2><?php echo __('Kommentar', 'wpsg'); ?>:</h2>
<p><?php echo wpsg_getStr($this->view['requestlist']['customer']['comment']); ?></p>
<?php } ?>

<h2><?php echo __('Kontaktdaten', 'wpsg'); ?>:</h2>
  
<table class="contenttable">
	<?php 
	
		// Hilfsarray, damit ich nicht so viel schreiben muss
		$arFields = array(
			'firma' => __('Firma', 'wpsg'),
			'title' => __('Anrede', 'wpsg'),	
			'vname' => __('Vorname', 'wpsg'),
			'name' => __('Name', 'wpsg'),
			'email' => __('E-Mail', 'wpsg'),	
			'fax' => __('Fax', 'wpsg'),
			'tel' => __('Tel.', 'wpsg'),
			'strasse' => __('Strasse', 'wpsg'),	
			'plz' => __('PLZ', 'wpsg'),
			'ort' => __('Ort', 'wpsg'),
			'ustidnr' => __('UStIdNr.', 'wpsg')
		);
	
	?>
	<?php foreach ($arFields as $field_name => $label) { ?>
	<tr>
		<td style="padding:2px; line-height:100%; vertical-align:middle;" class="col0"><?php echo wpsg_hspc($label); ?>:</td>
		<td style="padding:2px; line-height:100%; vertical-align:middle;" class="col1"><?php 
		
			if ($field_name == "email")
			{
				
				echo '<a href="mailto:'.wpsg_hspc(wpsg_getStr($this->view['requestlist']['customer'][$field_name])).'">'.wpsg_hspc(wpsg_getStr($this->view['requestlist']['customer'][$field_name])).'</a>';
				
			}
			else
			{
				
				echo wpsg_hspc(wpsg_getStr($this->view['requestlist']['customer'][$field_name]));

			}
			
		?></td>
	</tr> 
	<?php } ?>
	
	<?php /* Automatische Einbindung der benutzerdefinierten Felder BEGIN */ ?>
	<?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_request_customerdata'))) { ?>
	<?php foreach ((array)$this->view['pflicht']['custom'] as $c_id => $c) { if ($c['show'] != '2') { ?>
	<tr>
		<td style="padding:2px; line-height:100%; vertical-align:middle;" class="col0"><?php echo __($c['name'], 'wpsg'); ?></td>
		<td style="padding:2px; line-height:100%; vertical-align:middle;" class="col1">
			<?php if ($c['typ'] == '2') { ?>
				<?php if (wpsg_isSizedInt($this->view['requestlist']['customer']['custom'][$c_id])) { ?><?php echo __('Ja', 'wpsg'); ?><?php } else { ?><?php echo __('Nein', 'wpsg'); ?><?php } ?>
			<?php } else { ?>
				<?php echo wpsg_getStr($this->view['requestlist']['customer']['custom'][$c_id]); ?>
			<?php } ?>
		</td>
	</tr> 
	<?php } } ?>
	<?php } ?>
	<?php /* Automatische Einbindung der benutzerdefinierten Kundenfelder ENDE */ ?>

</table>