571 lines
16 KiB
ObjectPascal
571 lines
16 KiB
ObjectPascal
![]() |
unit U_FinishedClothInList;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, 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, RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System,
|
|||
|
RM_GridReport, cxCheckBox, Menus, MovePanel, BtnEdit, cxPC, cxLookAndFeels,
|
|||
|
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, dxSkinsCore,
|
|||
|
dxSkinsDefaultPainters, dxSkinscxPCPainter, dxSkinBlack, dxSkinBlue,
|
|||
|
dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
|
|||
|
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle,
|
|||
|
dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary,
|
|||
|
dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin,
|
|||
|
dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
|
|||
|
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
|
|||
|
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
|
|||
|
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
|
|||
|
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin,
|
|||
|
dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
|
|||
|
dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
|
|||
|
dxSkinTheAsphaltWorld, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
|
|||
|
dxSkinXmas2008Blue;
|
|||
|
|
|||
|
type
|
|||
|
TfrmFinishedClothInList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBExport: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
Label1: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDBMain: TRMDBDataSet;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
Label10: TLabel;
|
|||
|
RKNo: TEdit;
|
|||
|
TBCKCX: TToolButton;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
MovePanel2: TMovePanel;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1Sel: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v2Column3: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
Label3: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
P_CodeName: TEdit;
|
|||
|
P_Color: TEdit;
|
|||
|
OrderNo: TEdit;
|
|||
|
JYID: TEdit;
|
|||
|
Label8: TLabel;
|
|||
|
CRType: TComboBox;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
Label12: TLabel;
|
|||
|
P_Code: TEdit;
|
|||
|
Label14: TLabel;
|
|||
|
KHName: TEdit;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
Label9: TLabel;
|
|||
|
JTType: TEdit;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
cxgrdPS: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
Panel2: TPanel;
|
|||
|
Panel3: TPanel;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
Panel6: TPanel;
|
|||
|
Label7: TLabel;
|
|||
|
LBCPAP: TLabel;
|
|||
|
BTLP: TButton;
|
|||
|
BTNP: TButton;
|
|||
|
TCBNOR: TComboBox;
|
|||
|
cxgrdMJLen: TcxGridDBColumn;
|
|||
|
Label11: TLabel;
|
|||
|
JYType: TComboBox;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
CDS_Print: TClientDataSet;
|
|||
|
RMDBPrint: TRMDBDataSet;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
Label15: TLabel;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
Label6: TLabel;
|
|||
|
JTH: TEdit;
|
|||
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
Label16: TLabel;
|
|||
|
conno: TEdit;
|
|||
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
cxStyle2: TcxStyle;
|
|||
|
Label13: TLabel;
|
|||
|
Label17: TLabel;
|
|||
|
edtkano: TEdit;
|
|||
|
carno: TEdit;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
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 N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure TBCKCXClick(Sender: TObject);
|
|||
|
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure Tv1DblClick(Sender: TObject);
|
|||
|
procedure BTLPClick(Sender: TObject);
|
|||
|
procedure BTNPClick(Sender: TObject);
|
|||
|
procedure TCBNORChange(Sender: TObject);
|
|||
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
private
|
|||
|
CurrentPage, RecordsNumber: Integer;
|
|||
|
procedure InitGrid();
|
|||
|
procedure SetStatus();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, U_ZDYHelp;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.SetStatus();
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
TBCKCX.Visible := False;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
ClearOrHideControls(Panel1, '0', True, True);
|
|||
|
ClearOrHideControls(Panel1, '1', True, False);
|
|||
|
|
|||
|
for i := 0 to tv1.ColumnCount - 1 do
|
|||
|
begin
|
|||
|
tv1.Columns[i].Visible := false;
|
|||
|
end;
|
|||
|
IsVisibleTV(Panel1, TV1, '0', True);
|
|||
|
cxgrdPS.Visible := True;
|
|||
|
cxgrdMJLen.Visible := True;
|
|||
|
v1Column8.Visible := False;
|
|||
|
v1Sel.Visible := True;
|
|||
|
v1Column13.Visible := True;
|
|||
|
Tv1Column10.Visible := True;
|
|||
|
Tv1Column4.Visible := True;
|
|||
|
end;
|
|||
|
|
|||
|
1:
|
|||
|
begin
|
|||
|
for i := 0 to tv1.ColumnCount - 1 do
|
|||
|
begin
|
|||
|
tv1.Columns[i].Visible := True;
|
|||
|
end;
|
|||
|
cxgrdPS.Visible := false;
|
|||
|
v1Column13.Visible := False;
|
|||
|
ClearOrHideControls(Panel1, '0', False, True);
|
|||
|
ClearOrHideControls(Panel1, '1', False, True);
|
|||
|
if canshu1 = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
TBCKCX.Visible := true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
//cxGrid1.Align:=alClient;
|
|||
|
BegDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|||
|
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.InitGrid();
|
|||
|
var
|
|||
|
fwhere, Pwhere: string;
|
|||
|
begin
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0: /////////////////////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//////////////////////////////
|
|||
|
begin
|
|||
|
Pwhere := SGetFilters(Panel1, 1, 2);
|
|||
|
if trim(Pwhere) <> '' then
|
|||
|
fwhere := fwhere + ' where ' + trim(Pwhere);
|
|||
|
|
|||
|
sql.Add('exec P_CPCK_Get_RKHZ ');
|
|||
|
sql.add('''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + ''' ');
|
|||
|
sql.Add(',''' + Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)) + '''');
|
|||
|
sql.Add(',' + QuotedStr(fwhere) + ' ');
|
|||
|
end;
|
|||
|
1: /////////////////////////<2F><>ϸ//////////////////////////////
|
|||
|
begin
|
|||
|
fwhere := ' where filltime>' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
|
|||
|
fwhere := fwhere + ' and filltime<=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1));
|
|||
|
|
|||
|
Pwhere := SGetFilters(Panel1, 1, 2);
|
|||
|
if trim(Pwhere) <> '' then
|
|||
|
fwhere := fwhere + ' and ' + trim(Pwhere);
|
|||
|
sql.Add('exec P_CPCK_Get_RK ');
|
|||
|
sql.Add('@pageIndex=' + inttostr(CurrentPage));
|
|||
|
sql.Add(',@pageSize=' + inttostr(RecordsNumber));
|
|||
|
sql.Add(',@criteria= ' + quotedstr(fwhere));
|
|||
|
end;
|
|||
|
end;
|
|||
|
//ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
BegDate.SetFocus;
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(Self.Caption, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.FormShow(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
RecordsNumber := 500;
|
|||
|
fsj := 'select distinct Code=Null,Name=CRType from CK_Cloth_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' order by CRType ';
|
|||
|
SInitComBoxBySql(ADOQueryTemp, CRType, False, fsj);
|
|||
|
ReadCxGrid(Self.Caption, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
exit;
|
|||
|
SelExportData(Tv1, ADOQueryMain, '');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.TBCKCXClick(Sender: TObject);
|
|||
|
var
|
|||
|
FFMainId, FPrice, FHZ, FCKOrderNo: string;
|
|||
|
begin
|
|||
|
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;
|
|||
|
// CDS_Main.DisableControls;
|
|||
|
// with CDS_Main do
|
|||
|
// begin
|
|||
|
// First;
|
|||
|
// while not Eof do
|
|||
|
// begin
|
|||
|
// if CDS_Main.FieldByName('SSel').AsBoolean = True then
|
|||
|
// begin
|
|||
|
// if FCKOrderNo = '' then
|
|||
|
// begin
|
|||
|
// FCKOrderNo := Trim(CDS_Main.fieldbyname('CKOrdNo').AsString);
|
|||
|
// with ADOQueryTemp do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('select * from YF_Money_CR_Sub where yfpzno=''' + Trim(CDS_Main.fieldbyname('CKOrdNo').AsString) + '''');
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// if ADOQueryTemp.IsEmpty = False then
|
|||
|
// begin
|
|||
|
// CDS_Main.EnableControls;
|
|||
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>տ<D5BF><EEA3AC><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// Next;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// CDS_Main.EnableControls;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
|
|||
|
MovePanel2.Visible := True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while CDS_Main.Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_Cloth_CR where JYID=''' + Trim(CDS_Main.fieldbyname('JYID').AsString) + '''');
|
|||
|
sql.Add('and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.RecordCount >= 1 then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
MovePanel2.Visible := False;
|
|||
|
Application.MessageBox('<27>ѳ<EFBFBD><D1B3>ⲻ<EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('EXEC P_CPCK_UP_RKRE @JYID=' + quotedstr(trim(CDS_Main.fieldbyname('JYID').asstring)));
|
|||
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
sql.Add(',getdate() ');
|
|||
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><E2B3B7>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('CKNo').AsString) + ' <20><><EFBFBD>룺' + trim(CDS_Main.FieldByName('JYID').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
MovePanel2.Visible := False;
|
|||
|
Exit;
|
|||
|
except
|
|||
|
MovePanel2.Visible := False;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.OrderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
// SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.ToolButton2Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath, CNSql, FNSql, BNSql, CTSql: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
|
|||
|
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;
|
|||
|
CNSql := '';
|
|||
|
BNSql := '';
|
|||
|
FNSql := '';
|
|||
|
CTSql := '';
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while CDS_Main.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
if CNSql <> '' then
|
|||
|
CNSql := CNSql + '' + ',' + '' + QuotedStr(Trim(CDS_Main.fieldbyname('P_CodeName').AsString))
|
|||
|
else
|
|||
|
CNSql := 'and A.P_CodeName in (' + QuotedStr(Trim(CDS_Main.fieldbyname('P_CodeName').AsString));
|
|||
|
|
|||
|
if FNSql <> '' then
|
|||
|
FNSql := FNSql + '' + ',' + '' + QuotedStr(Trim(CDS_Main.fieldbyname('P_Code').AsString))
|
|||
|
else
|
|||
|
FNSql := 'and A.P_Code in (' + QuotedStr(Trim(CDS_Main.fieldbyname('P_Code').AsString));
|
|||
|
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value := False;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
CNSql := CNSql + ')';
|
|||
|
FNSql := FNSql + ')';
|
|||
|
BNSql := BNSql + ')';
|
|||
|
CTSql := CTSql + ')';
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' select AA.*,C.P_CodeName,C.P_Code from(select A.MainId,A.SubId,A.CRType,COUNT(A.JYID) PS ,SUM(A.JYLen) JYLen ');
|
|||
|
sql.Add(' from CK_Cloth_CR A where A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.add(' and A.CRTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''');
|
|||
|
sql.Add(' and A.CRTime<''' + Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)) + '''');
|
|||
|
SQL.Add(CNSql);
|
|||
|
SQL.Add(FNSql);
|
|||
|
SQL.Add(' GROUP BY A.MainId,A.SubId,A.CRType )AA ');
|
|||
|
SQL.Add(' inner join PD_Plan_Sub C on AA.SubId=C.SubId ');
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryCmd, CDS_Print);
|
|||
|
SInitCDSData20(ADOQueryCmd, CDS_Print);
|
|||
|
|
|||
|
if ADOQueryCmd.IsEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
ExportFtErpFile('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⱨ<EFBFBD><E2B1A8>.rmf', ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⱨ<EFBFBD><E2B1A8>.rmf';
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
// RM1.PrintReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.Tv1DblClick(Sender: TObject);
|
|||
|
var
|
|||
|
Tabint: integer;
|
|||
|
begin
|
|||
|
Tabint := cxTabControl1.TabIndex;
|
|||
|
case Tabint of
|
|||
|
0:
|
|||
|
begin
|
|||
|
AssignmentControls(Panel1, CDS_Main, '0');
|
|||
|
cxTabControl1.TabIndex := 1;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.BTLPClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage > 1 then
|
|||
|
CurrentPage := CurrentPage - 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.BTNPClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage < CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
|
|||
|
CurrentPage := CurrentPage + 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.TCBNORChange(Sender: TObject);
|
|||
|
begin
|
|||
|
RecordsNumber := StrToInt(TCBNOR.Text);
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInList.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
1:
|
|||
|
begin
|
|||
|
if (AViewInfo.GridRecord.Values[v1Column7.Index] = '<27><>Ʒ') then
|
|||
|
begin
|
|||
|
ACanvas.Brush.Color := $008080FF
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|