| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 
 | <%@page import="java.util.*"%>
<%@page import="com.essilor.util.*"%>
<%@page import="com.essilor.servlet.bean.*"%>
 
<% String TYPE = "" ; %>
 
<%@taglib uri="http://www.essilor.com/taglib/essilor" prefix="essilor"%>
<%@taglib uri="http://www.essilor.com/taglib/webedit" prefix="webedit"%>
<%@taglib uri="http://www.sas.com/taglib/sasads" prefix="sasads"%>
 
<%@page contentType="text/html; charset=ISO-8859-1"%>
<%@page errorPage="errors.jsp"%>
 
<jsp:useBean class="com.essilor.servlet.bean.Application" scope="application" id="app"/>
<jsp:useBean class="com.essilor.servlet.bean.Section"     scope="session" id="section"/>
<jsp:useBean class="com.essilor.servlet.bean.Message"     scope="request" id="message"/>
<jsp:useBean class="com.essilor.servlet.bean.UserSite"    scope="session" id="user"/>
 
 
 
<HTML>
<HEAD>
 
<script language ="JavaScript">
 
 
//Vérifications sur la date à saisir
 
// Enleve le '0' des nb < 10
function ConvNum(tabDeDate) {
for (i=0; i<tabDeDate.length; i++)
tabDeDate[i] = (tabDeDate[i].charAt(0)=='0')?tabDeDate[i].charAt(1):tabDeDate[i];
return tabDeDate;
}
 
// Retourne true si valeur_date est postérieure à la date du jour
function DateFuture(valeur_date)
{var tabDate = valeur_date.split('/');
var datAujourdhui = new Date();
tabDate = ConvNum(tabDate);
if (valeur_date.length > 0)
{ var datTest_Date = new Date(parseInt(tabDate[2]), parseInt(tabDate[1])-1, parseInt(tabDate[0]));
if (datTest_Date <= datAujourdhui) return false;
}
return true;
}
 
// Vérifie le format d'une date saisie
function Verif_Date(valeur_date)
{ var tabDate = valeur_date.split('/');
tabDate = ConvNum(tabDate);
var datTest_Date = new Date(parseInt(tabDate[2]), parseInt(tabDate[1])-1, parseInt(tabDate[0]));
if (valeur_date.length>10)
{ alert('Ne dois pas dépasser 10 caractères.');
return false;
}
for (i=0; i<valeur_date.length; i++)
{ if (valeur_date.charAt(i) == ' ')
{ alert("La date ne doit pas contenir d\'espaces.");
return false;
}
}
if (valeur_date.length > 0)
{ if ((parseInt(tabDate[0]) != datTest_Date.getDate()) || (parseInt(tabDate[1]) != parseInt(datTest_Date.getMonth())+1))
{ alert("Veuillez saisir la date au format DD/MM/YYYY.");
return false;
}
if ((tabDate[2].length != 4) )
{ alert("Veuillez saisir l'année sur 4 chiffres.");
return false;
}
}
return true;
}
 
 
//Récupération des paramètres saisis
 
function choixprop(formrad) { 
document.location = "tgmpopup.jsp?opcclo=" + formrad.radbt[0].checked ;
formrad.submit();
return;
window.opener.popup=null;self.close();
window.open('../downloads/tomexport.csv'); 
}
 
function exportfile(){
window.opener.popup=null;self.close();window.open('../downloads/tomexport.csv');
}
 
</script>
 
 
<%----- sas session -----%>
 
<% String currTable = (String)session.getAttribute("currentWebEDITTable");%>
 
 
<%
String cloopc=request.getParameter("radbt");
String filename=request.getParameter("fileName");
%>
 
 
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
 
<title>Export TGM CSV</title>
 
<link REL=STYLESHEET HREF="../css/main.css" TYPE="text/css">
<link REL=STYLESHEET HREF="../css/sasads.css" TYPE="text/css">
<script language="javascript" src="../scripts/controle.js"></script>
<script language="javascript" src="../scripts/tree.js"></script>
<script language='JavaScript' src="../scripts/navigation.js"></script>
<SCRIPT LANGUAGE="JavaScript" src="../scripts/MDDBSubsetsFunction.js"></script>
 
 
</HEAD>
 
 
<BODY bgcolor='#FFFFFF' onLoad="document.sendfileForm.fileName.focus()" onUnLoad="window.opener.popup=null" onblur="document.focus()">
 
<form action="tgmpopup.jsp" name="sendfileForm">
 
<table width="100%" cellpadding='0' cellspacing='0'>
<tr>
<td width="100%" border=0>
 
<x:TabbedPanel 
name="controlTabbedPanel"
minimizeEnable="N"
maximizeEnable="N"
minWidth="170" 
title="<font class='windowtitle'>Export to CSV</font>"
outsideBgcolor="#8777A4"
windowControl="winCtrl"
width="100%"
>
</x:TabbedPanel>
 
<x:Window name="mainWindow" toolbar="N" width="100%" height="80" outsideBgcolor="#D0D0C8" insideBgcolor ="#EEEEEE" windowControl="winCtrl" closeEnable="N">
 
<tr>
  <td align=left width="70%">
          <img src="../images/banner.gif"/>
  </td>
  <td>
	 
  </td>
</tr>
 
<table border=0 width="100%"> 
 
<tr>
  <td align=left width="70%">
	<font style="font-family : Arial;font-size : 8pt;font-weight : bold;color: #000000;">Enter the date of the file to export (dd/mm/yyyy) :</font>
  </td>
  <td>
	 
  </td>
</tr>
<tr>
  <td align=left width="70%">
	<INPUT type="text" name="fileName" maxlength="10" style="width: 300px;"  onchange="if (!Verif_Date(this.value)) this.focus(); " >
  </td>
  <td>
	<input type="submit" class="applButton" value="Generate CSV" style="width: 110px;" onClick=choixprop(radbt); window.opener.popup=null;self.close();window.open('../downloads/tomexport.csv'); >
 
	<input type="button" class="applButton" value="Download CSV" style="width: 110px;" onClick=window.opener.popup=null;self.close();window.open('../downloads/tomexport.csv');>
 
	<input type="button" class="applButton" value="Cancel" style="width: 110px;" onClick=window.opener.popup=null;self.close();>
 
  </td>  
</tr>
</table>
 
<table border=0 width="40%">
<tr>
  <td>
    <font style="font-family : Arial;font-size : 8pt;font-weight : bold;color: #000000;">Export by : </font>
  </td>
 
  <td>
    <input type="radio" name="radbt" id="radOPC" value="OPC" checked><font style="font-family : Arial;font-size : 8pt;font-weight : bold;color: #000000;">OPC</font>
  </td>
</tr>
<tr>
  <td>
     
  </td>
  <td>
    <input type="radio" name="radbt" id="radCLO" value="CLO"><font style="font-family : Arial;font-size : 8pt;font-weight : bold;color: #000000;">CLO</font>
  </td>
</tr>
 
</table>
<%String date=request.getParameter("fileName");%>
<%String choix=request.getParameter("radbt");%>
 
 
Export by : <%out.println(choix);%>
 
Date : <%out.println(date);%>
 
 
</x:Window>
 
 
<br>
 
</td>
</tr>
</table>
 
</form>
 
 
 
<% if (currTable.length() > 0) { %>
 
<sasads:Submit id="submit" connection="connection"> 
 
libname test '/webappl/TGM_D/downloads/';
 
data toto;
	length opc $10 clo $1 tutu $10 null $1;
	opc="0000000001"; clo="b"; tutu="<%out.println(date);%>"; null="a"; output;
	opc="0000000250"; clo="d"; tutu="<%out.println(date);%>"; null="a"; output;
run;
 
data test.toto;
set toto;
run;
 
%macro selectvar(opcclo);
 
 
	proc sql;
		create table sel as
		select  *
		from work.toto;
	quit;
 
 
        data sel;
                set sel (keep= &&opcclo tutu);
        run;
 
%mend;
 
/*recuperer la valeur du bouton radio sous la forme "opc" ou "clo"*/
 
%selectvar(<%out.println(choix);%>);
 
 
PROC EXPORT DATA= WORK.sel 
            OUTFILE= "/webappl/TGM_D/downloads/tomexport.csv" 
            DBMS=CSV REPLACE; 
            DELIMITER=';';
RUN;
 
</sasads:Submit>
 
<% } %>
 
</form>
</BODY>
</HTML> | 
Partager