<div class="content-add01">
	<div class="heading01"><h1>Paiement facture fournisseur : <?php echo $katao_supplier_invoice->getReference() ?></h1></div>
</div>

<?php echo form_tag('@katao_supplier_invoice_pay?id=' . $katao_supplier_invoice->getId()) ?>

  <table>
    <tfoot>
      <tr>
        <td colspan="2">
          <br /><?php echo submit_tag('Sauver') ?> ou <a href="<?php echo url_for('kataoSupplierInvoice/index') ?>">annuler</a>
        </td>
      </tr>
    </tfoot>
    <tbody>
      <tr valign="top">
        <td><label>Montant TTC</label></td>
		<td><?php echo Utils::formatCurrencyEuro($katao_supplier_invoice->getTotalHt() + $katao_supplier_invoice->getTotalTva()) ?></td>
      </tr>
      <tr valign="top">
        <td><?php echo label_for('payment_amount_euro', 'Montant (€)') ?></td>
		<td><?php echo input_tag('payment_amount_euro', $katao_supplier_invoice->getPaymentAmountEuro()) ?></td>
      </tr>
      <tr valign="top">
        <td><?php echo label_for('payment_amount_sol', 'Montant (' . wpConfig::getAdditionalCurrencyName() . ')') ?></td>
		<td><?php echo input_tag('payment_amount_sol', $katao_supplier_invoice->getPaymentAmountSol()) ?></td>
      </tr>
      <tr valign="top">
        <td><?php echo label_for('payment_date', 'Date de paiement') ?></td>
		<td><?php echo input_date_tag('payment_date', time(), array('rich' => true, 'calendar_button_img' => '/sf/sf_admin/images/date.png', 'css' => 'skins/aqua/theme', 'format' => 'dd/MM/yyyy', 'culture' => 'fr', 'style' => 'width: 56px')) ?></td>
      </tr>
      <tr valign="top">
        <td><?php echo label_for('payment_mode', 'Mode de règlement') ?></td>
		<td><?php echo select_tag('payment_mode', options_for_select(KataoSupplierInvoicePeer::getAllPaymentModes(), false), array('onchange' => 'togglePaymentDetails();')) ?></td>
      </tr>
      <tr valign="top" id="payment-details">
        <td><?php echo label_for('payment_details', '<span id="payment-details-label"></span>') ?></td>
		<td><?php echo input_tag('payment_details') ?></td>
      </tr>
    </tbody>
  </table>

</form>

<script type="text/javascript" language="JavaScript">
/* <![CDATA[ */

function togglePaymentDetails(){
	$('payment_details').value = '';
	if (<?php echo KataoSupplierInvoice::PAYMENT_MODE_CHECK ?> == $F('payment_mode')) {
		$('payment-details').show();
		$('payment-details-label').innerHTML = ' Banque et n° de chèque :';
	} else if (<?php echo KataoSupplierInvoice::PAYMENT_MODE_BANK_TRANSFER ?> == $F('payment_mode')) {
		$('payment-details').show();
		$('payment-details-label').innerHTML = ' N° du virement :';
	} else {
		$('payment-details').hide();
	}
}

togglePaymentDetails();

/* ]]> */
</script>