Jump to content
camexavi

PHC Corporate 25 - Importar artigos de excel

Recommended Posts

camexavi

Boa tarde meus caros,

Preciso uma vez mais da vossa preciosa ajuda, para importar artigos de um ficheiro excel.

O objetivo seria importar para a tabela ST e STOBS

Importar para ST consigo, mas não consigo para STOBS.

O código que tenho é:

m_file=Getfile("XLS","Ficheiro","Escolher",0,"Seleccione o Ficheiro a Importar")
If Type("m_file")<>"C" Or Not File(m_file)
Messagebox("Ficheiro Não Encontrado")
Return
Endif
Create cursor PLANO (a c(100),	b c(100),	c c(100),	d c(100),	e c(100),	f c(100),	g c(100),	h c(100),	i c(100),	j c(100),	k c(100),	l c(100),	m c(100),	n c(100),	o c(100),	p c(100),	q c(100),	r c(100),	s c(100),	t c(100),	u c(100),	v c(100),	w c(100),	x c(100),	y c(100),	z c(100),	aa c(100),	ab c(100),	ac c(100),	ad c(100),	ae c(100))

set point to "."
APPEND FROM (m_file) XLS
select PLANO


go top
scan for alltrim(PLANO.a)<>'ref'
select st
select stobs

TEXT TO msel NOSHOW

insert into st (st.ststamp,st.ref,st.codigo,st.design,st.epcusto,st.pcusto,st.epv4,st.epv5,st.pv4,st.pv5,st.desc5,st.desc6,st.usr3,st.usr4,st.usr6,st.iva4incl,st.iva5incl,st.forref,st.fornecedor,st.usr2,st.usr1,st.tabiva,st.fornec,st.imagem,st.imgqlook,st.cpoc,st.containv,st.contacev,st.unidade)

select 
?alltrim(u_stamp()),
?alltrim(PLANO.a),
?alltrim(PLANO.b),
?alltrim(PLANO.c),
?val(PLANO.d),
?val(PLANO.e),
?val(PLANO.f),
?val(PLANO.g),
?val(PLANO.h),
?val(PLANO.i),
?alltrim(PLANO.j),
?alltrim(PLANO.k),
?alltrim(PLANO.l),
?alltrim(PLANO.m),
?alltrim(PLANO.n),
?val(PLANO.o),
?val(PLANO.p),
?alltrim(PLANO.q),
?alltrim(PLANO.r),
?alltrim(PLANO.s),
?alltrim(PLANO.t),
?val(PLANO.u),
?val(PLANO.v),
?alltrim(PLANO.w),
?alltrim(PLANO.x),
?val(PLANO.y),
?val(PLANO.z),
?val(PLANO.aa),
?alltrim(PLANO.ab);


insert into stobs (stobs.stobsstamp,stobs.ref,stobs.tipoprod,stobs.tfcla,stobs.tfcladesc)
select 
?alltrim(u_stamp()),
?alltrim(PLANO.a),
?alltrim(PLANO.ac),
?alltrim(PLANO.ad),
?alltrim(PLANO.ae);


ENDTEXT
u_sqlexec(msel)


endscan

mensagem('Terminado...','directa')

Agradecia a V/ ajuda .

 

Muito obrigado! ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.