Despues de mas de un año, sigo tan perdido como siempre, nunca termino de funcionar bien y ni iquiera se si vale la pena revivirlo, pero siempre me quede con las ganas de que funcione, creo que tiene un tonto error en alguna parte y yo no lo encuentro, asi que si alguien lo ve, me chifla por favor
al problema surge al apretar el boton guardar, aprarece el malefico, master record missing.
Código Delphi
[-]procedure TForm14.DBGrid2DblClick(Sender: TObject);
begin
Table2.Filtered := False;
Table2.Close;
Table7.Close;
Table2.Open;
Table7.Open;
Table7.Last;
Table7.Edit;
Table1.Open;
Table1.Last;
Table1.Edit;
c:=Table1Cod_detalleFactura.Asinteger;
c:=c+1;
if combobox1.Text = 'Productos' then
begin
datasource5.DataSet:= Table4; Table2.Insert; Table2Cod_prodser.Value:= Table4Cod_prod.Value; Table2Codigo.Value:= Table4Codigo.Value;
Table2Descripcion.Value:= Table4Descripcion.Value;
Table2Importunidad.Value:= Table4ImpVent.Value;
Table2Cantidad.Value:= StrToFloat(Edit1.Text); Table2TotalImp.Value:=Table2Cantidad.Value * Table2Importunidad.Value; Table2ID_Factura.Value:=c; Table2.Post; end;
if combobox1.Text = 'Servicios' then
begin
datasource9.DataSet:= Table8; Table2.Insert; Table2Cod_prodser.Value:= Table5Cod_servcio.Value; Table2Codigo.Value:= Table5Codigo.Value;
Table2Descripcion.Value:= Table5Servicio.Value;
Table2Cantidad.Value:= StrToFloat(Edit1.Text); Table2Importunidad.Value:= Table5ImpServ.Value;
Table2TotalImp.Value:=Table2Cantidad.Value * Table2Importunidad.Value;
Table2ID_Factura.Value:=c; Table2.Post; end;
calcula;
end;
Código Delphi
[-]procedure TForm14.BitBtn1Click(Sender: TObject);
begin
k:=0;
Table1.Open; Table1.Last;
Table2.Open; Table2.Last;
Table7.Open; Table7.Last;
Table1.Edit;
Table2.Edit;
k:=Table1.FieldByName('Cod_factura').AsInteger;
k:=k+1; if Table2.IsEmpty then Application.MessageBox('Seleccione el cliente'+ #13'Cargue los Items a Facturar'+ #13 +'Luego pulse Nueva Factura','¡ATENCION!',Mb_OK + Mb_IconWarning)
else
begin
Table2.Refresh;
with Form14.Query1 do begin
Close;
SQL.Clear;
SQL.Add('INSERT INTO detfacturafinal');
SQL.Add('SELECT * FROM detfactura');
ExecSQL;
end;
BitBtn1.Enabled := false;
SpeedButton4.Enabled:=true;
PageControl1.ActivePage := TabSheet2;
l:=Table7.FieldByName('Cod_prodser').AsInteger;
l:=l+1;
end;
end;
Código Delphi
[-]procedure TForm14.SpeedButton4Click(Sender: TObject);
begin
Table7.Edit;
Table7.Post; Table1.Edit;
Table1.Insert;
Table1.FieldByName('Cod_factura').AsInteger:=k;
Table1Cod_productserv.Value:=l;
Table1Cod_detalleFactura.Value:=c;
Table1Cod_cliente.Value:=Table8Cod_propi.Value;
Table1Fecha.Value:=Now();
Table1Descuento.Value:=StrToFloat(Edit3.Text);
Table1Incremento.Value:=StrToFloat(Edit4.Text);
Table1Total.Value:=StrToFloat(Edit5.Text);
Table1.Post;
BitBtn1.Enabled := true;
SpeedButton4.Enabled:=false;
Table7.Refresh;
Table1.Refresh;
PageControl1.ActivePage := TabSheet1;
end;
tabla detalle factura temporal IDEM detalle factura final
ID_factura
Cod_prodser
Codigo
Descripcion
Importunidad
Cantidad
TotalImp
Tabla Factura
Cod_factura
Cod_detalleFactura // ID_factura
Cod_productserv
Cod_cliente
Fecha
Descuento
Incremento
Total
si a alguien se le ocurre algo gracias