XML - Crear archivo en FTP con XML

 
Vista:

Crear archivo en FTP con XML

Publicado por Alberto (1 intervención) el 07/09/2010 19:18:40
Hola, buenas tardes a todos.

Soy muy nuevo en esto, y aunque parezca algo simple, la pregunta que voy a realizar me lleva de cabeza desde hace dias.

Tengo un codigo XML que genera x archivos en una ruta que le he marcado, y lo que quiero saber es si hay alguna posibilidad de que genere esos archivos en un servidor FTP.

Adjunto el codigo entero, pero la parte de la ruta es la primera que pongo.

--------------------------------------------------------------------------------------------

<Else>
<ViewReport reportfile="{DocumentRTM}" where="{where}" order="{order}"/>
</Else>
<SetVariable name="ToDirectory" type="s" value="C:\Program Files\Spaceman32\Documents PDF\facturas y notas de abono"/>
<SetVariable name="newwhere" sql="replace(replace((:origwhere),'printdocument(iqacdocument.documentid)> 0 and ',''), 'iqacdocument.printbatch','isnull(iqacdocument.printbatch,0)') + ' and documentdate>=''2008-01-01'''"/>

-------------------------------------------------------------------------

CODIGO ENTERO


<Job autoclose="YES">
<Message text="(V20012004) Processing Invoices to be Sent as PDFs via Email, Please Wait...."/>
<SetVariable name="DocumentRTM" type="s" value="C:\Program Files\Spaceman32\Document Templates\Factura 23 11 07.rtm"/>
<IfFileDoesNotExist filename="{DocumentRTM}">
<MessageDialog Text="The Document Template: '{DocumentRTM}' cannot be found."/>
<Cancel/>
</IfFileDoesNotExist>
<IfSQL condition="string(:database)='Demo'">
<MessageDialog text="Space Manager is in DEMO mode. You cannot print Invoices from here."/>
<Cancel/>
</IfSQL>
<SetVariable name="origwhere" type="s" value="{where}"/>
<IfSQL condition="(:order)<>'1'">
<SetVariable name="oldwhere" type="s" sql="substr(string(:where),1,locate(string(:where),'and iqacdocument.printbatch')-1)+' )'"/>
<SetVariable name="spanisha" type="s" sql="char(225)"/>
<SetVariable name="spanishe" type="s" sql="char(233)"/>
<SetVariable name="spanisho" type="s" sql="char(243)"/>
<SetVariable name="spanishu" type="s" sql="char(250)"/>
<SetVariable name="TempDot" type="s" value="{TempDir}Factura SE-"/>
<SetVariable name="WForPDF" type="s" value="{where} and exists (select * from tagvalue where tagid='PDF' and tagchoiceid='YES' and id=customer.customerid and left(taglocation,1) = 'C')"/>
<SetVariable name="Where" type="s" value="{where} and not exists (select * from tagvalue where tagid='PDF' and tagchoiceid='YES' and id=customer.customerid and left(taglocation,1) = 'C')"/>
<SQLQuery>
<SQLSelect>select customerid as cid, customernumber,documentid, fullname,ourref,val(ourref) as thefile, contactname,sitename,salutation from site join iqacdocument join customer on accountcode=customernumber where {WForPDF} order by {order}</SQLSelect>
<IfAnyRows>
<ForEachRow>
<SQLQuery>
<SQLSelect>select first number from phone where customerid=(:cid) and primaryemail=1 order by customerid,personid</SQLSelect>
<IfNoRows>
<MessageDialog text="Cannot Send Document Ref {ourref} by Email as Customer {fullname} has no Primary Email set."/>
</IfNoRows>
<Else>
<SetVariable name="TempDoc" type="s" value="{tempdot}{thefile}.PDF"/>
<ExportReport reportfile="{DocumentRTM}" exportfile="{TempDoc}" where="(iqacdocument.documentid='{documentid}')"/>
<SetVariable name="MyOtherVar">
<Writeln>Atentamente,</Writeln>
<Writeln></Writeln>
<Writeln>Tu Trastero, Tu Otro Espacio
<Writeln/>Dpto. de Facturaci{spanisho}n
<Writeln/>{sitename}</Writeln>
</SetVariable>
<SendEmail subject="Tu factura de Tu Trastero n{spanishu}mero: SE/{ourref}">
<EmailRecipients>
<WriteLn>{number}</WriteLn>
</EmailRecipients>
<EmailBody>
<Writeln>Estimado/a {salutation}:</Writeln>
<Writeln/>
<Writeln>Te remitimos el siguiente correo electr{spanisho}nico con la factura del mes en curso.</Writeln>
<Writeln/>
<Writeln>Puedes visualizarla f{spanisha}cilmente descargando el archivo que te adjuntamos</Writeln>
<Writeln/>
<Writeln>Gracias a este servicio, puedes visualizar e imprimir tu factura de una forma c{spanisho}moda, r{spanisha}pida y sencilla.</Writeln>
<Writeln/>
<Writeln>Si no consigues abrir el archivo, por favor, descarga gratuitamente Adobe Acrobat Reader desde www.adobe.com.</Writeln>
<Writeln/>
<Writeln>Si tienes cualquier duda o sugerencia, no dudes en ponerte en contacto con nosotros a trav{spanishe}s del e-mail [email protected] o a trav{spanishe}s del n{spanishu}mero de tel{spanishe}fono 9.</Writeln>
<Writeln/>
<Writeln>Agradeci{spanishe}ndote tu colaboraci{spanisho}n, recibe un atento saludo.</Writeln>
<Writeln/>
<Writeln>{MyOtherVar}</Writeln>
</EmailBody>
<EmailAttachments>
<WriteLn>{TempDoc}</WriteLn>
</EmailAttachments>
</SendEmail>
<SQLExec>insert into contactevent (contacteventid,customerid,staffid,contactdate,contacttime,description,outcome,classcode,who,followup, creatorstaffid) values (uniquekey('{:documentid}'),'{cid}',(select staffid from staff where userid='{user}'),current date,current time,'Invoice Number {ourref} sent to Customer as PDF file via Email','Invoice emailed to: {number}','PD','A',0, (select staffid from staff where userid='{user}'))</SQLExec>
</Else>
</SQLQuery>
</ForEachRow>
</IfAnyRows>
</SQLQuery>
<ViewReport reportfile="{DocumentRTM}" where="{where}" order="{order}"/>
<SetVariable name="bnumber" type="n" sql="val(substr(string(:where),locate(string(:where),'printbatch =')+12,10))"/>
</IfSQL>
<Else>
<ViewReport reportfile="{DocumentRTM}" where="{where}" order="{order}"/>
</Else>
<SetVariable name="ToDirectory" type="s" value="C:\Program Files\Spaceman32\Documents PDF\facturas y notas de abono"/>
<SetVariable name="newwhere" sql="replace(replace((:origwhere),'printdocument(iqacdocument.documentid)> 0 and ',''), 'iqacdocument.printbatch','isnull(iqacdocument.printbatch,0)') + ' and documentdate>=''2008-01-01'''"/>
<XMessagedialog text="{origwhere}/{newwhere}"/>
<IfSQL condition="not string(:database)='Demo'">
<SQLQuery>
<SQLSelect>select customerid as cid, customernumber,documentid,dateformat(documentdate,'ddmmyyyy') as docdate, fullname,ourref,documenttype,sitecode from site join iqacdocument join customer on accountcode=customernumber where {newwhere} and documentdate >= '2010/01/01' order by {order}</SQLSelect>
<IfAnyRows>
<ForEachRow>
<SetVariable name="TempDoc" type="s" value="{ToDirectory}\SE-{ourref}-{docdate}- {fullname}.PDF"/>
<IfFileDoesNotExist filename="{tempdoc}">
<ExportReport reportfile="{DocumentRTM}" exportfile="{TempDoc}" where="(iqacdocument.documentid='{documentid}')"/>
</IfFileDoesNotExist>
</ForEachRow>
</IfAnyRows>
</SQLQuery>
</IfSQL>
</Job>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder