FirstPage.Enabled:=True;
LastPage.Enabled:=True;
NextPage.Enabled:=True;
PrevPage.Enabled:=True;
btnPrint.Enabled:=True;
Action2Execute(Sender);
QuickRep1.Preview;
procedure TFrmWeek.QuickRep1NeedData(Sender: TObject;
var MoreData: Boolean);
var
Flag:Integer;
begin
MoreData:=(RecNo<ADOQuery1.RecordCount);
if not ADOQuery1.Eof then
begin
QRLabel1.Caption:=VarToStr(ADOQuery1.FieldByName('ACCOU_NO').Value);
QRLabel2.Caption:=VarToStr(ADOQuery1.FieldByName('DESC1').Value);
QRLabel3.Caption:=VarToStr(ADOQuery1.FieldByName('INSP_LOT').Value);
QRLabel4.Caption:=VarToStr(ADOQuery1.FieldByName('TTL_QTY').Value);
QRLabel5.Caption:=VarToStr(ADOQuery1.FieldByName('INSP_QTY').Value);
QRLabel6.Caption:=VarToStr(ADOQuery1.FieldByName('REJ_QTY').Value);
QRLabel23.Caption:=FormatFloat('##0.00',100*StrToFloat(QRLabel6.Caption)/StrToFloat(QRLabel5.Caption));
TTLLOT:=TTLLOT+StrToIntDef(QRLabel3.Caption,0);
TTLQTY:=TTLQTY+StrToIntDef(QRLabel4.Caption,0);
INSPQTY:=INSPQTY+StrToIntDef(QRLabel5.Caption,0);
REJQTY:=REJQTY+StrToIntDef(QRLabel6.Caption,0);
end
else
Action1Execute(Sender);
with ADOQuery2do
begin
First;
while not eofdo
begin
if (VarToStr(FieldByName('ACCOU_NO').Value)=QRLabel1.Caption ) and
(VarToStr(FieldByName('DESC1').Value)=QRLabel2.Caption ) then
begin
QRLabel7.Caption:=VarToStr(FieldByName('LOT_OF_REJ').Value);
REJLOT:=REJLOT+StrToIntDef(QRLabel7.Caption,0);
QRLabel13.Caption:=FormatFloat('##0.00',100*StrToFloat(QRLabel7.Caption)/StrToFloat(QRLabel3.Caption));
Break;
end
else
begin
QRLabel7.Caption:='0';
QRLabel13.Caption:=FormatFloat('##0.00',100*StrToFloat(QRLabel7.Caption)/StrToFloat(QRLabel3.Caption));
end;
Next;
end;
end;
QRLabel24.Caption:='';
Flag:=0;
with ADOQuery3do
begin
First;
while not eofdo
begin
if StrToInt(QRLabel6.Caption)=0 then
begin
QRLabel24.Caption:='';
Break;
end;
if (VarToStr(FieldByName('ACCOU_NO').Value)=QRLabel1.Caption ) and
(VarToStr(FieldByName('DESC1').Value)=QRLabel2.Caption ) and (Flag<3) then
begin
Flag:=Flag+1;
QRLabel24.Caption:=QRLabel24.Caption+VarToStr(FieldByName('QC_DESC1').Value)+' '+VarToStr(FieldByName('REJECT_QTY').Value)+' ';
end;
Next;
end;
end;
ADOQuery1.Next;
Inc(RecNo);
end;
procedure TFrmWeek.Action2Execute(Sender: TObject);
begin
if StrToDate(dxDateEdit1.Text)>=StrToDate(dxDateEdit2.Text) then
begin
MessageBox(Application.Handle,'开始时期大于等于结束日期','注意',MB_OK+MB_ICONERROR);
Exit;
end;
with ADOQuery1do
begin
close;
SQL.Text:=' SELECT G.ACCOU_NO, T.DESC1, COUNT( H.SQC_NO ) INSP_LOT, '
+' SUM( T.QUANTITY ) TTL_QTY, SUM( H.SAMPLE_QTY ) INSP_QTY, '
+' SUM( H.REJECT_QTY ) REJ_QTY '
+' FROM SQC_HD H, GRN_HD G, PO_TRX1 T '
+' WHERE (H.GRN_NO = G.TRX_CODE) '
+' AND (H.GRN_NO = T.TRX_CODE) '
+' AND (H.GRN_LINE = T.DOCSEQ) '
+ITEM+ACCOU+DES
+' AND T.INDATE BETWEEN '+''''+SDATE+''''+' AND '+''''+EDATE+''''
+' GROUP BY G.ACCOU_NO, T.DESC1 '
+' ORDER BY T.DESC1, G.ACCOU_NO ';
open;
if RecordCount=0 then
begin
MessageBox(Handle,'没有记录',' 注意',MB_OK+MB_ICONINFORMATION);
FirstPage.Enabled:=False;
LastPage.Enabled:=False;
NextPage.Enabled:=False;
PrevPage.Enabled:=False;
btnPrint.Enabled:=False;
Exit;
end;
end;
with ADOQuery2do
begin
close;
SQL.Text:=' SELECT G.ACCOU_NO, T.DESC1, COUNT(H.SQC_NO) LOT_OF_REJ '
+' FROM SQC_HD H, GRN_HD G, PO_TRX1 T '
+' WHERE (H.GRN_NO = G.TRX_CODE) '
+' AND (H.GRN_NO = T.TRX_CODE) '
+' AND (H.GRN_LINE = T.DOCSEQ) '
+' AND T.INDATE BETWEEN '+''''+SDATE+''''+' AND '+''''+EDATE+''''
+ITEM+ACCOU+DES
+' AND (H.RESULT_CODE = '+''''+'R'+''''+') '
+' GROUP BY G.ACCOU_NO, T.DESC1'
+' ORDER BY G.ACCOU_NO, T.DESC1 ';
open;
end;
with ADOQuery3do
begin
close;
SQL.Text:=' SELECT G.ACCOU_NO,T.DESC1, SUM(L.REJECT_QTY) REJECT_QTY, '
+' L.QC_CODE, Q.QC_DESC1 '
+' FROM SQC_HD H, GRN_HD G, PO_TRX1 T, SQC_LN L '
+' LEFT OUTER JOIN QCCODE Q ON (L.QC_CODE = Q.QC_CODE) '
+' WHERE (H.GRN_NO = G.TRX_CODE) '
+' AND T.INDATE BETWEEN '+''''+SDATE+''''+' AND '+''''+EDATE+''''
+' AND (H.GRN_NO = T.TRX_CODE) '
+' AND (H.GRN_LINE = T.DOCSEQ) '
+ITEM+ACCOU+DES
+' AND (H.SQC_NO = L.SQC_NO) '
+' GROUP BY G.ACCOU_NO, T.DESC1, L.QC_CODE, Q.QC_DESC1 '
+' ORDER BY G.ACCOU_NO,T.DESC1, REJECT_QTY DESC ';
open;
end;
RecNo:=0;
TTLLOT:=0;
TTLQTY:=0;
REJLOT:=0;
REJQTY:=0;
INSPQTY:=0;
ADOQuery1.First;
end;