📄 inv_checkinmohint.pas
字号:
unit Inv_CheckInMoHint;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Dialog, Grids, DBGridEh, Db, AdODB, StdCtrls, DBCtrls;
Type
TFrm_Inv_CheckInMoHint = Class(TFrm_Base_Dialog)
DBGridEh: TDBGridEh;
Label1: TLabel;
Lbl_PoNo1: TLabel;
AdoQry_Hint: TAdoQuery;
DS_Hint: TDataSource;
Label2: TLabel;
DBText1: TDBText;
procedure btn_okClick(Sender: TObject);
procedure DBGridEhGetCellParams(Sender: TObject; Column: TColumnEh;
AFont: TFont; var Background: TColor; State: TGridDrawState);
private
{ Private declarations }
StArtDate,endDate:TDateTime;
OverRate:Double;
public
{ Public declarations }
POLineNo:String;
procedure InitForm(AdOConnection:TAdOConnection;PoNo,POLineNo:String;
StArtDate,endDate:TDateTime;OverRate:Double);virtual;
end;
var
Frm_Inv_CheckInMoHint: TFrm_Inv_CheckInMoHint;
implementation
{$R *.DFM}
{ TFrm_Inv_MpsHint }
procedure TFrm_Inv_CheckInMoHint.InitForm(AdOConnection: TAdOConnection;
PoNo,POLineNo: String;StArtDate,endDate:TDateTime;OverRate:Double);
begin
Lbl_PoNo1.Caption:=PoNo;
SetDBConnect(AdOConnection);
AdoQry_Hint.Connection:=AdOConnection;
AdoQry_Hint.Close;
AdoQry_Hint.SQL.Text:='Select MoLine.MoLineNo as POLineNo'
+',MoLine.ItemCode+'' ''+Item.ItemName As ItemCodeName'
+',case when Item.iScheck=0 then ''免检'' when Item.iScheck=1 then ''必检'' else '' '' end as iScheck '
+',MoLine.MoLineDate,MoLine.moQty,MoLine.MoOnCheckQty'
+',MoLine.MoNoFinishQty-MoLine.MoOnCheckQty As Qty'
+',MoLine.MoRealInQty+MoLine.MoOnCheckQty As SumQty'
+',OnCheckBillLine.OnCheckQty As OnCheckQty'
+' From MoLine'
+' Join Item On MoLine.ItemCode=Item.ItemCode'
+' Left Join ('
+' Select Sum(OnCheckBillLine.OnCheckQty) As OnCheckQty'
+',OnCheckBillLine.ItemCode'
+',OnCheckBill.PoNo'
+',OnCheckBillLine.PoLineNo'
+' From OnCheckBillLine'
+' Join OnCheckBill On OnCheckBillLine.OnCheckBillId=OnCheckBill.OnCheckBillId'
+' Where OnCheckBill.PoNo='''+PoNo+''''
+' And OnCheckBillLine.OnCheckStatus=0'
+' And OnCheckBillLine.QcStatus<>0'
+' And OnCheckBillLine.QcStatus<>2'
+' Group By OnCheckBill.PoNo,OnCheckBillLine.PoLineNo,OnCheckBillLine.ItemCode'
+') OnCheckBillLine On MoLine.ItemCode=Item.ItemCode'
+' And MoLine.moNo=OnCheckBillLine.PoNo'
+' And MoLine.MoLineNo=OnCheckBillLine.PoLineNo'
+' And MoLine.ItemCode=OnCheckBillLine.ItemCode'
+' Where MoLine.moNo='''+PoNo+''''
+' and MoLine.MoNoFinishQty-MoLine.MoOnCheckQty >0 '
+' And MoLine.MoLineStatus=6'
+' Order By MoLine.MoLineNo';
AdoQry_Hint.Open;
if POLineNo<>'' then
AdoQry_Hint.Locate('POLineNo',POLineNo,[loPArtialKey]);
Self.StArtDate:=StArtDate;
Self.endDate:=endDate;
Self.OverRate:=OverRate;
end;
procedure TFrm_Inv_CheckInMoHint.btn_okClick(Sender: TObject);
begin
inherited;
POLineNo:=AdoQry_Hint.fieldbyname('POLineNo').AsString;
Self.ModalResult:=mrOk;
end;
procedure TFrm_Inv_CheckInMoHint.DBGridEhGetCellParams(Sender: TObject;
Column: TColumnEh; AFont: TFont; var Background: TColor;
State: TGridDrawState);
begin
inherited;
if (AdoQry_Hint.fieldbyname('MoLineDate').AsDateTime>endDate)or
(AdoQry_Hint.fieldbyname('MoLineDate').AsDateTime<StArtDate)or
(Round(AdoQry_Hint.fieldbyname('moQty').AsFloat*OverRate)<=
Round(AdoQry_Hint.fieldbyname('SumQty').AsFloat)) then
AFont.Color:=clRed;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -