20240412 16:33 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),1 FROM  Documento_linhas_D1 as b left join  Documento_D1 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:33 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),2 FROM  Documento_linhas_D2 as b left join  Documento_D2 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:33 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),3 FROM  Documento_linhas_D3 as b left join  Documento_D3 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:33 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),6 FROM  Documento_linhas_D6 as b left join  Documento_D6 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:33 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),10 FROM  Documento_linhas_D10 as b left join  Documento_D10 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:33 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),18 FROM  Documento_linhas_D18 as b left join  Documento_D18 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:33 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),20 FROM  Documento_linhas_D20 as b left join  Documento_D20 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:33 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),21 FROM  Documento_linhas_D21 as b left join  Documento_D21 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:33 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),22 FROM  Documento_linhas_D22 as b left join  Documento_D22 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:33 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),23 FROM  Documento_linhas_D23 as b left join  Documento_D23 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:38 UPDATE assistencias SET linhas_apt=0,linhas_obr=0,linhas_rlt=0,linhas_rpr=0,n_doc=2,d_rec=20230918000000,d_obr=NULL,d_rpr=NULL,emitida=0,anulada='',no_est=0,no_cli=0,nome_cli='',observacao='',equip='',marca='',modelo='',serie='',contador=0,anomalia1='',anomalia2='',anomalia3='',anomalia4='',obs1='',obs2='',nome_rcp='',nome_ent='',flg_gc='',flg_tp='',ref_gc='',d_fim=NULL,tot_horas=0.00,tot_mat=0.00,tot_mo=0.00,tot_rep=0.00,tipo_doc=0,abrv_doc='',num_doc=0,tot_fact=0.00,iva=0.00,tot_iva=0.00,tot_val=0.00,serie2='',processo='',rsv='' WHERE IDX=13 LIMIT 1;
20240412 16:39 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),1 FROM  Documento_linhas_D1 as b left join  Documento_D1 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:39 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),2 FROM  Documento_linhas_D2 as b left join  Documento_D2 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:39 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),3 FROM  Documento_linhas_D3 as b left join  Documento_D3 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:39 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),6 FROM  Documento_linhas_D6 as b left join  Documento_D6 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:39 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),10 FROM  Documento_linhas_D10 as b left join  Documento_D10 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:39 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),18 FROM  Documento_linhas_D18 as b left join  Documento_D18 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:39 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),20 FROM  Documento_linhas_D20 as b left join  Documento_D20 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:39 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),21 FROM  Documento_linhas_D21 as b left join  Documento_D21 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:39 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),22 FROM  Documento_linhas_D22 as b left join  Documento_D22 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:39 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),23 FROM  Documento_linhas_D23 as b left join  Documento_D23 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:40 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),1 FROM  Documento_linhas_D1 as b left join  Documento_D1 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:40 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),2 FROM  Documento_linhas_D2 as b left join  Documento_D2 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:40 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),3 FROM  Documento_linhas_D3 as b left join  Documento_D3 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:40 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),6 FROM  Documento_linhas_D6 as b left join  Documento_D6 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:40 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),10 FROM  Documento_linhas_D10 as b left join  Documento_D10 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:40 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),18 FROM  Documento_linhas_D18 as b left join  Documento_D18 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:40 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),20 FROM  Documento_linhas_D20 as b left join  Documento_D20 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:40 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),21 FROM  Documento_linhas_D21 as b left join  Documento_D21 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:40 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),22 FROM  Documento_linhas_D22 as b left join  Documento_D22 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:40 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),23 FROM  Documento_linhas_D23 as b left join  Documento_D23 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:40 DELETE FROM assist_apt WHERE  numero=2 
20240412 16:40 DELETE FROM assist_obr WHERE  numero=2 
20240412 16:40 DELETE FROM assist_rlt WHERE  numero=2 
20240412 16:40 DELETE FROM assist_rpr WHERE  numero=2 
20240412 16:41 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),1 FROM  Documento_linhas_D1 as b left join  Documento_D1 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:41 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),2 FROM  Documento_linhas_D2 as b left join  Documento_D2 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:41 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),3 FROM  Documento_linhas_D3 as b left join  Documento_D3 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:41 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),6 FROM  Documento_linhas_D6 as b left join  Documento_D6 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:41 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),10 FROM  Documento_linhas_D10 as b left join  Documento_D10 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:41 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),18 FROM  Documento_linhas_D18 as b left join  Documento_D18 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:41 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),20 FROM  Documento_linhas_D20 as b left join  Documento_D20 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:41 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),21 FROM  Documento_linhas_D21 as b left join  Documento_D21 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:41 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),22 FROM  Documento_linhas_D22 as b left join  Documento_D22 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:41 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),23 FROM  Documento_linhas_D23 as b left join  Documento_D23 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 16:43 TRUNCATE TABLE documento_D1
20240412 16:43 TRUNCATE TABLE documento_linhas_D1
20240412 16:43 TRUNCATE TABLE documento_D1_a_hash
20240412 16:43 TRUNCATE TABLE documento_D2
20240412 16:43 TRUNCATE TABLE documento_linhas_D2
20240412 16:43 TRUNCATE TABLE documento_D2_a_hash
20240412 16:43 TRUNCATE TABLE documento_D3
20240412 16:43 TRUNCATE TABLE documento_linhas_D3
20240412 16:43 TRUNCATE TABLE documento_D3_a_hash
20240412 16:43 TRUNCATE TABLE documento_D5
20240412 16:43 TRUNCATE TABLE documento_linhas_D5
20240412 16:43 TRUNCATE TABLE documento_D5_a_hash
20240412 16:43 TRUNCATE TABLE documento_D6
20240412 16:43 TRUNCATE TABLE documento_linhas_D6
20240412 16:43 TRUNCATE TABLE documento_D6_a_hash
20240412 16:43 TRUNCATE TABLE documento_D7
20240412 16:43 TRUNCATE TABLE documento_linhas_D7
20240412 16:43 TRUNCATE TABLE documento_D7_a_hash
20240412 16:43 TRUNCATE TABLE documento_D10
20240412 16:43 TRUNCATE TABLE documento_linhas_D10
20240412 16:43 TRUNCATE TABLE documento_D10_a_hash
20240412 16:43 TRUNCATE TABLE documento_D11
20240412 16:43 TRUNCATE TABLE documento_linhas_D11
20240412 16:43 TRUNCATE TABLE documento_D11_a_hash
20240412 16:43 TRUNCATE TABLE documento_D13
20240412 16:43 TRUNCATE TABLE documento_linhas_D13
20240412 16:43 TRUNCATE TABLE documento_D13_a_hash
20240412 16:43 TRUNCATE TABLE documento_D14
20240412 16:43 TRUNCATE TABLE documento_linhas_D14
20240412 16:43 TRUNCATE TABLE documento_D14_a_hash
20240412 16:43 TRUNCATE TABLE documento_D15
20240412 16:43 TRUNCATE TABLE documento_linhas_D15
20240412 16:43 TRUNCATE TABLE documento_D15_a_hash
20240412 16:43 TRUNCATE TABLE documento_D16
20240412 16:43 TRUNCATE TABLE documento_linhas_D16
20240412 16:43 TRUNCATE TABLE documento_D16_a_hash
20240412 16:43 TRUNCATE TABLE documento_D17
20240412 16:43 TRUNCATE TABLE documento_linhas_D17
20240412 16:43 TRUNCATE TABLE documento_D17_a_hash
20240412 16:43 TRUNCATE TABLE documento_D18
20240412 16:43 TRUNCATE TABLE documento_linhas_D18
20240412 16:43 TRUNCATE TABLE documento_D18_a_hash
20240412 16:44 TRUNCATE TABLE documento_D20
20240412 16:44 TRUNCATE TABLE documento_linhas_D20
20240412 16:44 TRUNCATE TABLE documento_D20_a_hash
20240412 16:44 TRUNCATE TABLE documento_D21
20240412 16:44 TRUNCATE TABLE documento_linhas_D21
20240412 16:44 TRUNCATE TABLE documento_D21_a_hash
20240412 16:44 TRUNCATE TABLE documento_D22
20240412 16:44 TRUNCATE TABLE documento_linhas_D22
20240412 16:44 TRUNCATE TABLE documento_D22_a_hash
20240412 16:44 TRUNCATE TABLE documento_D23
20240412 16:44 TRUNCATE TABLE documento_linhas_D23
20240412 16:44 TRUNCATE TABLE documento_D23_a_hash
20240412 16:44 TRUNCATE TABLE documento_R1
20240412 16:44 TRUNCATE TABLE reciboslinhas01
20240412 16:44 TRUNCATE TABLE documento_R2
20240412 16:44 TRUNCATE TABLE reciboslinhas02
20240412 16:44 INSERT INTO fornecedores (idx,lnhcco,lnhcnt,lnhart,lnhcmp,numero,nome_1,nome_2,morada,localidade,cod_post,concelho,distrito,zona,n_pais,pais,contribuinte,telefone,fax,n_cp,c_pagamento,prazo,desconto,linha_precos,n_bnc,email,conta,n_vendedor,vendedor,comissao,ppz,saldo0,saldo1,obs,dsc_linha,plafont,no_classe,des_classe,lim_cred,data,miva,venc,rsv,teste,teste1,teste) VALUES(NULL,0,0,0,0,0,'','','','','','','','',0,'','','','',0,'',0,0.00,0,0,'','',0,'',0.00,'',0.00,0.00,'',0.00,0.00,0,'',0,NULL,0,0,'','','','');
20240412 16:44 INSERT INTO artigos (idx,lnh_des,lnh_arm,lnh_cmp,lnh_equ,codigo,codigo2,designacao_1,designacao_2,abvr,no_un_,unidade,armazem,familia,ultimo_custo,custo_medio,valor_medio,no_iva,iva,marg_1,marg_2,prc_s_iva_1,prc_s_iva_2,prc_c_iva_1,prc_c_iva_2,stock_minimo,stock,stock_maximo,no_forn,d_entrada,d_saida,baixa,lnh_obs,stock2,lnh_emb,lnh_prom,flg,anos_ga,local_imp,usaserie,miva,rsv,marg_3,prc_s_iva_3,prc_c_iva_3,marg_4,prc_s_iva_4,prc_c_iva_4,peso) VALUES(NULL,0,0,0,0,'1','1','','','',0,'','','',0.0000000,0.0000000,0.0000000,0,0.00,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.000,0.000,0.000,0,NULL,NULL,'','',0.0000,'','',0,0,0,'',0,'',1199192613078358300000.0000000,'0.000000','0.000000','0.000000','0.000000','0.000000','');
20240412 16:45 UPDATE artigos SET lnh_des=0,lnh_arm=0,lnh_cmp=0,lnh_equ=0,codigo='1',codigo2='1',designacao_1='artigo 1',designacao_2='',abvr='',no_un_=0,unidade='',armazem='',familia='1',ultimo_custo=0.0000000,custo_medio=0.0000000,valor_medio=0.0000000,no_iva=1,iva=0.00,marg_1=0.0000000,marg_2=0.0000000,prc_s_iva_1=0.0000000,prc_s_iva_2=0.0000000,prc_c_iva_1=0.0000000,prc_c_iva_2=0.0000000,stock_minimo=0.000,stock=0.000,stock_maximo=0.000,no_forn=0,d_entrada=NULL,d_saida=NULL,baixa='S',lnh_obs='',stock2=0.0000,lnh_emb='',lnh_prom='',flg=0,anos_ga=0,local_imp=0,usaserie='N',miva=0,rsv='',marg_3=1199192613078358300000.0000000,prc_s_iva_3='0.000000',prc_c_iva_3='0.000000',marg_4='0.000000',prc_s_iva_4='0.000000',prc_c_iva_4='0.000000',peso='' WHERE IDX=1 LIMIT 1;
20240412 16:45 INSERT INTO clientes (idx,lnhcco,lnhcnt,lnhart,lnhcmp,numero,nome_1,nome_2,morada,localidade,cod_post,concelho,distrito,zona,n_pais,pais,contribuinte,telefone,fax,n_cp,c_pagamento,prazo,desconto,linha_precos,n_bnc,email,conta,n_vendedor,vendedor,comissao,ppz,saldo0,saldo1,obs,dsc_linha,plafont,no_classe,des_classe,lim_cred,data,miva,venc,rsv) VALUES(NULL,0,0,0,0,1,'','','','','','','','',0,'','','','',0,'',0,0.00,1,0,'','',0,'',0.00,'',0.00,0.00,'',0.00,0.00,0,'',0,NULL,0,0,'');
20240412 16:45 UPDATE clientes SET lnhcco=0,lnhcnt=0,lnhart=0,lnhcmp=0,numero=1,nome_1='Cliente 1',nome_2='',morada='',localidade='',cod_post='',concelho='',distrito='',zona='',n_pais=0,pais='',contribuinte='',telefone='',fax='',n_cp=0,c_pagamento='',prazo=0,desconto=0.00,linha_precos=1,n_bnc=0,email='',conta='',n_vendedor=0,vendedor='',comissao=0.00,ppz='',saldo0=0.00,saldo1=0.00,obs='',dsc_linha=0.00,plafont=0.00,no_classe=0,des_classe='',lim_cred=0,data=NULL,miva=0,venc=0,rsv='' WHERE IDX=1 LIMIT 1;
20240412 16:45 INSERT INTO clientes (idx,lnhcco,lnhcnt,lnhart,lnhcmp,numero,nome_1,nome_2,morada,localidade,cod_post,concelho,distrito,zona,n_pais,pais,contribuinte,telefone,fax,n_cp,c_pagamento,prazo,desconto,linha_precos,n_bnc,email,conta,n_vendedor,vendedor,comissao,ppz,saldo0,saldo1,obs,dsc_linha,plafont,no_classe,des_classe,lim_cred,data,miva,venc,rsv) VALUES(NULL,0,0,0,0,2,'','','','','','','','',0,'','','','',0,'',0,0.00,1,0,'','',0,'',0.00,'',0.00,0.00,'',0.00,0.00,0,'',0,NULL,0,0,'');
20240412 16:45 UPDATE clientes SET lnhcco=0,lnhcnt=0,lnhart=0,lnhcmp=0,numero=2,nome_1='Cliente 2',nome_2='',morada='',localidade='',cod_post='',concelho='',distrito='',zona='',n_pais=0,pais='',contribuinte='',telefone='',fax='',n_cp=0,c_pagamento='',prazo=0,desconto=0.00,linha_precos=1,n_bnc=0,email='',conta='',n_vendedor=0,vendedor='',comissao=0.00,ppz='',saldo0=0.00,saldo1=0.00,obs='',dsc_linha=0.00,plafont=0.00,no_classe=0,des_classe='',lim_cred=0,data=NULL,miva=0,venc=0,rsv='' WHERE IDX=2 LIMIT 1;
20240412 16:46 UPDATE assistencias SET linhas_apt=0,linhas_obr=0,linhas_rlt=0,linhas_rpr=0,n_doc=1,d_rec=20230918000000,d_obr=NULL,d_rpr=NULL,emitida=2,anulada='',no_est=0,no_cli=1,nome_cli='Cliente 1',observacao='',equip='Portatil',marca='asus',modelo='a341',serie='123',contador=0,anomalia1='nao arranca',anomalia2='',anomalia3='',anomalia4='',obs1='',obs2='mala e transformador',nome_rcp='Tecnico 1',nome_ent='luisa',flg_gc='',flg_tp='',ref_gc='',d_fim=NULL,tot_horas=0.00,tot_mat=0.00,tot_mo=0.00,tot_rep=0.00,tipo_doc=0,abrv_doc='',num_doc=0,tot_fact=0.00,iva=0.00,tot_iva=0.00,tot_val=0.00,serie2='',processo='',rsv='' WHERE IDX=12 LIMIT 1;
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,10,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,15,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,20,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,25,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,30,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,35,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,40,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,45,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,50,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,55,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,60,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,65,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,70,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,75,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,80,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,85,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,90,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,95,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,100,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,105,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,110,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,115,0,1,NULL,'',0,0,'');
20240412 16:56 INSERT INTO assist_apt (idx,linha,cor,numero,data,obs,km,act,rsv) VALUES(NULL,120,0,1,NULL,'',0,0,'');
20240412 17:02 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,5,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:02 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,10,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:02 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,15,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:02 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,20,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:02 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,25,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:02 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,30,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:02 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,35,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:02 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,40,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:02 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,45,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:02 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,50,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:02 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,55,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:02 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,60,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,65,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,70,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,75,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,80,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,85,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,90,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,95,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,100,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,105,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,110,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,115,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,120,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,125,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,130,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,135,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,140,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:04 INSERT INTO assist_obr (idx,linha,cor,numero,no_tecn,custo_tec,data,hi,hf,ht,cod_art,des_art,qtd,preco,preco_v,rsv) VALUES(NULL,145,0,1,0,0.00,NULL,20000101000000,20000101000000,20000101000000,'','',0.00,0.00,0.00,'');
20240412 17:05 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),1 FROM  Documento_linhas_D1 as b left join  Documento_D1 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:05 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),2 FROM  Documento_linhas_D2 as b left join  Documento_D2 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:05 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),3 FROM  Documento_linhas_D3 as b left join  Documento_D3 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:05 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),6 FROM  Documento_linhas_D6 as b left join  Documento_D6 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:05 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),10 FROM  Documento_linhas_D10 as b left join  Documento_D10 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:05 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),18 FROM  Documento_linhas_D18 as b left join  Documento_D18 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:05 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),20 FROM  Documento_linhas_D20 as b left join  Documento_D20 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:05 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),21 FROM  Documento_linhas_D21 as b left join  Documento_D21 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:05 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),22 FROM  Documento_linhas_D22 as b left join  Documento_D22 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:05 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),23 FROM  Documento_linhas_D23 as b left join  Documento_D23 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:05 UPDATE empresas SET no=1,nome='',directoria='',password='',contribuinte='',dados_0='',dados_1='',dados_2='',dados_3='',dados_4='',dados_5='',dados_6='',dados_7='',ma='',mt='',rg='',flg_s_gcs='',drive_gcs='',ano=0,flg_r_gcs='',flg_g_gcs='',num_ant=0,ano_ant='',num_seg=0,ano_seg='',moeda=0,ser_smtp='',rsv='' WHERE IDX=1 LIMIT 1;
20240412 17:06 UPDATE empresas SET no=1,nome='LOJA',directoria='emp0001',password='',contribuinte='',dados_0='',dados_1='',dados_2='',dados_3='',dados_4='',dados_5='',dados_6='',dados_7='',ma='',mt='',rg='',flg_s_gcs='',drive_gcs='',ano=0,flg_r_gcs='',flg_g_gcs='',num_ant=0,ano_ant='',num_seg=0,ano_seg='',moeda=0,ser_smtp='',rsv='' WHERE IDX=1 LIMIT 1;
20240412 17:06 UPDATE empresas SET no=1,nome='LOJA',directoria='emp0001',password='',contribuinte='',dados_0='',dados_1='',dados_2='',dados_3='',dados_4='',dados_5='',dados_6='',dados_7='',ma='',mt='',rg='',flg_s_gcs='',drive_gcs='',ano=0,flg_r_gcs='',flg_g_gcs='',num_ant=0,ano_ant='',num_seg=0,ano_seg='',moeda=0,ser_smtp='',rsv='' WHERE IDX=1 LIMIT 1;
20240412 17:06 UPDATE empresas SET no=1,nome='LOJA',directoria='emp0001',password='',contribuinte='',dados_0='',dados_1='',dados_2='',dados_3='',dados_4='',dados_5='',dados_6='',dados_7='',ma='',mt='',rg='',flg_s_gcs='',drive_gcs='',ano=0,flg_r_gcs='',flg_g_gcs='',num_ant=0,ano_ant='',num_seg=0,ano_seg='',moeda=0,ser_smtp='',rsv='' WHERE IDX=1 LIMIT 1;
20240412 17:06 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),1 FROM  Documento_linhas_D1 as b left join  Documento_D1 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:06 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),2 FROM  Documento_linhas_D2 as b left join  Documento_D2 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:06 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),3 FROM  Documento_linhas_D3 as b left join  Documento_D3 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:06 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),6 FROM  Documento_linhas_D6 as b left join  Documento_D6 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:06 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),10 FROM  Documento_linhas_D10 as b left join  Documento_D10 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:06 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),18 FROM  Documento_linhas_D18 as b left join  Documento_D18 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:06 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),20 FROM  Documento_linhas_D20 as b left join  Documento_D20 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:06 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),21 FROM  Documento_linhas_D21 as b left join  Documento_D21 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:06 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),22 FROM  Documento_linhas_D22 as b left join  Documento_D22 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:06 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),23 FROM  Documento_linhas_D23 as b left join  Documento_D23 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:07 INSERT INTO empresas (idx,no,nome,directoria,password,contribuinte,dados_0,dados_1,dados_2,dados_3,dados_4,dados_5,dados_6,dados_7,ma,mt,rg,flg_s_gcs,drive_gcs,ano,flg_r_gcs,flg_g_gcs,num_ant,ano_ant,num_seg,ano_seg,moeda,ser_smtp,rsv) VALUES(NULL,2,'LOJA','emp0002','','999999990','******','','','','','','IBAN:','','','','','','',0,'','',0,'',0,'',0,'','');
20240412 17:07 UPDATE empresas SET no=2,nome='LOJA',directoria='emp0002',password='',contribuinte='999999990',dados_0='******',dados_1='',dados_2='',dados_3='',dados_4='',dados_5='',dados_6='IBAN:',dados_7='',ma='',mt='',rg='',flg_s_gcs='',drive_gcs='',ano=0,flg_r_gcs='',flg_g_gcs='',num_ant=0,ano_ant='',num_seg=0,ano_seg='',moeda=0,ser_smtp='',rsv='' WHERE IDX=2 LIMIT 1;
20240412 17:07 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),1 FROM  Documento_linhas_D1 as b left join  Documento_D1 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:07 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),2 FROM  Documento_linhas_D2 as b left join  Documento_D2 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:07 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),3 FROM  Documento_linhas_D3 as b left join  Documento_D3 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:07 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),6 FROM  Documento_linhas_D6 as b left join  Documento_D6 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:07 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),10 FROM  Documento_linhas_D10 as b left join  Documento_D10 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:07 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),18 FROM  Documento_linhas_D18 as b left join  Documento_D18 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:07 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),20 FROM  Documento_linhas_D20 as b left join  Documento_D20 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:07 INSERT INTO tmp (codigo,ent,doc) SELECT b.codigo,sum(b.quantidade),21 FROM  Documento_linhas_D21 as b left join  Documento_D21 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:07 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),22 FROM  Documento_linhas_D22 as b left join  Documento_D22 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
20240412 17:07 INSERT INTO tmp (codigo,sai,doc) SELECT b.codigo,sum(b.quantidade),23 FROM  Documento_linhas_D23 as b left join  Documento_D23 as a ON (b.num_doc=a.no_doc and a.serdoc=b.serdoc)   WHERE a.d_doc>=20240412 AND length(b.codigo)>0 AND a.convertido=0 AND a.anulado<>'S' AND a.serdoc='2022' AND a.d_doc<=20240412 GROUP BY codigo
