Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 20-01-2016
Camilo Camilo is offline
Miembro
 
Registrado: jun 2007
Posts: 149
Poder: 20
Camilo Va por buen camino
Gracias amigo AzidRain por el tiempo que te tomas para ayudarme.
Con este codigo Llamo algunas funciones financieras que dan error en algunas maquinas. Se activa cuando rayamos un codigo de barras.

Código Delphi [-]
procedure TFVenta.Edit1Exit(Sender: TObject);
begin
if Trim(Edit1.Text) <> '' then
  // Esta lleno
  begin
  Actualiza;
  SumaCantidad;
  Impuesto;
  SumarImp;
  Subtotal;
  end
else
  // No esta lleno
end;

Las funciones son las siguientes:

Código Delphi [-]
Procedure TFVenta.Actualiza;
begin
with DataModule1.IBQInventarios do begin
  if active then Close; //Agregué aquí
  sql.Clear; // y aquí
  SQL.Add('Select * From INVENTARIO');
  SQL.Add('Where Codigo_Producto = '+QuotedStr(Edit1.Text));
  Open;
  if not IsEmpty then begin
StringGrid1.Row := StringGrid1.Rowcount - 1;
StringGrid1.Cells[0, StringGrid1.Row]:= fieldbyname('CODIGO_PRODUCTO').AsString;
StringGrid1.Cells[1, StringGrid1.Row]:= fieldbyname('NOMBRE_PRODUCTO').AsString;
StringGrid1.Cells[2, StringGrid1.Row]:= fieldbyname('REFERENCIA_PRODUCTO').AsString;
StringGrid1.Cells[3, StringGrid1.Row]:= fieldbyname('CATEGORIA').AsString;
StringGrid1.Cells[4, StringGrid1.Row]:= '1';   //CANTIDAD
StringGrid1.Cells[5, StringGrid1.Row]:= fieldbyname('PRECIO').AsString;

  Edit1.Clear;
  Edit1.SetFocus;
  StringGrid1.RowCount := StringGrid1.RowCount + 1;
  Sumar;
  Puntos;

  end else begin
  ShowMessage('PRODUCTO NO EXISTE EN INVENTARIO');
  Edit1.Clear;

  Edit1.SetFocus;
  end;
end;
end;


Código Delphi [-]
Procedure TFVenta.SumaCantidad;
var
k, Suma: integer;
a, c, d: Extended;
begin
  d:= 0;
  a := StrToInt(StringGrid1.Cells[5, StringGrid1.Row]); // Precio
  c := StrToInt(Edit8.Text); //Cantidad
  d:=  (a*c); // Precio x Cantidad

StringGrid1.Cells[4, StringGrid1.Row]:=  Edit8.Text;  //CANTIDAD
StringGrid1.Cells[6, StringGrid1.Row]:=  FormatFloat('$ #0,.00',d);
StringGrid1.Cells[8, StringGrid1.Row]:= FloatToStr(d);

Suma := 0;
  StringGrid1.Cells[7, StringGrid1.Row]:= StringGrid1.Cells[1, StringGrid1.Row];
  for k := 0 to StringGrid1.RowCount - 1 do
    if k <= StringGrid1.RowCount - 1 then
      Suma := Suma + StrToIntdef(StringGrid1.Cells[8, k + 1], 0);
      Edit7.Text:=  FormatFloat('$ #0,.00', Suma);
      Edit5.Text:=  IntToStr(Suma);
end;

Código Delphi [-]
Procedure TFVenta.Impuesto;
begin
DataModule1.IBQInvFact.Close;
DataModule1.IBQInvFact.ParamByName('Codigo').AsString := StringGrid1.Cells[0, StringGrid1.Row];
DataModule1.IBQInvFact.Open;
end;

Código Delphi [-]
Procedure TFVenta.SumarImp;
var
 a,b,c,d,e,f,z: Extended;
 j, Suma: integer;
begin
  z:= 0;
  a:= StrToInt(DbEdit2.Text);   //Iva
  b:= StrToInt(DbEdit3.Text);   //Otro_Imp
  c:= 1+((a+b)/100); //   Suma Impuestos
  d:= StrToInt(StringGrid1.Cells[5, StringGrid1.Row])* StrToInt(StringGrid1.Cells[4, StringGrid1.Row]); // Precio
  f:= d/c;
  z:= d-f;

  if z > 0 then

StringGrid1.Cells[7, StringGrid1.Row]:=  FormatFloat('#####', z)
else
  StringGrid1.Cells[7, StringGrid1.Row]:=  ('0');
Suma := 0;
  StringGrid1.Cells[7, StringGrid1.Row];
  for j := 0 to StringGrid1.RowCount - 1 do
    if j <= StringGrid1.RowCount - 1 then
      Suma := Suma + StrToIntdef(StringGrid1.Cells[7, j + 1], 0);
      Edit2.Text:=  FormatFloat('$ #0,.00', Suma);
      Edit14.Text:=  IntToStr(Suma);
end;

Código Delphi [-]
Procedure  TFVenta.Subtotal;
var
Precio, Impuesto, Resultado: Extended;
begin
Precio:= StrToInt(Edit5.Text);
Impuesto:= StrToInt(Edit14.Text);
Resultado:= ((Precio - Impuesto));
Edit4.text:= FormatFloat('$ #0,.00', Resultado);
Edit16.Text:=  FloatToStr(Resultado);
end;

Lo de las variables me suena muy logico. solo quiero si no es molestia que revises los codigos para que me ratifiques o como tu mismo dices, no especular.
Gracias amigo y a todos los que tengan a bien opinar y aportar sobre el tema.
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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
"Not a valid floating point value" david.rguez Varios 2 12-12-2007 13:42:57
""" is not a valid floating point value con edit Petolansa Varios 6 11-12-2007 00:07:13
"floating point overflow" en campocalculado ANXO Conexión con bases de datos 0 22-01-2006 16:59:58
deadlock en unas maquinas pero no en otras ??? DobleSiete Conexión con bases de datos 6 01-06-2005 14:12:58
Unas preguntas? Waldo Conexión con bases de datos 2 01-11-2003 06:45:50


La franja horaria es GMT +2. Ahora son las 04:26:22.


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