<%/******************************************************************************
 * Copyright (c) 2000-2005 e-Deal
 *
 * e-Deal S.A.
 * 55 rue Brillat Savarin
 * 75013 Paris
 * France
 *
 * T: +33 (0)1 53 80 80 30
 * F: +33 (0)1 73 01 69 77
 * http://www.e-deal.com
 * 
 * La diffusion de ce code source sous quelque forme que ce soit sans
 * l'autorisation de E-DEAL est interdite.
 *
 * Vous êtes autorisés à modifier ce code source uniquement pour votre usage
 * propre et sous réserve que les mentions de copyright demeurent intactes.
 *
 * Ce code est fourni en l'état. Aucune garantie d'aucune sorte, explicite ou
 * implicite n'est donnée. En aucun cas E-DEAL ne pourra être tenu pour
 * responsable des dommages pouvant résulter de l'utilisation de ce code
 * source.
 ******************************************************************************/
%>
<%@page session="true"%>
<%@ page import="com.edeal.frontline.navigation.FlRequest" %>
<%@ page import="com.edeal.frontline.FlContext" %>
<%@ page import="com.edeal.frontline.DataDictionary" %>
<%@ page import="com.edeal.frontline.FieldNotInitializedException" %>
<%@ page import="com.edeal.frontline.custom.GiftCheque_Bean"%>
<%@ page import="com.edeal.frontline.Utils"%>
<%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %>
<jsp:useBean class="com.edeal.frontline.custom.GiftCheque_Bean" id="GiftCheque_" scope="request"/>
<link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="<fl:webapp/>/css/common_css.jsp">

<%
	final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass());
	FlRequest flRequest = new FlRequest(request);
	FlContext context = flRequest.getContext();
	DataDictionary dico = context.getDataDictionary();
	String id = null;
	String idChOrigine = null; 

	try {
	    id = GiftCheque_.getID();
	} catch (FieldNotInitializedException fnie) {}
	
    Boolean invPopup = true;
    String idGch = null;
    try {
    	idGch = GiftCheque_.getGchCgcID();
    } catch (FieldNotInitializedException e) {
    	invPopup = false;
    }
	
	try {
	    idChOrigine = GiftCheque_.getGchOrigineID();
	} catch (FieldNotInitializedException fnie) {}

	boolean confImpression = false;
	try {
		confImpression = GiftCheque_.isGchConfImpr();
	} catch (FieldNotInitializedException fnie) {}
	

%>
<script type="text/javascript" language="javascript">
function verifierImpressionGiftcheque(){
	affPopup =<%=confImpression%>;
	if(affPopup) {
		var conf = confirm('Impression du chèque Réussie ?');
		if (!conf) {
			changerStatut();
		} else {
			/*On a appuyer sur OK et le chèque a été bien imprimé, il ne faut plus afficher la popup de confirmation*/
			window.parent.location = '<fl:link url="<%= \"/confirmer_statutGiftCheque_.fl?id=\" + id%>"/>';
		}
	}
}

function doRefresh() {
	window.top.location.reload();	
}

function changerStatut() {
	window.open('<fl:link list="false" url="<%= \"/changer_statutGiftCheque_.fl?$$presentFields=&id=\" + id %>"/>','GiftCheque_', 'width=750,height=310,scrollbars=yes,resizable=yes,toolbar=no');
}

function doOnLoad() {
	verifierImpressionGiftcheque();
}

function doNewNumInvalider(idGch) {
	var link = '<fl:link url="<%= \"/generer_giftcheque_.fl\" + ( idGch != null ? \"?id=\" + idGch : \"\") %>"/>'
	link = link + '&initInvGchID=' + idGch;
	//alert(link);
	window.location = link; 
}

function doNewNumRemplacer(idGch) {
	var link = '<fl:link url="<%= \"/generer_giftcheque_.fl\" + ( idGch != null ? \"?id=\" + idGch : \"\") %>"/>'
	link = link + '&initRempGchID=' + idGch;
	//alert(link);
	window.location = link; 
}

</script>

<fl:bigTabs objectTitle="<%=Utils.getMessage(session, \"LF05C\", false, true, \"Chèque Cadeau\") %>" ou="<%= \"read_giftcheque_.fl\" + (id != null ? \"?id=\" + id : \"\")%>" >
    <table class="container" cellpadding="0">
		<tr>
			<td colspan="5">
				<table class="container" cellpadding="0">
					<tr class="fieldline">
						<td class="titreFiche" colspan="2">
							<fl:getMessage code="LF05C" alt="Chèque Cadeau"/><fl:getProperty name="GiftCheque_" property="GchMontant" postText="&euro;&nbsp;" preText="&nbsp;" alt=""/><fl:getMessage code="LF05D" alt="n°"/><fl:getProperty name="GiftCheque_" property="GchNumber" preText="&nbsp;" alt=""/>
						</td>
					</tr>
				</table>
			</td>
		</tr>
    
		<tr class="ligne_separation"><td></td></tr>
		<tr>
			<td class="column2">
				<table class="data_column" cellpadding="0">
					<fl:fieldRead property="GchStatusID"/>
					<fl:fieldRead property="GchCrDt" format="dd/MM/yyyy"/>
					<fl:fieldRead property="GchValidityDt"/>
					<fl:fieldRead property="GchBeneficiary"/>
					<fl:fieldRead property="GchMontant" postText="&nbsp;&euro;" format="money"/>
					<tr class="fieldline">
						<td id="EntVoie_label" class="dataLabel"><span style="color:#0000;font-weight: bold;">&nbsp;</span></td>
					</tr>
					<fl:fieldRead property="GchAccountingCode"/>
					<fl:fieldRead property="GchAnalyticCode"/>
					<fl:fieldRead property="GchFranceAccount"/>
					<fl:fieldRead property="GchExportAccount"/>
					<fl:fieldRead property="GchIntracomAccount"/>
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>
			<td class="column2">
				<table class="data_column" cellpadding="0">
					<fl:fieldRead property="GchCgcID" bean="true" href="true" disp="<%= flRequest.computeURL(\"/read_cmdgiftcheque_.fl\") %>"/>
					<fl:fieldRead property="GchUseWithAdherent" bean="true" href="true" disp="<%= flRequest.computeURL(\"/read_enterprise.fl\") %>"/>
					<fl:fieldRead property=""/>
					<tr class="fieldline">
						<td id="EntVoie_label" class="dataLabel"><span style="color:#0000;font-weight: bold;">&nbsp;</span></td>
					</tr>
					<tr class="fieldline">
						<td id="EntVoie_label" class="dataLabel"><span style="color:#0000;font-weight: bold;"><fl:getMessage code="LF062" alt="Règlement"/></span></td>
					</tr>
					<fl:fieldRead property="GchDeadlineDt"/>
					<fl:fieldRead property="GchPslID" separator="<br>" bean="true" href="true" disp="<%= flRequest.computeURL(\"/read_paymentslip_.fl\") %>"/>
					<fl:fieldRead property="GchPaymentDt"/>
					<% if (idChOrigine != null) { %>
					<fl:fieldRead property="GchOrigineID" bean="true" href="true" disp="<%= flRequest.computeURL(\"/read_giftcheque_.fl\") %>"/>	
					<%} %>
					
				</table>
			</td>
		</tr>
		<tr class="ligne_separation"><td></td></tr>
	</table>
	
	<%-- <fl:smallTabs name="GiftCheque__Tabs">

		<fl:sTab id="STab1" title="Titre STab1">
			<div>
				STab 1
			</div>
		</fl:sTab>
	</fl:smallTabs> --%>
</fl:bigTabs>
