Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 15-02-2007
fergape fergape is offline
Miembro
 
Registrado: oct 2005
Posts: 19
Poder: 0
fergape Va por buen camino
La parte de código que esta en rojo es una exportacion y esa funciona de 10 y la de codigo azul es otra exportacion y es la que no funciona..

Código Delphi [-]
procedure Trf_IncDocAAN.btnExportarClick(Sender: TObject);
var
LineNumber, LCID : Integer;
LineString : String;
begin
inherited;
if radiogroup1.ItemIndex = 0 then
begin
with SaveDialog1 do
begin
FileName := '';
Filter := 'Excel files|*.XLS;All Files|*.*';
DefaultExt := 'xls';
Title := 'Exportando a Excel';
if execute then
begin
qryIncDocmensual.Open;
LCID := GetUserDefaultLCID;
with ExcelApplication1 do
begin
connect;
try
visible[LCID] := true;
Workbooks.Add(EmptyParam,LCID);
Range['A1','T1'].Value2 := VarArrayOf(['Mes','Documento','Apellido y Nombre','Rama de Enza.','Código del cargo','Carga Horaria','Tipo De Cargo',
'Sit. de revista','Subv.','Asist.','Código Liquid./ Clave Identif.','Clave Identif.','Haberes Brutos','Haberes Líquidos','Años A.',
'Obra Soc.','Sexo','Cuil','CUE','Niveles de Enza.']);
// se definen formatos de las celdas
with Range['A1','T1'] do
begin
HorizontalAlignment := xlcenter;
VerticalAlignment := xlBottom;
Wraptext := false;
orientation := 0;
ShrinkTofit := false;
MergeCells := false;
font.Bold := true;
end;
qryIncDocMensual.First;
LineNumber := 1;
//envia datos a excel
while not qryIncDocMensual.Eof do
begin
//antiguedad
if qryIncDocMensualtotalAntig.IsNull then
antiguedad := qryIncDocMensualAntig.Value
else
antiguedad := qryIncDocMensualtotalAntig.Value;
// horas del cargo
hscarga := qryIncDocMensualhoras_carga.AsInteger;
if hscarga < 10 then
hs := '''0'+inttostr(hscarga)+'00'
else
hs := inttostr(hscarga)+'00';
if qryIncDocMensualhoras_carga.AsInteger <= 0 then
hstotal:= inttostr(qryIncDocMensualcarga_c.AsInteger)
else
hstotal := hs;
//DNI
if strtoint(trim(qryIncDocMensualdni.Value)) < 10000000 then
dni := qryIncDocMensualsexodni.Value
else
dni :=qryIncDocMensualdni.AsString;
//cambio de periodo en el mes con el retroactivo
if qryIncDocMensualperiodoRetro.IsNull then
periodo := qryIncDocMensualperiod.AsInteger
else
periodo := qryIncDocMensualPeriodoRetro.Value;
Inc(LineNumber);
LineString := IntToStr(LineNumber);
Range['A'+LineString,'T'+LineString].Value2:=
VarArrayOf([periodo,dni,qryIncDocMensualname_full.Value,
qryIncDocMensualrama.Value,qryIncDocMensualcod_cargo.Value,hstotal,
qryIncDocMensualPersonal.Value,qryIncDocMensualSitRev.Value,qryIncDocMensualsubv.Value,
qryIncDocMensualAsist.Value,qryIncDocMensualcodigoliquid.Value,qryIncDocMensualclave.Value,
formato(qryIncDocMensualbruto.AsFloat,6),formato(qryIncDocMensualneto.AsFloat,6),
antiguedad,qryIncDocMensualobra_social.Value,qryIncDocMensualsexo.Value,
qryIncDocMensualcuil.Value,qryIncDocMensualcode_denominational.Value,qryIncDocMensualnivel.Value]);
qryIncDocMensual.Next;
end;
Range['A1','T'+ LineString].AutoFormat(xlRangeAutoFormatList1,true,true,false,true,true,true);
Range['A1','T'+ LineString].Columns.AutoFit;
Range['A1','T'+ LineString].HorizontalAlignment := xlcenter;
ActiveWorkbook.SaveAs(filename,null,null,null,false,false,xlnochange,
xlUserResolution,false,null,null,LCID,0);
Quit;
finally
disconnect;
end;// fin del with Range
end;//fin del with ExcelApplication1
end;// fin del if execute
end;//fin del with SaveDialog1
end;//fin del if
 
if radiogroup2.ItemIndex = 0 then
begin
with SaveDialog1 do
begin
FileName := '';
Filter := 'Excel files|*.XLS;All Files|*.*';
DefaultExt := 'xls';
Title := 'Exportando a Excel';
if execute then
begin
qryPrimerSemestre.Open;
LCID := GetUserDefaultLCID;
with ExcelApplication1 do
begin
connect;
try
visible[LCID] := true;
Workbooks.Add(EmptyParam,LCID);
Range['A1','R1'].Value2 := VarArrayOf(['Codigo APS','Mes','Documento','Apellido y Nombre','Rama Enza.','Código del Cargo','Carga Horaria',
'Tipo de Cargo','Sit. Revista','Subvención','Asist.','Clave identif.','Años de Antiguedad','O. social',
'Sexo','Cuil','CUE','Nivel']);
// se definen formatos de las celdas
with Range['A1','R1'] do
begin
HorizontalAlignment := xlcenter;
VerticalAlignment := xlBottom;
Wraptext := false;
orientation := 0;
ShrinkTofit := false;
MergeCells := false;
font.Bold := true;
end;
qryPrimerSemestre.First;
LineNumber := 1;
//envia datos a excel
while not qryPrimerSemestre.Eof do
begin
// horas del cargo
if (qryPrimerSemestreCarga_horaria.IsNull) and (qryPrimerSemestreCarga_C.IsNull) then
hsTotal := 'Nulo' else
begin
if qryPrimerSemestrecarga_horaria.AsInteger <= 0 then
hstotal := qryPrimerSemestrecarga_c.AsString
else
hstotal := qryPrimerSemestrecarga_horaria.AsString;
end;
//DNI
if strtoint(trim(qryPrimerSemestredni.Value)) < 10000000 then
dni := qryPrimerSemestresexodni.Value
else
dni := qryPrimerSemestredni.AsString;
//antiguedad
if qryprimerSemestretotalantig.IsNull then
antiguedad := qryPrimerSemestreAntig.Value
else
antiguedad := qryPrimerSemestretotalAntig.Value;
//RAMA ENZA.
if qryPrimerSemestrerama2.IsNull then
ramaEnza := qryprimerSemestrerama.Value
else
ramaEnza := qryPrimerSemestreRama2.Value;
//Asistencia
if qryPrimerSemestreasist.IsNull then
asist := qryPrimerSemestreasist1.AsInteger
else
asist := qryPrimerSemestreasist.AsInteger;
//mayores a 30
if asist > 30 then
asist := 30;
Inc(LineNumber);
LineString := IntToStr(LineNumber);
Range['A'+LineString,'R'+LineString].Value2:=
VarArrayOf([qryPrimerSemestreenrollment_code.value,qryPrimerSemestreperiod.Value,dni,qryPrimerSemestrename_full.  Value,ramaEnza,
qryPrimerSemestrecod_cargo.Value,hstotal,qryPrimerSemestrepersonal.Value,qryPrimerSemestresitRev.Val  ue,
qryPrimerSemestresubv.Value,asist,qryPrimerSemestreclave.Value,antiguedad,
qryPrimerSemestreobra_social.Value,qryPrimerSemestresexo.Value,qryPrimerSemestreCuil.Value,qryPrimer  Semestrecode_denominational.Value,
qryPrimerSemestrenivel.Value]);
qryPrimerSemestre.Next;
end;
Range['A1','R'+ LineString].AutoFormat(xlRangeAutoFormatList1,true,true,true,true,true,true);
Range['A1','R'+ LineString].Columns.AutoFit;
Range['A1','R'+ LineString].HorizontalAlignment := xlcenter;
ActiveWorkbook.SaveAs(FileName,null,null,null,false,false,xlnochange,
xlUserResolution,false,null,null,LCID,0);
Quit;
finally
disconnect;
end;// fin del with Range
end;//fin del with ExcelApplication1
end;// fin del if execute
end;//fin del with SaveDialog1
end//fin del if radiogroup2
else
begin
with SaveDialog1 do
begin
FileName := '';
Filter := 'Excel files|*.XLS;All Files|*.*';
DefaultExt := 'xls';
Title := 'Exportando a Excel';
if execute then
begin
qrySegundoSemestre.Open;
LCID := GetUserDefaultLCID;
with ExcelApplication1 do
begin
connect;
try
visible[LCID] := true;
Workbooks.Add(EmptyParam,LCID);
Range['A1','R1'].Value2 := VarArrayOf(['Codigo APS','Mes','Documento','Apellido y Nombre','Rama Enza.','Código del Cargo','Carga Horaria',
'Tipo de Cargo','Sit. Revista','Subvención','Asist.','Clave identif.','Años de Antiguedad','O. social',
'Sexo','Cuil','CUE','Nivel']);
// se definen formatos de las celdas
with Range['A1','R1'] do
begin
HorizontalAlignment := xlcenter;
VerticalAlignment := xlBottom;
Wraptext := false;
orientation := 0;
ShrinkTofit := false;
MergeCells := false;
font.Bold := true;
end;
qrySegundoSemestre.First;
LineNumber := 1;
//envia datos a excel
while not qrySegundoSemestre.Eof do
begin
// horas del cargo
if (qrySegundoSemestreCarga_horaria.IsNull) and (qrySegundoSemestreCarga_C.IsNull) then
hsTotal := 'Nulo' else
begin
if qrySegundoSemestrecarga_horaria.AsInteger <= 0 then
hstotal := qryPrimerSemestrecarga_c.AsString
else
hstotal := qrySegundoSemestrecarga_horaria.AsString;
end;
//DNI
if strtoint(trim(qrySegundoSemestredni.Value)) < 10000000 then
dni := qrySegundoSemestresexodni.Value
else
dni := qrySegundoSemestredni.AsString;
//antiguedad
if qryprimerSemestretotalantig.IsNull then
antiguedad := qrySegundoSemestreAntig.Value
else
antiguedad := qrySegundoSemestretotalAntig.Value;
//RAMA ENZA.
if qrySegundoSemestrerama2.IsNull then
ramaEnza := qrySegundoSemestrerama.Value
else
ramaEnza := qrySegundoSemestreRama2.Value;
//Asistencia
if qrySegundoSemestreasist.IsNull then
asist := qrySegundoSemestreasist1.AsInteger
else
asist := qrySegundoSemestreasist.AsInteger;
//mayores a 30
if asist > 30 then
asist := 30;
Inc(LineNumber);
LineString := IntToStr(LineNumber);
Range['A'+LineString,'R'+LineString].Value2:=
VarArrayOf([qrySegundoSemestreenrollment_code.value,qrySegundoSemestreperiod.Value,dni,qrySegundoSemestrename_fu  ll.Value,ramaEnza,
qrySegundoSemestrecod_cargo.Value,hstotal,qrySegundoSemestrepersonal.Value,qrySegundoSemestresitRev.  Value,
qrySegundoSemestresubv.Value,asist,qrySegundoSemestreclave.Value,antiguedad,
qrySegundoSemestreobra_social.Value,qrySegundoSemestresexo.Value,qrySegundoSemestreCuil.Value,qrySeg  undoSemestrecode_denominational.Value,
qrySegundoSemestrenivel.Value]);
qrySegundoSemestre.Next;
end;
Range['A1','R'+ LineString].AutoFormat(xlRangeAutoFormatList1,true,true,true,true,true,true);
Range['A1','R'+ LineString].Columns.AutoFit;
Range['A1','R'+ LineString].HorizontalAlignment := xlcenter;
ActiveWorkbook.SaveAs(FileName,null,null,null,false,false,xlnochange,
xlUserResolution,false,null,null,LCID,0);
Quit;
finally

disconnect;
end;// fin del with Range
end;//fin del with ExcelApplication1
end;// fin del if execute
end;//fin del with SaveDialog1
end;//fin del else
qryIncDocMensual.Close;
qrySegundoSemestre.Close;
qryprimersemestre.Close;
end;

EDITO (Neftalí): Añadidas TAG's Delphi.

Última edición por Neftali [Germán.Estévez] fecha: 15-02-2007 a las 19:33:08.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Error de Ejecución luxus API de Windows 1 03-11-2006 09:24:13
error en tiempo de ejecución Nelly Varios 9 16-12-2005 15:54:14
error en la ejecucion chechu Varios 5 25-11-2005 00:36:11
Error en tiempo de ejecucion. ramonibk MS SQL Server 2 23-10-2004 20:18:42
Mensaje de error en ejecución andresenlared Conexión con bases de datos 3 08-01-2004 15:14:58


La franja horaria es GMT +2. Ahora son las 23:15:43.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi