Hola a todos, estoy realizando un QReport y necesite agregar un nuevo procedimiento y no se k estoy haciendo mal pero me saca un error de 'Acces Violation at adress 005313EE in module ...'
Adjunto el codigo que eh ingresado y agradezco la ayuda k me puedan brindar.
Código:
unit UInfManualET;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, QuickRpt, QRCtrls, Jpeg, Menus, QRExport, StdCtrls;
type
TInfManualET = class(TForm)
QRManualET: TQuickRep;
SUBDetalleDefectos: TQRSubDetail;
QRWMFFilter1: TQRWMFFilter;
PopupMenu1: TPopupMenu;
...............................
blanco5: TQRLabel;
blanco6: TQRLabel;
cantotempaque: TQRLabel;
QRLblUnidad: TQRLabel;
procedure QRBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
procedure SubDetalleEmpaquesBeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
InfManualET: TInfManualET;
contpartes, contador, contador1:word;
imgensamble, imgpartes, imgempaque, imgestiba, nueva1, nueva2, nueva3, nueva4, cliente:string;
implementation
uses UDMinformes, UDMsip1, UDMsip, UInfManualSSD;
{$R *.DFM}
Procedure MueveTitulo; ForWard;
procedure TInfManualET.QRBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
QRLblParte1.Caption:='';
QRLblParte2.Caption:='';
QRLblParte3.Caption:='';
QRLblRef1.Caption:='';
QRLblRef2.Caption:='';
QRLblRef3.Caption:='';
contpartes:=0;
DmInformes.QPartes.Open;
DmInformes.QPartes.params[0].AsString:=DmInformes.QFichaProducto['referencia'];
DmInformes.QPartes.close;
DmInformes.Qpartes.Open;
DmSip1.TblEnsamble.open;
DmSip1.TblOrdenEnsam.Open;
Dmsip1.TblOrdenTrabajo.open;
DmSip.Tblproductos.open;
with DmInformes do
begin
if DmInformes.Qpartes['IMPRESION']='N' then
begin
contpartes:=contpartes+1;
case contpartes of
1: begin
QRLblParte1.Caption:=DmInformes.Qpartes['referencia_1'];
QRLblRef1.caption:=DmInformes.Qpartes['descripcion_pdto'];
end;
2: begin
QRLblParte2.Caption:=DmInformes.Qpartes['referencia_1'];
QRLblRef2.caption:=DmInformes.Qpartes['descripcion_pdto'];
end;
3: begin
QRLblParte3.Caption:=DmInformes.Qpartes['referencia_1'];
QRLblRef3.caption:=DmInformes.Qpartes['descripcion_pdto'];
end;
end;
DmInformes.QPartes.Next;
end;
imgensamble :='E:\sip\datos\productos\'+QFichaProducto['referencia']+'.jpg';
imgpartes :='E:\sip\datos\partes\'+QFichaProducto['referencia']+'.jpg';
imgempaque:='E:\sip\datos\empaques\'+QFichaProducto['referencia']+'.jpg';
imgestiba:='E:\sip\datos\estiba\'+QFichaProducto['referencia']+'.jpg';
try
QRImage1.Picture.LoadFromFile(imgensamble);
QRImage2.Picture.LoadFromFile(imgpartes);
QRImage3.Picture.LoadFromFile(imgempaque);
QRImage4.Picture.LoadFromFile(imgestiba);
except
begin
QRImage1.picture:=nil;
QRImage2.picture:=nil;
QRImage3.picture:=nil;
QRImage4.picture:=nil;
end;
end;
end;
end;
procedure TInfManualET.SubDetalleEmpaquesBeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
contador := 0;
with DmInformes do
begin
DmSip.TblEmpaquet.open;
QLeeEmpaqueProducto.params[0].AsString := QFichaProducto['referencia'];
QLeeEmpaqueProducto.params[1].AsString := cliente;
QLeeEmpaqueProducto.close;
QLeeEmpaqueProducto.open;
QLeeProductoDefecto.open; //esto es una tbl
cantotempaque.caption := '';
contador1 := 1;
if (QLeeEmpaqueProducto['cantidadotros4'] = 0) or (QLeeEmpaqueProducto['cantidadotros4'] = null) then
else
cantotempaque.caption := FormatFloat('###,###',QLeeEmpaqueProducto['cantidadotros4']);
if (QLeeEmpaqueProducto['cantidadotros3'] = 0) or (QLeeEmpaqueProducto['cantidadotros3'] = null) then
else
cantotempaque.caption := FormatFloat('###,###',QLeeEmpaqueProducto['cantidadotros3']);
if (QLeeEmpaqueProducto['cantidadotros2'] = 0) or (QLeeEmpaqueProducto['cantidadotros2'] = null) then
else
cantotempaque.caption := FormatFloat('###,###',QLeeEmpaqueProducto['cantidadotros2']);
if (QLeeEmpaqueProducto['cantidadotros1'] = 0) or (QLeeEmpaqueProducto['cantidadotros1'] = null) then
else
cantotempaque.caption := FormatFloat('###,###',QLeeEmpaqueProducto['cantidadotros1']);
if (QLeeEmpaqueProducto['cantidadbolsa'] = 0) or (QLeeEmpaqueProducto['cantidadbolsa'] = null) then
else
cantotempaque.caption := FormatFloat('###,###',QLeeEmpaqueProducto['cantidadbolsa']);
if (QLeeEmpaqueProducto['cantidad'] = 0) or (QLeeEmpaqueProducto['cantidad'] = null) then
else
cantotempaque.caption := FormatFloat('###,###',QLeeEmpaqueProducto['cantidad']);
end;
with DmSip do
begin
empaque1.caption := '';
empaque2.caption := '';
empaque3.caption := '';
empaque4.caption := '';
empaque5.caption := '';
empaque6.caption := '';
blanco1.caption := '';
blanco2.caption := '';
blanco3.caption := '';
blanco4.caption := '';
blanco5.caption := '';
blanco6.caption := '';
TblEmpaqueT.open;
nueva1:=cliente;
nueva2:=tblempaquet['referencia'];
nueva3:= DmInformes.QLeeEmpaqueProducto['caja'];
nueva4:=DmInformes.QLeeEmpaqueProducto['bolsa'];
if TblEmpaquet.locate('referencia', DmInformes.QLeeEmpaqueProducto['caja'],[]) then
begin
contador := contador + 1;
MueveTitulo;
end;
if TblEmpaquet.locate('referencia', DmInformes.QLeeEmpaqueProducto['bolsa'],[]) then
begin
contador := contador + 1;
MueveTitulo;
end;
if TblEmpaquet.locate('referencia', DmInformes.QLeeEmpaqueProducto['otros1'],[]) then
begin
contador := contador + 1;
MueveTitulo;
end;
if TblEmpaquet.locate('referencia', DmInformes.QLeeEmpaqueProducto['otros2'],[]) then
begin
contador := contador + 1;
MueveTitulo;
end;
if TblEmpaquet.locate('referencia', DmInformes.QLeeEmpaqueProducto['otros3'],[]) then
begin
contador := contador + 1;
MueveTitulo;
end;
if TblEmpaquet.locate('referencia', DmInformes.QLeeEmpaqueProducto['otros4'],[]) then
begin
contador := contador + 1;
MueveTitulo;
end;
dminformes.p.next;
cliente:=dminformes.p['cliente'];
end;
end;
procedure MueveTitulo;
begin
if contador = 1 then
InfManualSSD.empaque1.caption := ' '+DmSip.TblEmpaquet['descripcion'];
if contador = 2 then
InfManualSSD.empaque2.caption := ' '+DmSip.TblEmpaquet['descripcion'];
if contador = 3 then
InfManualSSD.empaque3.caption := ' '+DmSip.TblEmpaquet['descripcion'];
if contador = 4 then
InfManualSSD.empaque4.caption := ' '+DmSip.TblEmpaquet['descripcion'];
if contador = 5 then
InfManualSSD.empaque5.caption := ' '+DmSip.TblEmpaquet['descripcion'];
if contador = 6 then
InfManualSSD.empaque6.caption := ' '+DmSip.TblEmpaquet['descripcion'];
end;
end.