766 lines
22 KiB
ObjectPascal
766 lines
22 KiB
ObjectPascal
unit U_DyeOutputListCLMX;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, Grids, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||
cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView,
|
||
cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses,
|
||
cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls,
|
||
ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient,
|
||
cxDropDownEdit, MovePanel, cxButtonEdit, cxCalendar, RM_System, RM_Common,
|
||
RM_Class, RM_GridReport, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
||
dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu,
|
||
U_BaseHELP, cxCheckBox, Vcl.Menus, dxSkinOffice2013White, dxSkinWXI,
|
||
dxScrollbarAnnotations, Vcl.CheckLst, cxTextEdit, U_BaseList,
|
||
System.ImageList, Vcl.ImgList;
|
||
|
||
type
|
||
TfrmDyeOutputListCLMX = class(TfrmBaseHELP)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBExport: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
BegDate: TDateTimePicker;
|
||
CDS_Main: TClientDataSet;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGrid2Level1: TcxGridLevel;
|
||
cxGrid2: TcxGrid;
|
||
v2Column1: TcxGridDBColumn;
|
||
MovePanel2: TMovePanel;
|
||
RMGridReport1: TRMGridReport;
|
||
Label16: TLabel;
|
||
customerNoName: TEdit;
|
||
Label13: TLabel;
|
||
ywy: TEdit;
|
||
Label17: TLabel;
|
||
Tv1Column6: TcxGridDBColumn;
|
||
Tv1Column10: TcxGridDBColumn;
|
||
lbHx: TEdit;
|
||
Label7: TLabel;
|
||
GlideName: TComboBox;
|
||
ToolButton1: TToolButton;
|
||
Tv1Column4: TcxGridDBColumn;
|
||
Tv1Column7: TcxGridDBColumn;
|
||
Label11: TLabel;
|
||
C_Name: TEdit;
|
||
Label14: TLabel;
|
||
StaffName: TEdit;
|
||
PM_1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
N3: TMenuItem;
|
||
N4: TMenuItem;
|
||
Label1: TLabel;
|
||
C_CLwrap: TEdit;
|
||
Label15: TLabel;
|
||
Tv1Column16: TcxGridDBColumn;
|
||
Tv1Column17: TcxGridDBColumn;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
Tv1Column5: TcxGridDBColumn;
|
||
Tv1Column8: TcxGridDBColumn;
|
||
Tv1Column9: TcxGridDBColumn;
|
||
Tv1Column11: TcxGridDBColumn;
|
||
Tv1Column12: TcxGridDBColumn;
|
||
Tv1Column13: TcxGridDBColumn;
|
||
Tv1Column14: TcxGridDBColumn;
|
||
Tv1Column15: TcxGridDBColumn;
|
||
Tv1Column18: TcxGridDBColumn;
|
||
Tv1Column19: TcxGridDBColumn;
|
||
Tv1Column20: TcxGridDBColumn;
|
||
Tv1Column21: TcxGridDBColumn;
|
||
Tv1Column22: TcxGridDBColumn;
|
||
Tv1Column23: TcxGridDBColumn;
|
||
Tv1Column24: TcxGridDBColumn;
|
||
Tv1Column25: TcxGridDBColumn;
|
||
Tv1Column26: TcxGridDBColumn;
|
||
Tv1Column27: TcxGridDBColumn;
|
||
Tv1Column28: TcxGridDBColumn;
|
||
Tv1Column29: TcxGridDBColumn;
|
||
Tv1Column30: TcxGridDBColumn;
|
||
Tv1Column31: TcxGridDBColumn;
|
||
Tv1Column32: TcxGridDBColumn;
|
||
Tv1Column33: TcxGridDBColumn;
|
||
Tv1Column34: TcxGridDBColumn;
|
||
Tv1Column35: TcxGridDBColumn;
|
||
Tv1Column36: TcxGridDBColumn;
|
||
Tv1Column37: TcxGridDBColumn;
|
||
Tv1Column38: TcxGridDBColumn;
|
||
Tv1Column39: TcxGridDBColumn;
|
||
Label2: TLabel;
|
||
Label3: TLabel;
|
||
conno: TEdit;
|
||
BuyName: TEdit;
|
||
Label4: TLabel;
|
||
C_Color: TEdit;
|
||
Tv1Column40: TcxGridDBColumn;
|
||
Tv1Column41: TcxGridDBColumn;
|
||
Tv1Column42: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ConNoMChange(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
|
||
procedure PRTColorChange(Sender: TObject);
|
||
procedure TBdelClick(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure orderNoChange(Sender: TObject);
|
||
|
||
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
procedure TBPrintClick(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure N3Click(Sender: TObject);
|
||
procedure N4Click(Sender: TObject);
|
||
procedure CheckBox1Click(Sender: TObject);
|
||
procedure CheckBox2Click(Sender: TObject);
|
||
procedure Tv1Column25PropertiesEditValueChanged(Sender: TObject);
|
||
private
|
||
FLeft, FTop: Integer;
|
||
procedure InitGrid();
|
||
{ Private declarations }
|
||
public
|
||
fsyrName, canshu1: string;
|
||
FGLIDENAME, FStaffName: string;
|
||
FPairList: string;
|
||
FLocKey: string;
|
||
FLocDay: Integer;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmDyeOutputListCLMX: TfrmDyeOutputListCLMX;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp, U_LabelPrint;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmDyeOutputListCLMX.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmDyeOutputListCLMX := nil;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
|
||
BegDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
||
fsyrName := trim(DdataBase);
|
||
canshu1 := trim(DParameters1);
|
||
SInitComBoxBySql(ADOQueryTemp, GlideName, false, 'select PSName as Name from Trade_Process');
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.InitGrid();
|
||
var
|
||
Msql, mbegdate, menddate: string;
|
||
begin
|
||
Msql := '';
|
||
if SGetFilters(Panel1, 1, 2) <> '' then
|
||
Msql := Msql + ' and ' + SGetFilters(Panel1, 1, 2);
|
||
mbegdate := FormatDateTime('yyyy-MM', begdate.Date);
|
||
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
Filtered := False;
|
||
|
||
sql.Add('exec GetProductWageTable @ym=' + quotedstr(mbegdate));
|
||
sql.Add(',@GLIDENAME=' + quotedstr(fGLIDENAME));
|
||
sql.Add(',@StaffName=' + quotedstr(fStaffName));
|
||
sql.Add(',@Pairs=' + quotedstr(FPairList));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, CDS_Main);
|
||
SInitCDSData(ADOQueryMain, CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.N1Click(Sender: TObject);
|
||
begin
|
||
// inherited;
|
||
SelOKNo(CDS_Main, true);
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.N2Click(Sender: TObject);
|
||
begin
|
||
// inherited;
|
||
SelOKNo(CDS_Main, False);
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.N3Click(Sender: TObject);
|
||
var
|
||
mday, mcnt: Integer;
|
||
FFieldName, mdayField, mym, mWhere: string;
|
||
mStaff, mGlide, mName, mcrop, mColor, mcon, mbuy: string;
|
||
mprice: string;
|
||
msum: Double;
|
||
frm: TForm;
|
||
sg: TStringGrid;
|
||
lab: TLabel;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
if Tv1.Controller.FocusedColumn = nil then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>1-31<33><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(1-31<33><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>T1-T31)
|
||
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
if FFieldName = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>1-31<33><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
mdayField := FFieldName;
|
||
if (Length(mdayField) > 1) and (UpCase(mdayField[1]) = 'T') then
|
||
Delete(mdayField, 1, 1);
|
||
mday := StrToIntDef(mdayField, 0);
|
||
if (mday < 1) or (mday > 31) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>1-31<33><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if (CDS_Main.FindField(FFieldName) = nil) or CDS_Main.FieldByName(FFieldName).IsNull or (CDS_Main.FieldByName(FFieldName).AsFloat = 0) then
|
||
begin
|
||
Application.MessageBox('<27><>ǰ<EFBFBD><C7B0>Ԫ<EFBFBD><D4AA>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
mStaff := Trim(CDS_Main.FieldByName('StaffName').AsString);
|
||
mGlide := Trim(CDS_Main.FieldByName('GlideName').AsString);
|
||
mName := Trim(CDS_Main.FieldByName('C_Name').AsString);
|
||
mcrop := Trim(CDS_Main.FieldByName('crop').AsString);
|
||
mColor := Trim(CDS_Main.FieldByName('C_Color').AsString);
|
||
mcon := Trim(CDS_Main.FieldByName('conno').AsString);
|
||
mbuy := Trim(CDS_Main.FieldByName('BuyName').AsString);
|
||
mprice := Trim(CDS_Main.FieldByName('Price').AsString);
|
||
mym := FormatDateTime('yyyy-MM', begdate.Date);
|
||
|
||
mWhere := 'A.StaffName=' + quotedstr(mStaff)
|
||
+ ' and A.GlideName=' + quotedstr(mGlide)
|
||
+ ' and e.C_NAME=' + quotedstr(mName);
|
||
if mcrop <> '' then
|
||
mWhere := mWhere + ' and e.crop=' + quotedstr(mcrop)
|
||
else
|
||
mWhere := mWhere + ' and (e.crop is null or e.crop='''')';
|
||
if mColor <> '' then
|
||
mWhere := mWhere + ' and e.C_Color=' + quotedstr(mColor)
|
||
else
|
||
mWhere := mWhere + ' and (e.C_Color is null or e.C_Color='''')';
|
||
if mcon <> '' then
|
||
mWhere := mWhere + ' and f.conno=' + quotedstr(mcon)
|
||
else
|
||
mWhere := mWhere + ' and f.conno is null';
|
||
if mbuy <> '' then
|
||
mWhere := mWhere + ' and f.BuyName=' + quotedstr(mbuy)
|
||
else
|
||
mWhere := mWhere + ' and f.BuyName is null';
|
||
if mprice <> '' then
|
||
mWhere := mWhere + ' and A.Price=' + mprice
|
||
else
|
||
mWhere := mWhere + ' and A.Price is null';
|
||
|
||
try
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.PCID, A.Qty from Trade_Plan_Glide_OutPut A');
|
||
sql.Add('inner join Trade_Plan_Card e on a.pcid=e.pcid');
|
||
sql.Add('left join Bs_Contract_main f on f.conmid=e.mainid');
|
||
sql.Add('where A.GOTime >= ' + quotedstr(mym + '-01'));
|
||
sql.Add('and A.GOTime < DATEADD(MONTH,1,' + quotedstr(mym + '-01') + ')');
|
||
sql.Add('and DAY(A.GOTime)=' + IntToStr(mday));
|
||
sql.Add('and A.Valid=''Y'' ');
|
||
sql.Add('and ' + mWhere);
|
||
sql.Add('order by A.PCID');
|
||
Open;
|
||
if IsEmpty then
|
||
begin
|
||
Close;
|
||
Application.MessageBox('û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
msum := 0;
|
||
mcnt := 0;
|
||
frm := TForm.Create(Self);
|
||
sg := TStringGrid.Create(frm);
|
||
lab := TLabel.Create(frm);
|
||
try
|
||
frm.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>Դ ' + mym + '-' + FormatFloat('00', mday) + ' ' + mStaff + ' ' + mGlide + ' ' + mName;
|
||
frm.Position := poScreenCenter;
|
||
frm.Width := 480;
|
||
frm.Height := 400;
|
||
|
||
sg.Parent := frm;
|
||
sg.Align := alClient;
|
||
sg.ColCount := 2;
|
||
sg.FixedCols := 0;
|
||
sg.FixedRows := 1;
|
||
sg.RowCount := 2;
|
||
sg.Cells[0, 0] := 'PCID';
|
||
sg.Cells[1, 0] := '<27><><EFBFBD><EFBFBD>';
|
||
sg.ColWidths[0] := 300;
|
||
sg.ColWidths[1] := 100;
|
||
|
||
ADOQueryTemp.First;
|
||
while not ADOQueryTemp.Eof do
|
||
begin
|
||
Inc(mcnt);
|
||
sg.RowCount := mcnt + 1;
|
||
sg.Cells[0, mcnt] := ADOQueryTemp.FieldByName('PCID').AsString;
|
||
sg.Cells[1, mcnt] := ADOQueryTemp.FieldByName('Qty').AsString;
|
||
msum := msum + ADOQueryTemp.FieldByName('Qty').AsFloat;
|
||
ADOQueryTemp.Next;
|
||
end;
|
||
ADOQueryTemp.Close;
|
||
|
||
lab.Parent := frm;
|
||
lab.Align := alBottom;
|
||
lab.Height := 24;
|
||
lab.Caption := '<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>: ' + FormatFloat('0.##', msum) + ' <20><>¼<EFBFBD><C2BC>: ' + IntToStr(mcnt);
|
||
|
||
frm.ShowModal;
|
||
finally
|
||
frm.Free;
|
||
end;
|
||
finally
|
||
ADOQueryTemp.Close;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.N4Click(Sender: TObject);
|
||
var
|
||
mrows, mcnt: Integer;
|
||
mprice, moldprice, mym, mWhere: string;
|
||
mStaff, mGlide, mName, mcrop, mColor, mcon, mbuy: string;
|
||
mval: Double;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
mrows := 0;
|
||
CDS_Main.DisableControls;
|
||
try
|
||
CDS_Main.First;
|
||
while not CDS_Main.Eof do
|
||
begin
|
||
if CDS_Main.FieldByName('Ssel').AsBoolean then
|
||
Inc(mrows);
|
||
CDS_Main.Next;
|
||
end;
|
||
CDS_Main.First;
|
||
finally
|
||
CDS_Main.EnableControls;
|
||
end;
|
||
if mrows = 0 then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ȹ<EFBFBD>ѡҪ<D1A1><D2AA><EFBFBD>õ<EFBFBD><C3B5>۵<EFBFBD><DBB5>У<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
mprice := '';
|
||
if not InputQuery('<27><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>:', mprice) then
|
||
Exit;
|
||
mprice := Trim(mprice);
|
||
if (mprice = '') or (not TryStrToFloat(mprice, mval)) or (mval < 0) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB>ȷ<EFBFBD><C8B7>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox(PChar('ȷ<><C8B7>Ϊ<EFBFBD><CEAA>ѡ<EFBFBD><D1A1> ' + IntToStr(mrows) + ' <20><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD> ' + mprice + ' <20><><EFBFBD><EFBFBD>'),
|
||
'ȷ<><C8B7>', MB_OKCANCEL or MB_ICONQUESTION) <> IDOK then
|
||
Exit;
|
||
|
||
mym := FormatDateTime('yyyy-MM', begdate.Date);
|
||
mcnt := 0;
|
||
CDS_Main.DisableControls;
|
||
try
|
||
CDS_Main.First;
|
||
while not CDS_Main.Eof do
|
||
begin
|
||
if CDS_Main.FieldByName('Ssel').AsBoolean then
|
||
begin
|
||
mStaff := Trim(CDS_Main.FieldByName('StaffName').AsString);
|
||
mGlide := Trim(CDS_Main.FieldByName('GlideName').AsString);
|
||
mName := Trim(CDS_Main.FieldByName('C_Name').AsString);
|
||
mcrop := Trim(CDS_Main.FieldByName('crop').AsString);
|
||
mColor := Trim(CDS_Main.FieldByName('C_Color').AsString);
|
||
mcon := Trim(CDS_Main.FieldByName('conno').AsString);
|
||
mbuy := Trim(CDS_Main.FieldByName('BuyName').AsString);
|
||
moldprice := Trim(CDS_Main.FieldByName('Price').AsString);
|
||
|
||
mWhere := 'A.StaffName=' + quotedstr(mStaff)
|
||
+ ' and A.GlideName=' + quotedstr(mGlide)
|
||
+ ' and e.C_NAME=' + quotedstr(mName);
|
||
if mcrop <> '' then
|
||
mWhere := mWhere + ' and e.crop=' + quotedstr(mcrop)
|
||
else
|
||
mWhere := mWhere + ' and (e.crop is null or e.crop='''')';
|
||
if mColor <> '' then
|
||
mWhere := mWhere + ' and e.C_Color=' + quotedstr(mColor)
|
||
else
|
||
mWhere := mWhere + ' and (e.C_Color is null or e.C_Color='''')';
|
||
if mcon <> '' then
|
||
mWhere := mWhere + ' and f.conno=' + quotedstr(mcon)
|
||
else
|
||
mWhere := mWhere + ' and f.conno is null';
|
||
if mbuy <> '' then
|
||
mWhere := mWhere + ' and f.BuyName=' + quotedstr(mbuy)
|
||
else
|
||
mWhere := mWhere + ' and f.BuyName is null';
|
||
if moldprice <> '' then
|
||
mWhere := mWhere + ' and A.Price=' + moldprice
|
||
else
|
||
mWhere := mWhere + ' and A.Price is null';
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update A set A.Price=' + mprice + ',A.Money=A.Qty*' + mprice);
|
||
sql.Add('from Trade_Plan_Glide_OutPut A');
|
||
sql.Add('inner join Trade_Plan_Card e on a.pcid=e.pcid');
|
||
sql.Add('left join Bs_Contract_main f on f.conmid=e.mainid');
|
||
sql.Add('where A.GOTime >= ' + quotedstr(mym + '-01'));
|
||
sql.Add('and A.GOTime < DATEADD(MONTH,1,' + quotedstr(mym + '-01') + ')');
|
||
sql.Add('and A.Valid=''Y'' ');
|
||
sql.Add('and ' + mWhere);
|
||
ExecSQL;
|
||
if RowsAffected > 0 then
|
||
mcnt := mcnt + RowsAffected;
|
||
end;
|
||
end;
|
||
CDS_Main.Next;
|
||
end;
|
||
CDS_Main.First;
|
||
finally
|
||
CDS_Main.EnableControls;
|
||
end;
|
||
|
||
TBRafresh.Click;
|
||
Application.MessageBox(PChar('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ' + IntToStr(mcnt) + ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>'), '<27><>ʾ', MB_OKCANCEL or MB_ICONINFORMATION);
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.orderNoChange(Sender: TObject);
|
||
begin
|
||
// inherited;
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
MovePanel2.Visible := True;
|
||
MovePanel2.Refresh;
|
||
InitGrid();
|
||
MovePanel2.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(self.Caption + tv1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>1');
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.Tv1Column25PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName: string;
|
||
begin
|
||
// inherited;
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_Main do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value := Trim(mvalue);
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update Trade_Plan_Glide_OutPut ');
|
||
sql.Add('Set ' + FFieldName + '=''' + Trim(mvalue) + '''');
|
||
sql.Add('where GOID=''' + Trim(CDS_Main.fieldbyname('GOID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
begin
|
||
// inherited;
|
||
if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('DJstatus').Index] = '1' then
|
||
ACanvas.Brush.Color := clRed;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
|
||
BegDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
||
|
||
// CheckBox2.Checked := False;
|
||
InitGrid();
|
||
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.CheckBox2Click(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
// if CheckBox2.Checked then
|
||
// begin
|
||
// BegDate.DateTime := SGetServerDateTime(ADOQueryTemp) - 1;
|
||
// EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
||
// CheckBox1.Checked := False;
|
||
// InitGrid();
|
||
// end
|
||
// else
|
||
// begin
|
||
// CheckBox1.Checked := true;
|
||
// InitGrid();
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.TBCloseClick(Sender: TObject);
|
||
begin
|
||
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.FormShow(Sender: TObject);
|
||
var
|
||
mps: Integer;
|
||
ms, mg: string;
|
||
mcol: TcxGridDBColumn;
|
||
begin
|
||
inherited;
|
||
ReadCxGrid(self.Caption + tv1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>1');
|
||
|
||
// BegDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
||
|
||
initgrid();
|
||
|
||
// locate to the row/column passed from the caller (current cell)
|
||
if FLocKey <> '' then
|
||
begin
|
||
mps := Pos('|', FLocKey);
|
||
if mps > 0 then
|
||
begin
|
||
ms := Copy(FLocKey, 1, mps - 1);
|
||
mg := Copy(FLocKey, mps + 1, MaxInt);
|
||
if CDS_Main.Locate('StaffName;GlideName', VarArrayOf([ms, mg]), [loCaseInsensitive]) then
|
||
begin
|
||
if FLocDay > 0 then
|
||
begin
|
||
mcol := Tv1.GetColumnByFieldName(IntToStr(FLocDay));
|
||
if mcol <> nil then
|
||
Tv1.Controller.FocusedColumn := mcol;
|
||
end;
|
||
end;
|
||
end;
|
||
FLocKey := '';
|
||
FLocDay := 0;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
exit;
|
||
// SelExportData(tv1,ADOQueryMain,self.Caption);
|
||
TcxGridToExcel(self.Caption, cxGrid2);
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_Main);
|
||
SInitCDSData(ADOQueryMain, CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.TBPrintClick(Sender: TObject);
|
||
var
|
||
WSql: string;
|
||
begin
|
||
// inherited;
|
||
WSql := '';
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
if CDS_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Fieldbyname('Ssel').AsBoolean then
|
||
begin
|
||
if WSql <> '' then
|
||
begin
|
||
WSql := WSql + ',' + quotedstr(Trim(CDS_Main.fieldbyname('GOID').AsString));
|
||
end
|
||
else
|
||
begin
|
||
WSql := quotedstr(Trim(CDS_Main.fieldbyname('GOID').AsString));
|
||
end;
|
||
|
||
end;
|
||
Next;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
|
||
// showmessage(WSql);
|
||
|
||
try
|
||
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
||
with frmLabelPrint do
|
||
begin
|
||
FLMType := 'ClCardPrint';
|
||
FFiltration1 := WSql;
|
||
if ShowModal = 1 then
|
||
begin
|
||
// with ADOQueryCmd do
|
||
// begin
|
||
// close;
|
||
// sql.Clear;
|
||
// sql.Add('update Trade_Plan_Card SET status=''9'' ,chker=''' + trim(DName) + ''',Chktime=getdate() ');
|
||
// sql.Add(' where EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(WSql) + ','','') X where X.RTValue=Trade_Plan_Card.PCID ) ');
|
||
// execsql;
|
||
// end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmLabelPrint.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.PRTColorChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmDyeOutputListCLMX.TBdelClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
|
||
try
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Fieldbyname('Ssel').AsBoolean then
|
||
begin
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Trade_Plan_Glide_OutPut where GOID=''' + Trim(CDS_Main.fieldbyname('GOID').AsString) + '''');
|
||
|
||
ExecSQL;
|
||
end;
|
||
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('insert into Trade_Need_Up(UType,UDataId) values(''<27><>̨ˢ<CCA8><CBA2>'',' + quotedstr(Trim(CDS_Main.fieldbyname('GOID').AsString)) + ') ');
|
||
execsql;
|
||
end;
|
||
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
|
||
// CDS_Main.Delete;
|
||
except
|
||
application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
Next;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
TBRafresh.Click;
|
||
except
|
||
CDS_Main.EnableControls;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
|
||
// try
|
||
// with ADOQueryCmd do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add('delete Trade_Plan_Glide_OutPut where GOID=''' + Trim(CDS_Main.fieldbyname('GOID').AsString) + '''');
|
||
//
|
||
// ExecSQL;
|
||
// end;
|
||
//////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
|
||
// with ADOQueryCmd do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add('insert into Trade_Need_Up(UType,UDataId) values(''<27><>̨ˢ<CCA8><CBA2>'',' + quotedstr(Trim(CDS_Main.fieldbyname('GOID').AsString)) + ') ');
|
||
// execsql;
|
||
// end;
|
||
//////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
|
||
// CDS_Main.Delete;
|
||
// except
|
||
// application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
// end;
|
||
|
||
end;
|
||
|
||
end.
|
||
|