Preciso de Ajuda No Código

Destinado ao auxílio e Troca de informações sobre a ferramenta Xmaker
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
mariomatos
Mensagens: 8
Registrado em: Janeiro 18th, 2011, 9:17 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Preciso de Ajuda No Código

Mensagempor mariomatos » Março 14th, 2011, 10:48 pm

Amigos venho pedir ajuda para analisar um código,não sei bem onde estou pecando,mais não consigo visualizar meu erro
tenho um botão que gera o arquivo txt de um cliente, o arquivo capa e sub capa de nota, só que quando vou no arquivo sempre cria uma linha a mais, e ainda não consigo visualizar onde errei.


Veja o arquivo:

"1";"0001";"19492162504";"5.101";"159431";"159431";"1";"NF";"U";"02/01/06";"02/01/06";"BA";"BA";"S";"N";"";"493,40";"0,00";"0,00";"493,40";"0,00";"0,00";"0,00";"0,00";"0,00";"0,00";"493,40";"0,00";"V"
"3";"118";"040";"01";"20,00";"493,40";"0,00";"0,00";"493,40";"0,00";"0,00";"0,00";"1";"1"

"1";"0001";"04431238000122";"5.101";"159432";"159432";"1";"NF";"U";"02/01/06";"02/01/06";"BA";"BA";"S";"N";"";"1195,45";"0,00";"0,00";"1195,45";"0,00";"0,00";"0,00";"0,00";"0,00";"0,00";"1195,45";"0,00";"P"
"3";"141";"040";"01";"3,00";"88,53";"0,00";"0,00";"88,53";"0,00";"0,00";"0,00";"1";"1"
"3";"137";"040";"02";"5,00";"136,50";"0,00";"0,00";"136,50";"0,00";"0,00";"0,00";"1";"1"
"3";"194";"040";"03";"30,00";"622,80";"0,00";"0,00";"622,80";"0,00";"0,00";"0,00";"1";"1"
"3";"203";"040";"04";"8,00";"182,80";"0,00";"0,00";"182,80";"0,00";"0,00";"0,00";"1";"1"
"3";"138";"040";"05";"2,00";"50,60";"0,00";"0,00";"50,60";"0,00";"0,00";"0,00";"1";"1"
"3";"193";"040";"06";"2,00";"28,26";"0,00";"0,00";"28,26";"0,00";"0,00";"0,00";"1";"1"
"3";"182";"040";"07";"4,00";"85,96";"0,00";"0,00";"85,96";"0,00";"0,00";"0,00";"1";"1"

"1";"0001";"04431238000122";"5.101";"159433";"159433";"1";"NF";"U";"02/01/06";"02/01/06";"BA";"BA";"S";"N";"";"1285,15";"1269,47";"215,81";"15,68";"0,00";"0,00";"156,80";"15,68";"0,00";"0,00";"1128,35";"0,00";"P"
"3";"158";"010";"01";"100,00";"591,00";"0,00";"0,00";"591,00";"0,00";"591,00";"100,47";"1";"1"
"3";"159";"010";"02";"40,00";"374,00";"0,00";"0,00";"374,00";"0,00";"374,00";"63,58";"1";"1"
"3";"167";"010";"03";"4,00";"64,96";"0,00";"0,00";"64,96";"0,00";"64,96";"11,04";"1";"1"
"3";"164";"010";"04";"20,00";"81,80";"8,18";"81,80";"0,00";"10,00";"81,80";"13,91";"1";"1"
"3";"161";"010";"06";"3,00";"40,56";"0,00";"0,00";"40,56";"0,00";"40,56";"6,90";"1";"1"
"3";"165";"010";"07";"3,00";"42,15";"0,00";"0,00";"42,15";"0,00";"42,15";"7,17";"1";"1"

"1";"0001";"04.431.238/0001-22";"5.910";"159434";"159434";"1";"NF";"U";"02/01/06";"02/01/06";"BA";"BA";"S";"N";"MERC. ISENTA DE ICMS CONF. ART. 20 INCISO III (CONV. ICMS 100/97)";"119,24";"0,00";"0,00";"0,00";"0,00";"0,00";"0,00";"0,00";"0,00";"0,00";"119,24";"0,00";"S"

"1";"0001";"10156143534";"5.101";"159435";"159435";"1";"NF";"U";"02/01/06";"02/01/06";"BA";"BA";"N";"N";"";"201,58";"0,00";"0,00";"201,58";"0,00";"0,00";"0,00";"0,00";"0,00";"0,00";"201,58";"0,00";"P"
"3";"194";"040";"01";"8,00";"157,76";"0,00";"0,00";"157,76";"0,00";"0,00";"0,00";"1";"1"
"3";"208";"040";"02";"2,00";"43,82";"0,00";"0,00";"43,82";"0,00";"0,00";"0,00";"1";"1"

Veja o código

var
rg: integer;
rg2:integer;
incdec:integer;
sp: string;
arqtx: string;
s: string;
f: textfile;
Capa: string;
subcapa: string;
begin
savedialog1.filename:='Movimento.txt';
if savedialog1.Execute then
begin
sp:=';';
arqtx:=savedialog1.FileName;
end;
assignfile(f,arqtx);
rewrite(f);
tabglobal.DNF.first;
// incdec:=(2*200) div rg;
// if incdec<1 then
// incdec:=1;
// if rg>200 then
// gauge1.maxvalue:=rg;
while not tabglobal.DNF.eof do
begin
Capa:=
// writeln(f,
'"'+TabGlobal.DNF.TipoS.Conteudo+'"'+sp+ '"'+formatfloat('0000',TabGlobal.DNF.FiIlial.Conteudo)+'"'+sp+ '"'+ TabGlobal.DNF.NCGC.Conteudo+'"'
+sp+ '"'+TabGlobal.DNF.NAOP.Conteudo +'"'+sp+ '"'+formatfloat('000000',TabGlobal.DNF.NRNFINI.Conteudo )+'"'+sp+ '"'+formatfloat('000000',TabGlobal.DNF.NRNFINI.Conteudo )+'"'
+sp+ '"'+TabGlobal.DNF.moDdelo.Conteudo+ '"'+sp+ '"NF"'+sp+ '"U"'+sp+'"'+datetostr(TabGlobal.DNF.DTEM.Conteudo )+'"'+sp+ '"'+datetostr(TabGlobal.DNF.DTEM.Conteudo)+'"'+sp+ '"'+
TabGlobal.DNF.ESTA.Conteudo+'"'+sp+ '"'+TabGlobal.DNF.UFORI.Conteudo+'"'+sp+ '"'+TabGlobal.DNF.PZME.Conteudo+'"'+sp+ '"'+TabGlobal.DNF.CTR1.Conteudo+'"'+sp+ '"'+
TabGlobal.DNF.OBS1.Conteudo+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DNF.VALO.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DNF.TTRI.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DNF.TICM.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DNF.VlrISent.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DNF.BGNRE.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DNF.GNRE.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DNF.BIPI.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DNF.TIPI.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DNF.FRET.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DNF.SEGU.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DNF.ISEIPI.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DNF.VLR_OUTRAS.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+TabGlobal.DNF.DUBL.Conteudo+'"';
writeln(F,UTF8Encode(Capa));
TabGlobal.DNF.AtribuiRelacionamentos;
while not TabGlobal.DITNF.Eof do
begin
Writeln(f,
'"'+TabGlobal.DITNF.Tipo.Conteudo+'"'+sp+ '"'+TabGlobal.DITNF.codigoprod.Conteudo +'"'+sp+ '"0'+TabGlobal.DITNF.st.Conteudo +'"'+sp+ '"'+
formatfloat('00',TabGlobal.DITNF.NRIN.Conteudo)+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DITNF.QC.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DITNF.VALI.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DITNF.VIPI.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DITNF.bcipi.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DITNF.vlrisip.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DITNF.PIPI.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DITNF.VBIC.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+RetiraBrancos(copy(MascValor(TabGlobal.DITNF.VICM.Conteudo,'ZZZZZZZ9,99'),1,11))
+'"'+sp+ '"'+TabGlobal.DITNF.TPPIS.Conteudo +'"'+sp+ '"'+TabGlobal.DITNF.tpcofins.Conteudo+'"');
TabGlobal.DITNF.Next;
end;
writeln(F,UTF8Encode(SubCapa));
// writeln(f,formatfloat('000000',tabglobal.Dpedidos.PEDIDO.conteudo)+sp+datetostr(tabglobal.Dpedidos.DATA.conteudo)+sp+
// formatfloat('00',tabglobal.Dpedidos.VENDEDOR.conteudo)+sp+mascvalor(tabglobal.Dpedidos.VALOR.conteudo,'9999999,99')+sp+
// tabglobal.Dpedidos.CIDADE.conteudo);
if gauge1.progress=0 then
incdec:=1;
tabglobal.DNF.next;
gauge1.AddProgress(incdec);
end;
if tabglobal.DNF.Eof then
begin
gauge1.progress:=200;
end;
//system.closefile(f);
closefile(f);
gauge1.progress:=0;
showmessage('Exportacao concluida. Verifique o Arquivo de destino');
end;

Se alguém puder me ajudar
Desde já grato
Mario

Suporte
Site Admin
Mensagens: 145
Registrado em: Dezembro 20th, 2010, 10:05 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Preciso de Ajuda No Código

Mensagempor Suporte » Março 15th, 2011, 7:15 pm

Olá,

Basta substituir o ultimo "writeln" por "write"
abaixo o código:

writeln(F,UTF8Encode(SubCapa));
ficaria
write(F,UTF8Encode(SubCapa));

Att,
Suporte
_________________
http://www.xmaker.com.br

mariomatos
Mensagens: 8
Registrado em: Janeiro 18th, 2011, 9:17 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Preciso de Ajuda No Código

Mensagempor mariomatos » Março 16th, 2011, 12:45 am

Venho neste momento de alegria e vitória graças ao trabalho e atenção do suporte xmaker, fico imensuravelmente grato pela atenção e competência dos mesmos.
Grato
Mario


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Voltar para “Xmaker”

Quem está online

Usuários navegando neste fórum: Nenhum usuário registrado e 6 visitantes