Fórum bloquear cliente altomatico com debito em atrazo #464803

23/12/2013

0

tenho a tela de venda, o vendedor vai selecionar o cliente para fazer a venda.....ai se o cliente estiver bloqueado, vai aparecer a mensagem cliente bloqueado e pedira senha do gerente so podera vender com autorizaçao do gerente, como faço isso gostaria de uma ajuda se possivel a rotina
Maxwell Vieira

Maxwell Vieira

Responder

Posts

24/12/2013

Perivaldo Martins

Caro colega Max, na sua tabela de clientes, deve haver um campo que será o responsável por identificar se esse cliente está bloqueado ou não, algo como por exemplo status, no qual vc poderá usar números tipo 0 = livre e 1 = bloqueado, só uma ideia, sendo assim, sempre que seu sistema abrir ele irá fazer uma checagem nos clientes em atraso.

Ex:
IDCliente: 0123
...
Data da compra: 05/12/2013
Data Pagto: 05/01/2014
Situação: A (Aberto)   P (Pago)
...
//Aqui você exibe os clientes em atraso
Select IDCliente, DtPagto, Situacao from Vendas where (DtPagto < Date) and ( Situacao = "A")
...
//Bloqueia todos os que estiverem em atraso
Update Clientes Set Status=1
Where IDCliente in (Select IDCliente from Vendas where (DtPagto < Date) and ( Situacao = "A"))

//
Com o um campo preenchido vc poderá usar instruções condicionais para fazer o que deseja.


Esse é um direcionamento, tente desenvolver, se encontrar dificuldades, retorne e tentaremos ajudá-lo, será bem melhor do que lhe oferecer a rotina pronta.


Boa sorte e bons códigos!
Responder

Gostei + 0

24/12/2013

Maxwell Vieira

Companheiro MARTINS o problema é o seguinte quando eu abro um cliente que ja tem uma compra ae abre normal consigo adicionar produto, mais se for uma nova compra da esse erro is not a valid floating point value[img]http://arquivo.devmedia.com.br/forum/imagem/337170-20131224-194649.png[/img][img]http://arquivo.devmedia.com.br/forum/imagem/337170-20131224-194734.png[/img]

ESSE É O CODIGO

procedure TFPlanilha2.BitBtn1Click(Sender: TObject);
var totalreg,x:integer;
begin

//begin key 13
// IBQProdutos.open;
if editem.text='18' then
begin
showmessage('Somente 17 itens por Pesquisa...');
exit;
end;

if item>17 then
begin
showmessage('Somente 17 itens por Pesquisa...');
exit;
end;


edprod.Text:=ednome_prod.text ;
Vunid :=edunid.text ;
if vunid='' then vunid:='UN';
Ssaldoest :='0';
if ssaldoest='' then ssaldoest:='0';
vsaldoest:=strtofloat(ssaldoest);

vpreco_vend:=strtofloat(edprvenda.text) ;

vquant:=strtofloat(edquant.text);
Vtotalprod:=vquant*vpreco_vend;
vlatual:=vlatual+Vtotalprod;


prd1:=formatfloat('##,##0.00',vlatual);
while Length(PRD1) < 9 do PRD1 := ' '+ PRD1; { acrescenta zeros ao código }
ltotal.caption:=PRD1;




edfator.Text:=floattostr(nfator);
// Vendpro1 begin
Prd1:=floattostr(item);
while Length(PRD1) < 3 do PRD1 := '0'+ PRD1; { acrescenta zeros ao código }
editem.TEXT:=PRD1;
nitem:= editem.TEXT;
somane:=edpesquisa.text+edfator.text+edcodigo.text;
IBQMov_Planilha.Close;
IBQMov_Planilha.SQL.clear;
IBQMov_Planilha.SQL.Add('SELECT * FROM Mov_Planilha WHERE regprod='+CHAR(39)+somane+CHAR(39));
IBQMov_Planilha.open;
if IBQMov_Planilha.FieldByName('regprod').Asstring = somane then
begin
IBQMov_Planilha.Edit;
end
else
begin
IBQMov_Planilha.Cancel;
IBQMov_Planilha.Append;
IBQMov_Planilha.FieldByName('regprod').Asstring := somane;
end;

IBQMov_Planilha.FieldByName('Pesquisa').Asstring := edpesquisa.text;
IBQMov_Planilha.FieldByName('Pagina').Asstring :=edpagina.text;
IBQMov_Planilha.FieldByName('Cod_produto').Asstring := edcodigo.text;
IBQMov_Planilha.FieldByName('Produto').Asstring := edprod.text;
IBQMov_Planilha.FieldByName('Unid').Asstring := Vunid;
IBQMov_Planilha.FieldByName('Quant').Asstring := edquant.text;
IBQMov_Planilha.FieldByName('PrUnitario').Value := vpreco_vend;
IBQMov_Planilha.FieldByName('PrTotal').Value := vtotalprod;
IBQMov_Planilha.FieldByName('Cod_Uex').Asstring := edcoduex.text;
IBQMov_Planilha.FieldByName('Item').Asstring := Nitem;
IBQMov_Planilha.FieldByName('fator').Value := NFator;

IBQMov_Planilha.Post;
IBQMov_Planilha.ApplyUpdates;
IBQMov_Planilha.Transaction.CommitRetaining;


// Mov_Planilha end

// atualizar vendpro begin
IBQMov_Planilha.Close;
IBQMov_Planilha.SQL.clear;
IBQMov_Planilha.SQL.Add('SELECT * FROM Mov_Planilha WHERE pesquisa='+CHAR(39)+edpesquisa.text+CHAR(39));
IBQMov_Planilha.Open;

IBQMov_Planilha.last;
totalreg:=IbqMov_Planilha.RecordCount;
IBQMov_Planilha.first;
vltotal:=0;
FOR X:=1 TO totalreg DO
BEGIN
IBQMov_Planilha.edit;
vltotal:=vltotal+((ibqMov_Planilhaprtotal.value));
item:=x;
Prd1:=inttostr(x);
while Length(PRD1) < 3 do PRD1 := '0'+ PRD1; { acrescenta zeros ao código }
editem.TEXT:=PRD1;
xitem:=editem.text;

IBQMov_Planilha.FieldByName('Item').Asstring := xitem;
IBQMov_Planilha.Post;
IBQMov_Planilha.ApplyUpdates;
IBQMov_Planilha.Transaction.CommitRetaining;
IBQMov_Planilha.next;
end;
prd1:=formatfloat('##,##0.00',vltotal);
while Length(PRD1) < 9 do PRD1 := ' '+ PRD1; { acrescenta zeros ao código }
ltotal.caption:=PRD1;
totalne:=vltotal;
nfator:=nfator+1;
item:=item+1;
editem.Text:=floattostr(item);
// atualizar vendpro end
vlatual:=0;

vtdesc:=strtofloat(eddesconto.Text);
vtacrec:=strtofloat(edacrescimo.Text);
vliquido:=(totalne-vtdesc)+vtacrec;
edliquido.Text:=formatfloat('0.00',vliquido);
edliquido.setfocus;

//aqui o erro de forma maxwell XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

// edliquido.text:=formatfloat('0.00',vltotal);

edvalor.text:=formatfloat('0.00',vtotalprod);



edquant.Text:='1';
edcodigo.Text:='';
edprod.Text:='';
edvalor.Text:='';

ednome_prod.Text:='';
edunid.Text:='';
edprvenda.Text:='';
panel5.visible:=false;


edquant.setfocus;
//end key 13
end;

procedure TFPlanilha2.BitBtn8Click(Sender: TObject);
begin
ednome_prod.Text:='';
edunid.Text:='';
edprvenda.Text:='';
ednome_prod.SetFocus ;
end;

procedure TFPlanilha2.BitBtn7Click(Sender: TObject);
begin
ednome_prod.Text:='';
edunid.Text:='';
edprvenda.Text:='';
panel5.visible:=false;
end;

procedure TFPlanilha2.edprvendaKeyPress(Sender: TObject; var Key: Char);
begin
IF Key = #13 Then
begin
edprvenda.text:=formatfloat('0.00',(strtofloat(edprvenda.text)));
bitbtn1.setfocus;
end;
end;

procedure TFPlanilha2.FormCreate(Sender: TObject);
begin

end;

end.
Responder

Gostei + 0

02/01/2014

Perivaldo Martins

Companheiro, estou vendo seu código, mas seria melhor se vc conseguisse depurá-lo, assim vc poderia informar em qual linha está realmente dando erro. Porque existem alguns conversões do tipo String para Float, então tente depurar.

Se tiver dificuldade em depurar, nos informe.

Boa sorte e bons códigos!
Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar