📄 inv_checkinpohint.pas
字号:
unit Inv_CheckInPoHint;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Dialog, Grids, DBGridEh, Db, AdODB, StdCtrls, DBCtrls;
Type
TFrm_Inv_CheckInPoHint = 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_CheckInPoHint: TFrm_Inv_CheckInPoHint;
implementation
{$R *.DFM}
{ TFrm_Inv_MpsHint }
procedure TFrm_Inv_CheckInPoHint.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 Case When PoLine.PoReferencedPrice=1'
+' Then ''是'' Else Null end As ReferencedPrice,PoLine.PoLineNo'
+',PoLine.ItemCode+'' ''+Item.ItemName As ItemCodeName'
+',case when Item.iScheck=0 then ''免检'' when Item.iScheck=1 then ''必检'' else '' '' end as iScheck '
+',PoLine.PoLineDate,PoLine.PoQty,PoLine.PoRealInQty,PoLine.PoInQty'
+',PoLine.PoQty-PoLine.PoRealInQty-PoLine.PoInQty As Qty'
+',PoLine.PoRealInQty+PoLine.PoInQty As SumQty'
+',OnCheckBillLine.OnCheckQty As OnCheckQty'
+' From PoLine'
+' Join Item On PoLine.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 PoLine.ItemCode=Item.ItemCode'
+' And PoLine.PoNo=OnCheckBillLine.PoNo'
+' And PoLine.PoLineNo=OnCheckBillLine.PoLineNo'
+' And PoLine.ItemCode=OnCheckBillLine.ItemCode'
+' Where PoLine.PoNo='''+PoNo+''''
+' And PoLine.PoLineStatus=6'
+' Order By PoLine.PoLineNo';
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_CheckInPoHint.btn_okClick(Sender: TObject);
begin
inherited;
POLineNo:=AdoQry_Hint.fieldbyname('POLineNo').AsString;
Self.ModalResult:=mrOk;
end;
procedure TFrm_Inv_CheckInPoHint.DBGridEhGetCellParams(Sender: TObject;
Column: TColumnEh; AFont: TFont; var Background: TColor;
State: TGridDrawState);
begin
inherited;
if (AdoQry_Hint.fieldbyname('PoLineDate').AsDateTime>endDate)or
(AdoQry_Hint.fieldbyname('PoLineDate').AsDateTime<StArtDate)or
(Round(AdoQry_Hint.fieldbyname('PoQty').AsFloat*OverRate)<=
Round(AdoQry_Hint.fieldbyname('SumQty').AsFloat)) then
AFont.Color:=clRed;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -