688 lines
18 KiB
ObjectPascal
688 lines
18 KiB
ObjectPascal
unit U_GYSFPList;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
||
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses,
|
||
cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
|
||
cxGridDBTableView, cxGrid, DBClient, cxCalendar, cxButtonEdit, cxSplitter,
|
||
RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport,
|
||
cxTextEdit, cxPC, cxCheckBox, Menus;
|
||
|
||
|
||
type
|
||
TfrmGYSFPList = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBAdd: TToolButton;
|
||
TBEdit: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBClose: TToolButton;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
TBExport: TToolButton;
|
||
Order_Main: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
RMDBMain: TRMDBDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
CDS_PRT: TClientDataSet;
|
||
ToolButton3: TToolButton;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
Panel1: TPanel;
|
||
Label2: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
Label8: TLabel;
|
||
BCOrderNo: TEdit;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
ComboBox2: TComboBox;
|
||
Label3: TLabel;
|
||
Label1: TLabel;
|
||
ToolButton1: TToolButton;
|
||
ToolButton4: TToolButton;
|
||
Label5: TLabel;
|
||
FPNO: TEdit;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
ADOQueryPrint: TADOQuery;
|
||
v1Column18: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
v1Column20: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
Label4: TLabel;
|
||
GHDanWei: TEdit;
|
||
Label6: TLabel;
|
||
FactoryName: TEdit;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column14: TcxGridDBColumn;
|
||
v1Column15: TcxGridDBColumn;
|
||
v1Column16: TcxGridDBColumn;
|
||
Label7: TLabel;
|
||
Qty: TEdit;
|
||
Label9: TLabel;
|
||
Money: TEdit;
|
||
Label10: TLabel;
|
||
HXQty: TEdit;
|
||
Label11: TLabel;
|
||
HXMoney: TEdit;
|
||
Label12: TLabel;
|
||
DHXQty: TEdit;
|
||
Label13: TLabel;
|
||
DHXMoney: TEdit;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
Button1: TButton;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure cxPageControl1Change(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure WorkerChange(Sender: TObject);
|
||
procedure v1Column15CustomDrawCell(Sender: TcxCustomGridTableView;
|
||
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
||
var ADone: Boolean);
|
||
procedure v1Column9CustomDrawCell(Sender: TcxCustomGridTableView;
|
||
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
||
var ADone: Boolean);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure BCOrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure v1Column16PropertiesEditValueChanged(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
|
||
private
|
||
FInt,PFInt:Integer;
|
||
canshu1,canshu2:string;
|
||
FNowDate:TDateTime;
|
||
procedure InitGrid();
|
||
procedure HZClear();
|
||
procedure InitForm();
|
||
function DelData():Boolean;
|
||
procedure InitGridWsql(fsj:string);
|
||
function SaveData():Boolean;
|
||
{ Private declarations }
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmGYSFPList: TfrmGYSFPList;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_RTFun,U_GYSFPInPut,U_ModuleNote, U_ZDYHelp,U_GYSFPInPutWGL;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmGYSFPList.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmGYSFPList:=nil;
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid('<27><>Ӧ<EFBFBD>̷<EFBFBD>Ʊ<EFBFBD>б<EFBFBD>',Tv1,'<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.InitGrid();
|
||
var
|
||
fsj:String;
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select AA.* from (');
|
||
sql.Add(' select A.*,DHXMoney=A.Money-isnull(A.HXMoney,0)');
|
||
sql.Add(',DHXQty=A.Qty-isnull(A.HXQty,0)');
|
||
SQL.Add(' from FP_GYSNB A');
|
||
//sql.Add(' left join JYOrder_BG B on A.BGId=B.BGId');
|
||
sql.Add(' ) AA');
|
||
sql.Add(' where isnull(FMType,'''')=''GYS'' ');
|
||
//if cxTabControl1.TabIndex<>0 then
|
||
begin
|
||
fsj:=TA(ComboBox2.Items.Objects[ComboBox2.Items.IndexOf(Trim(ComboBox2.Text))]).S;
|
||
sql.Add(' and AA.'+Trim(fsj)+'>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date))+'''');
|
||
sql.Add(' and AA.'+Trim(fsj)+'<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date+1))+'''');
|
||
end;
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,Order_Main);
|
||
SInitCDSData20(ADOQueryMain,Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.InitForm();
|
||
begin
|
||
FNowDate:=SGetServerDate(ADOQueryTemp);
|
||
EndDate.Date:=FNowDate;
|
||
BegDate.Date:=EndDate.Date-7;
|
||
ReadCxGrid('<27><>Ӧ<EFBFBD>̷<EFBFBD>Ʊ<EFBFBD>б<EFBFBD>',Tv1,'<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>');
|
||
//InitGrid();
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.TBEditClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then Exit;
|
||
|
||
{if Trim(DName)<>Trim(Order_Main.fieldbyname('Filler').AsString) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>Ϣ!','<27><>ʾ',0);
|
||
Exit;
|
||
end;}
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select HXMoney=isnull(HXMoney,0),HXQty=isnull(HXQty,0) from FP_GYSNB where FMID='''+Trim(Order_Main.fieldbyname('FMID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.FieldByName('HXMoney').Value<>0 then
|
||
begin
|
||
Application.MessageBox('<27><>Ʊ<EFBFBD>Ѻ<EFBFBD><D1BA><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ADOQueryTemp.FieldByName('HXQty').Value<>0 then
|
||
begin
|
||
Application.MessageBox('<27><>Ʊ<EFBFBD>Ѻ<EFBFBD><D1BA><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
|
||
try
|
||
frmGYSFPInPutWGL:=TfrmGYSFPInPutWGL.Create(Application);
|
||
with frmGYSFPInPutWGL do
|
||
begin
|
||
PState:=1;
|
||
FMainId:=Trim(Self.Order_Main.fieldbyname('FMID').AsString);
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSFPInPutWGL.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.TBDelClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then Exit;
|
||
if Order_Main.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(DName)<>Trim(Order_Main.fieldbyname('Filler').AsString) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>Ϣ!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
{with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select HXMoney=isnull(HXMoney,0),HXQty=isnull(HXQty,0) from FP_GYSNB where FMID='''+Trim(Order_Main.fieldbyname('FMID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.FieldByName('HXMoney').Value<>0 then
|
||
begin
|
||
Application.MessageBox('<27><>Ʊ<EFBFBD>Ѻ<EFBFBD><D1BA><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ADOQueryTemp.FieldByName('HXQty').Value<>0 then
|
||
begin
|
||
Application.MessageBox('<27><>Ʊ<EFBFBD>Ѻ<EFBFBD><D1BA><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
if DelData() then
|
||
begin
|
||
//Order_Main.Delete;
|
||
end;
|
||
end;
|
||
|
||
function TfrmGYSFPList.DelData():Boolean;
|
||
begin
|
||
try
|
||
Result:=false;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while Locate('SSel',True,[]) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete FP_GYSNB where FMId='''+Trim(Order_Main.fieldbyname('FMId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Qty.Text:='';
|
||
Money.Text:='';
|
||
Result:=True;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Order_Main.EnableControls;
|
||
Result:=False;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.TBExportClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then Exit;
|
||
TcxGridToExcel('<27><>Ӧ<EFBFBD>̷<EFBFBD>Ʊ',cxGrid1);
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
HZClear();
|
||
InitGrid();
|
||
end;
|
||
procedure TfrmGYSFPList.HZClear();
|
||
begin
|
||
Qty.Text:='';
|
||
Money.Text:='';
|
||
HXQty.Text:='';
|
||
HXMoney.Text:='';
|
||
DHXQty.Text:='';
|
||
DHXMoney.Text:='';
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.TBAddClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmGYSFPInPutWGL:=TfrmGYSFPInPutWGL.Create(Application);
|
||
with frmGYSFPInPutWGL do
|
||
begin
|
||
PState:=0;
|
||
FMainId:='';
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSFPInPutWGL.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.FormShow(Sender: TObject);
|
||
var
|
||
i:Integer;
|
||
begin
|
||
InitForm();
|
||
SInitComBoxByTvColumns(ComboBox2,Tv1,999,True,True);
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.cxPageControl1Change(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmModuleNote:=TfrmModuleNote.Create(Application);
|
||
with frmModuleNote do
|
||
begin
|
||
flag:='<27><>Ӧ<EFBFBD>̷<EFBFBD>Ʊ';
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmModuleNote.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.FormCreate(Sender: TObject);
|
||
begin
|
||
canshu1:=Trim(DParameters1);
|
||
canshu2:=Trim(DParameters2);
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.InitGridWsql(fsj:string);
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select AA.* from (');
|
||
sql.Add(' select A.*,DHXMoney=A.Money-isnull(A.HXMoney,0)');
|
||
sql.Add(',DHXQty=A.Qty-isnull(A.HXQty,0)');
|
||
SQL.Add(' from FP_GYSNB A');
|
||
sql.Add(' where isnull(A.FMType,'''')=''GYS'' ');
|
||
//sql.Add(' left join JYOrder_BG B on A.BGId=B.BGId');
|
||
sql.Add(' ) AA');
|
||
sql.Add(' where 1=1 ');
|
||
sql.Add(fsj);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,Order_Main);
|
||
SInitCDSData20(ADOQueryMain,Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
function TfrmGYSFPList.SaveData():Boolean;
|
||
var
|
||
maxno,maxSubNo:String;
|
||
begin
|
||
try
|
||
Result:=False;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if Trim(Order_Main.fieldbyname('MRID').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd,maxno,'MR','Module_Prompt_Result',4,1)=False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxno:=Trim(Order_Main.fieldbyname('MRID').AsString);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from Module_Prompt_Result where MRId='''+Trim(Order_Main.fieldbyname('MRID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(Order_Main.fieldbyname('MRID').AsString)='' then
|
||
begin
|
||
Append;
|
||
end
|
||
else begin
|
||
Edit;
|
||
end;
|
||
FieldByName('MPId').Value:=Trim(Order_Main.fieldbyname('MPId').AsString);
|
||
FieldByName('MRId').Value:=Trim(maxno);
|
||
FieldByName('MRStatus').Value:='<27>Ѵ<EFBFBD><D1B4><EFBFBD>';
|
||
FieldByName('MRDate').Value:=SGetServerDateTime(ADOQueryTemp);
|
||
if Trim(Order_Main.fieldbyname('MRId').AsString)='' then
|
||
begin
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end else
|
||
begin
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
Post;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result:=True;
|
||
except
|
||
Result:=False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
procedure TfrmGYSFPList.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.WorkerChange(Sender: TObject);
|
||
begin
|
||
HZClear();
|
||
if ADOQueryMain.Active=False then Exit;
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,Order_Main);
|
||
SInitCDSData20(ADOQueryMain,Order_Main);
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.v1Column15CustomDrawCell(
|
||
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
||
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
var
|
||
Id,Id10:Integer;
|
||
begin
|
||
Id:=TV1.GetColumnByFieldName('YuJinagDate1').Index;//
|
||
Id10:=TV1.GetColumnByFieldName('MoneyKC').Index;
|
||
if Id<0 then Exit;
|
||
//$008000FF <20>Ⱥ<EFBFBD>ɫ <20><>ɫ $000D55FF $00B9EE9F dz<><C7B3>
|
||
if AViewInfo.GridRecord.Values[Id10]>0 then
|
||
begin
|
||
if AViewInfo.GridRecord.Values[Id]-FNowDate<=0 then
|
||
begin
|
||
ACanvas.Brush.Color:=clYellow;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]=null then
|
||
begin
|
||
// ACanvas.Brush.Color:=clWhite;
|
||
end;
|
||
end else
|
||
begin
|
||
//ACanvas.Brush.Color:=clWhite;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.v1Column9CustomDrawCell(
|
||
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
||
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
var
|
||
Id,Id10:Integer;
|
||
begin
|
||
Id:=TV1.GetColumnByFieldName('YuJinagDate2').Index;//
|
||
Id10:=TV1.GetColumnByFieldName('MoneyKC').Index;
|
||
if Id<0 then Exit;
|
||
//$008000FF <20>Ⱥ<EFBFBD>ɫ <20><>ɫ $000D55FF $00B9EE9F dz<><C7B3>
|
||
if AViewInfo.GridRecord.Values[Id10]>0 then
|
||
begin
|
||
if AViewInfo.GridRecord.Values[Id]-FNowDate<=0 then
|
||
begin
|
||
ACanvas.Brush.Color:=clRed;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]=null then
|
||
begin
|
||
//ACanvas.Brush.Color:=clWhite;
|
||
end;
|
||
end else
|
||
begin
|
||
//ACanvas.Brush.Color:=clWhite;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
HZClear();
|
||
if ADOQueryMain.Active=False then Exit;
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,Order_Main);
|
||
SInitCDSData20(ADOQueryMain,Order_Main);
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.BCOrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
fsj:String;
|
||
begin
|
||
if Key<>#13 then Exit;
|
||
if Length(Trim(BCOrderNo.Text))<3 then Exit;
|
||
fsj:=' and AA.BCOrderNo like '''+'%'+Trim(BCOrderNo.Text)+'%'+'''';
|
||
InitGridWsql(fsj);
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.v1Column16PropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
mvalue:Boolean;
|
||
FQty,FMoney,FHXQty,FHXMoney,FDHXQty,FDHXMoney:Double;
|
||
FMID:String;
|
||
FXS:Integer;
|
||
begin
|
||
if Trim(Qty.Text)='' then
|
||
Qty.Text:='0';
|
||
FQty:=StrToFloat(Qty.Text);
|
||
if Trim(Money.Text)='' then
|
||
Money.Text:='0';
|
||
FMoney:=StrToFloat(Money.Text);
|
||
if Trim(HXQty.Text)='' then
|
||
HXQty.Text:='0';
|
||
FHXQty:=StrToFloat(HXQty.Text);
|
||
if Trim(HXMoney.Text)='' then
|
||
HXMoney.Text:='0';
|
||
FHXMoney:=StrToFloat(HXMoney.Text);
|
||
if Trim(DHXQty.Text)='' then
|
||
DHXQty.Text:='0';
|
||
FDHXQty:=StrToFloat(DHXQty.Text);
|
||
if Trim(DHXMoney.Text)='' then
|
||
DHXMoney.Text:='0';
|
||
FDHXMoney:=StrToFloat(DHXMoney.Text);
|
||
if Order_Main.IsEmpty then Exit;
|
||
FMID:=Trim(Order_Main.fieldbyname('FMID').AsString);
|
||
mvalue:=TcxCheckBox(Sender).EditingValue;
|
||
with Order_Main do
|
||
begin
|
||
Edit;
|
||
FieldByName('SSel').Value:=mvalue;
|
||
Post;
|
||
end;
|
||
if mvalue=True then
|
||
begin
|
||
FXS:=1;
|
||
end else
|
||
begin
|
||
FXS:=-1;
|
||
end;
|
||
if Trim(Order_Main.fieldbyname('Qty').AsString)<>'' then
|
||
FQty:=FQty+Order_Main.fieldbyname('Qty').Value*FXS;
|
||
if Trim(Order_Main.fieldbyname('Money').AsString)<>'' then
|
||
FMoney:=FMoney+Order_Main.fieldbyname('Money').Value*FXS;
|
||
if Trim(Order_Main.fieldbyname('HXQty').AsString)<>'' then
|
||
FHXQty:=FHXQty+Order_Main.fieldbyname('HXQty').Value*FXS;
|
||
if Trim(Order_Main.fieldbyname('HXMoney').AsString)<>'' then
|
||
FHXMoney:=FHXMoney+Order_Main.fieldbyname('HXMoney').Value*FXS;
|
||
if Trim(Order_Main.fieldbyname('DHXQty').AsString)<>'' then
|
||
FDHXQty:=FDHXQty+Order_Main.fieldbyname('DHXQty').Value*FXS;
|
||
if Trim(Order_Main.fieldbyname('DHXMoney').AsString)<>'' then
|
||
FDHXMoney:=FDHXMoney+Order_Main.fieldbyname('DHXMoney').Value*FXS;
|
||
Qty.Text:=FloatToStr(FQty);
|
||
Money.Text:=FloatToStr(FMoney);
|
||
HXQty.Text:=FloatToStr(FHXQty);
|
||
HXMoney.Text:=FloatToStr(FHXMoney);
|
||
DHXQty.Text:=FloatToStr(FDHXQty);
|
||
DHXMoney.Text:=FloatToStr(FDHXMoney);
|
||
// Order_Main.Locate('FMID',FMID,[]);
|
||
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(Order_Main,True);
|
||
Button1.Click;
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(Order_Main,False);
|
||
HZClear();
|
||
end;
|
||
|
||
procedure TfrmGYSFPList.Button1Click(Sender: TObject);
|
||
var
|
||
mvalue:Boolean;
|
||
FQty,FMoney,FHXQty,FHXMoney,FDHXQty,FDHXMoney:Double;
|
||
FMID:String;
|
||
FXS:Integer;
|
||
begin
|
||
HZClear();
|
||
FQty:=0;
|
||
FMoney:=0;
|
||
FHXQty:=0;
|
||
FHXMoney:=0;
|
||
FDHXQty:=0;
|
||
FDHXMoney:=0;
|
||
if Order_Main.IsEmpty then Exit;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(Order_Main.fieldbyname('Qty').AsString)<>'' then
|
||
FQty:=FQty+Order_Main.fieldbyname('Qty').Value;
|
||
if Trim(Order_Main.fieldbyname('Money').AsString)<>'' then
|
||
FMoney:=FMoney+Order_Main.fieldbyname('Money').Value;
|
||
if Trim(Order_Main.fieldbyname('HXQty').AsString)<>'' then
|
||
FHXQty:=FHXQty+Order_Main.fieldbyname('HXQty').Value;
|
||
if Trim(Order_Main.fieldbyname('HXMoney').AsString)<>'' then
|
||
FHXMoney:=FHXMoney+Order_Main.fieldbyname('HXMoney').Value;
|
||
if Trim(Order_Main.fieldbyname('DHXQty').AsString)<>'' then
|
||
FDHXQty:=FDHXQty+Order_Main.fieldbyname('DHXQty').Value;
|
||
if Trim(Order_Main.fieldbyname('DHXMoney').AsString)<>'' then
|
||
FDHXMoney:=FDHXMoney+Order_Main.fieldbyname('DHXMoney').Value;
|
||
next;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
|
||
Qty.Text:=FloatToStr(FQty);
|
||
Money.Text:=FloatToStr(FMoney);
|
||
HXQty.Text:=FloatToStr(FHXQty);
|
||
HXMoney.Text:=FloatToStr(FHXMoney);
|
||
DHXQty.Text:=FloatToStr(FDHXQty);
|
||
DHXMoney.Text:=FloatToStr(FDHXMoney);
|
||
// Order_Main.Locate('FMID',FMID,[]);
|
||
|
||
end;
|
||
|
||
end.
|