865 lines
26 KiB
ObjectPascal
865 lines
26 KiB
ObjectPascal
unit U_PBOuGLtList;
|
||
|
||
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, cxLookAndFeels,
|
||
cxLookAndFeelPainters, cxNavigator, dxSkinsCore, 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, dxSkinsDefaultPainters,
|
||
dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue,
|
||
dxSkinscxPCPainter, dxBarBuiltInMenu, cxPC;
|
||
|
||
type
|
||
TfrmPBOuGLtList = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: 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;
|
||
Label7: TLabel;
|
||
CDS_Print: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
RMDBMain: TRMDBDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
Label10: TLabel;
|
||
CkOrdNo: TEdit;
|
||
RMDBHZ: TRMDBDataSet;
|
||
CDS_HZ: TClientDataSet;
|
||
TBCKCX: TToolButton;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
MovePanel2: TMovePanel;
|
||
CDS_CX: TClientDataSet;
|
||
cxGrid2: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Sel: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
v2Column3: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v2Column5: TcxGridDBColumn;
|
||
cxGrid2Level1: TcxGridLevel;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
Label6: TLabel;
|
||
C_CodeName: TEdit;
|
||
C_Color: TEdit;
|
||
ConNo: TEdit;
|
||
MJID: TEdit;
|
||
Label8: TLabel;
|
||
CRType: TComboBox;
|
||
CDS_DH: TClientDataSet;
|
||
ADOQueryDH: TADOQuery;
|
||
ADOQueryPrint: TADOQuery;
|
||
Label11: TLabel;
|
||
ZZCarNo: TEdit;
|
||
CPType: TEdit;
|
||
v1Column4: TcxGridDBColumn;
|
||
Label12: TLabel;
|
||
C_Code: TEdit;
|
||
v1Column14: TcxGridDBColumn;
|
||
Label14: TLabel;
|
||
KHName1: TEdit;
|
||
CDS_Juan: TClientDataSet;
|
||
CDS_JuanPRT: TClientDataSet;
|
||
RMDBMX: TRMDBDataSet;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
cxgrdbclmnv1Column12: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
ToolButton1: TToolButton;
|
||
edtCarNo: TEdit;
|
||
Label9: TLabel;
|
||
CarNo: TEdit;
|
||
v1Column13: TcxGridDBColumn;
|
||
ComboBox1: TComboBox;
|
||
ToolButton2: TToolButton;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
ToolButton3: TToolButton;
|
||
Panel2: TPanel;
|
||
Panel3: TPanel;
|
||
cxTabControl1: TcxTabControl;
|
||
Panel6: TPanel;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
ToolButton4: TToolButton;
|
||
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 MPRTCodeNameChange(Sender: TObject);
|
||
procedure orderNoChange(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure TBCKCXClick(Sender: TObject);
|
||
procedure C_CodeNameChange(Sender: TObject);
|
||
procedure ConNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure CheJianChange(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure Tv1DblClick(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
private
|
||
procedure InitGrid();
|
||
procedure SETSTATUS();
|
||
{ Private declarations }
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmPBOuGLtList: TfrmPBOuGLtList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, U_ZDYHelp, U_KHList;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmPBOuGLtList.SetStatus();
|
||
var
|
||
i: Integer;
|
||
begin
|
||
|
||
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);
|
||
v2Column5.Visible := True;
|
||
Tv1Column1.Visible := True;
|
||
v1Column2.Visible := True;
|
||
v1Column7.Visible := True;
|
||
v1Column8.Visible := True;
|
||
v1Column1.Visible := True;
|
||
Tv1Column2.Visible := True;
|
||
TBCKCX.Enabled := FALSE;
|
||
end;
|
||
|
||
1:
|
||
begin
|
||
for i := 0 to tv1.ColumnCount - 1 do
|
||
begin
|
||
tv1.Columns[i].Visible := True;
|
||
end;
|
||
TBCKCX.Enabled := True;
|
||
ClearOrHideControls(Panel1, '0', False, True);
|
||
ClearOrHideControls(Panel1, '1', False, True);
|
||
Tv1Column1.Visible := false;
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmPBOuGLtList := nil;
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.FormCreate(Sender: TObject);
|
||
begin
|
||
//cxGrid1.Align:=alClient;
|
||
BegDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
||
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp)
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.InitGrid();
|
||
var
|
||
fwhere, Pwhere: string;
|
||
begin
|
||
MovePanel2.Left := (self.Width - MovePanel2.Width) div 2;
|
||
MovePanel2.Visible := True;
|
||
MovePanel2.Refresh;
|
||
Pwhere := SGetFilters(Panel1, 1, 2);
|
||
// if IsJYTime.Checked then
|
||
// begin
|
||
// fwhere := ' where CRTime>' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
|
||
// fwhere := fwhere + ' and CRTime<=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1));
|
||
// if trim(Pwhere) <> '' then
|
||
// fwhere := fwhere + ' and ' + trim(Pwhere);
|
||
// end
|
||
// else
|
||
|
||
|
||
begin
|
||
if trim(Pwhere) <> '' then
|
||
fwhere := fwhere + ' and ' + trim(Pwhere);
|
||
end;
|
||
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
|
||
case cxTabControl1.TabIndex of
|
||
0: /////////////////////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//////////////////////////////
|
||
begin
|
||
SQL.Add('select f.conno,A.CKOrdNo,convert(char(10),CRTime,120) CRTime,F.KHName as khname1,E.C_Code,a.khname ');
|
||
//sql.add(',KHName1=(select Y.CustomerNoName from FHSQ_Main X inner join JYOrderCon_Main_PB Y on X.ConMainId=Y.MainId where X.FSId=A.CKORDNO ) ');
|
||
// SQL.Add(',YCLNAME=STUFF(( SELECT '','' +convert(VARCHAR, YCLName) FROM Cloth_YCL_PB g where g.MAINID = A.MAINID FOR XML PATH('''')), 1, 1, '''')');
|
||
SQL.Add(' ,E.C_CodeName');
|
||
sql.add(' ,E.C_Color,COUNT(A.MJID) PS ,SUM(A.KGQty) KGQty');
|
||
Sql.add(' from CK_PBCP_CR A ');
|
||
Sql.add(' inner join Cloth_Sub E on A.MainId=E.MainId');
|
||
Sql.add(' inner join Cloth_MAIN F on A.MainId=F.MainId');
|
||
Sql.add(' inner join WFB_MJJY_PB D on A.MJId=D.MJId where A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
// SQL.ADD(' inner join FHSQ_Main E on A.CKOrdNo=E.FSId');
|
||
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(fwhere);
|
||
SQL.Add(' group by A.CKOrdNo,convert(char(10),CRTime,120),F.KHName,E.C_Code,E.C_CodeName,E.C_Color,a.khname,f.conno');
|
||
|
||
//ShowMessage(SQL.Text);
|
||
end;
|
||
1: /////////////////////////<2F><>ϸ//////////////////////////////
|
||
begin
|
||
SQL.Add('select A.*,D.MJStr3, D.carno,D.ZZCarNo,B.KHNAME AS KHNAME1,B.ConNo,B.khconno,C.C_CodeName,C.C_Code,C.C_Color,C.gongyi,D.APXH,D.CheJian,C.BatchNoHZ,D.APBatchNo ');
|
||
//sql.add(',KHName1=(select Y.CustomerNoName from FHSQ_Main X inner join JYOrderCon_Main_PB Y on X.ConMainId=Y.MainId where X.FSId=A.CKORDNO ) ');
|
||
|
||
SQL.Add(',YCLNAME=STUFF(( SELECT '','' +convert(VARCHAR, YCLName) FROM Cloth_YCL_PB c where c.MAINID = A.MAINID FOR XML PATH('''')), 1, 1, '''')');
|
||
sql.add('from CK_PBCP_CR A ');
|
||
Sql.add(' inner join Cloth_Main B on A.MainId=B.MainId');
|
||
Sql.add(' inner join Cloth_Sub C on A.MainId=C.MainId');
|
||
Sql.add(' inner join WFB_MJJY_PB D on A.MJId=D.MJId');
|
||
// SQL.ADD(' inner join FHSQ_Main E on A.CKOrdNo=E.FSId');
|
||
sql.add('where A.CRTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + ''' ');
|
||
sql.Add(' and A.CRTime<''' + Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)) + '''');
|
||
// sql.Add(fwhere);
|
||
SQL.Add(' and CRFlag in (''<27><><EFBFBD><EFBFBD>'') ');
|
||
end;
|
||
end;
|
||
|
||
Open;
|
||
end;
|
||
// with ADOQueryMain do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add('exec P_Page_FinishClothCK ');
|
||
// sql.Add('@pageIndex=' + inttostr(CurrentPage));
|
||
// sql.Add(',@pageSize=' + inttostr(RecordsNumber));
|
||
// sql.Add(',@criteria= ' + quotedstr(fwhere));
|
||
// Open;
|
||
// end;
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
|
||
MovePanel2.Visible := false;
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
MovePanel2.Visible := false;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
BegDate.SetFocus;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(Self.Caption + 'TV1', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.FormShow(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
begin
|
||
|
||
ReadCxGrid(Self.Caption + 'TV1', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
||
|
||
SETSTATUS();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
exit;
|
||
SelExportData(Tv1, ADOQueryMain, '');
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.MPRTCodeNameChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.orderNoChange(Sender: TObject);
|
||
begin
|
||
if Length(ConNo.Text) < 4 then
|
||
Exit;
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main, True);
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main, False);
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.TBCKCXClick(Sender: TObject);
|
||
var
|
||
FFMainId, FPrice, FHZ, FCKOrderNo: string;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
if cxTabControl1.TabIndex <> 1 then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸҳ<CFB8><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
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
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Do_PBCK @CRFlag=''δ<><CEB4><EFBFBD><EFBFBD>'', @CKOrdNo='''', @MJID=' + quotedstr(trim(CDS_Main.fieldbyname('MJID').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('CKOrdNo').AsString) + ' <20><><EFBFBD>룺' + trim(CDS_Main.FieldByName('MJID').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Do_FHSQ ''' + Trim(CDS_Main.fieldbyname('CKOrdNo').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
CDS_Main.Delete;
|
||
end;
|
||
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 TfrmPBOuGLtList.C_CodeNameChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.ConNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
if Length(Trim(ConNo.Text)) < 4 then
|
||
Exit;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select A.*,B.ConNo,C.C_CodeName,C.C_Code,C.C_Color,D.APXH ');
|
||
sql.add('from CK_PBCP_CR A ');
|
||
Sql.add(' inner join Cloth_Main B on A.MainId=B.MainId');
|
||
Sql.add(' inner join Cloth_Sub C on A.MainId=C.MainId');
|
||
Sql.add(' inner join WFB_MJJY_PB D on A.MJId=D.MJId');
|
||
sql.add('where B.ConNo like :ConNo');
|
||
SQL.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Parameters.ParamByName('ConNo').Value := '%' + Trim(ConNo.Text) + '%';
|
||
Open;
|
||
//ShowMessage(SQL.Text);
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.CheJianChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.ToolButton1Click(Sender: TObject);
|
||
var
|
||
FFMainId, FPrice, FHZ, FCKOrderNo: string;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
|
||
if Trim(edtCarNo.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><CCA8>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
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>ij<DEB8><C4B3><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><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
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update WFB_MJJY_PB set ZZCarNo=' + quotedstr(Trim(edtCarNo.Text)) + ' where MJID=' + quotedstr(trim(CDS_Main.fieldbyname('MJID').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><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('CKOrdNo').AsString) + ' <20><><EFBFBD>룺' + trim(CDS_Main.FieldByName('MJID').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
ExecSQL;
|
||
end;
|
||
|
||
with CDS_Main do
|
||
begin
|
||
Edit;
|
||
FieldByName('SSel').Value := False;
|
||
FieldByName('ZZCarNo').Value := Trim(edtCarNo.Text);
|
||
Post;
|
||
end;
|
||
end;
|
||
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><DEB8>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.ToolButton2Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
begin
|
||
|
||
if CDS_Main.IsEmpty then
|
||
EXIT;
|
||
ExportFtErpFile(trim(ComboBox1.Text) + '.rmf', ADOQueryTemp);
|
||
if ((trim(ComboBox1.Text) = '<27><>ͨ<EFBFBD>뵥') or (trim(ComboBox1.Text) = '<27><>̧ͷ<CCA7><CDB7>ͨ<EFBFBD>뵥')) then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_Print_CKMDZZ12 ' + quotedstr(Trim(CDS_Main.fieldbyname('CKOrdNo').AsString)));
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_JuanPRT);
|
||
SInitCDSData20(ADOQueryTemp, CDS_JuanPRT);
|
||
end;
|
||
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ComboBox1.Text) + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['ConNo'] := CDS_Main.fieldbyname('ConNo').AsString;
|
||
// RMVariables['CarType'] := CDS_Main.fieldbyname('CarType').AsString;
|
||
// RMVariables['C_Spec'] := Trim(CDS_Main.fieldbyname('C_Spec').AsString);
|
||
// RMVariables['prtmf'] := Trim(CDS_Main.fieldbyname('MF').AsString);
|
||
// RMVariables['prtkz'] := Trim(CDS_Main.fieldbyname('KZ').AsString);
|
||
// RMVariables['C_Color'] := Trim(CDS_Main.fieldbyname('C_Color').AsString);
|
||
// RMVariables['ZYouHui'] := Trim(CDS_Main.fieldbyname('ZYouHui').AsString);
|
||
//
|
||
// RMVariables['KHName'] := Trim(CDS_Main.fieldbyname('CustomerNoName').AsString);
|
||
// RMVariables['MJDate'] := CDS_Main.fieldbyname('FHDate').Value;
|
||
// RMVariables['CRType'] := CDS_Main.fieldbyname('CRType').AsString;
|
||
// RMVariables['C_CodeName'] := Trim(CDS_Main.fieldbyname('CPName').AsString);
|
||
// RMVariables['C_Code'] := Trim(CDS_Main.fieldbyname('CPCode').AsString);
|
||
//
|
||
// RMVariables['HZPS'] := CDS_Main.fieldbyname('FHPSHZ').Value;
|
||
// RMVariables['KHCONNO'] := CDS_Main.fieldbyname('KHCONNO').Value;
|
||
// RMVariables['HZQty'] := CDS_Main.fieldbyname('FHQtyHZ').Value;
|
||
// RMVariables['ConNo'] := Trim(CDS_Main.fieldbyname('ConNo').AsString);
|
||
// RMVariables['shouhuotaitou'] := Trim(CDS_Main.fieldbyname('shouhuotaitou').AsString);
|
||
// RMVariables['shouhuomingcheng'] := Trim(CDS_Main.fieldbyname('shouhuomingcheng').AsString);
|
||
// RMVariables['CKOrdNo'] := Trim(CDS_Main.fieldbyname('fsid').AsString);
|
||
// RMVariables['FHTaiTou'] := Trim(CDS_Main.fieldbyname('FHTaiTou').AsString);
|
||
// RMVariables['SQBatchNoHZ'] := Trim(CDS_Main.fieldbyname('SQBatchNoHZ').AsString);
|
||
// RMVariables['Note'] := Trim(CDS_Main.fieldbyname('Note').AsString);
|
||
// RMVariables['ranchang'] := Trim(CDS_Main.fieldbyname('ranchang').AsString);
|
||
// RMVariables['SHDanWei'] := Trim(CDS_Main.fieldbyname('SHDanWei').AsString);
|
||
// RMVariables['ishs'] := Trim(CDS_Main.fieldbyname('ishs').AsString);
|
||
// RMVariables['ForOrderNo'] := Trim(CDS_Main.fieldbyname('ForOrderNo').AsString);
|
||
// RMVariables['gongyi'] := Trim(CDS_Main.fieldbyname('gongyi').AsString);
|
||
// RMVariables['Price'] := Trim(CDS_Main.fieldbyname('Price').AsString);
|
||
// RMVariables['Money'] := Trim(CDS_Main.fieldbyname('SumMoney').AsString);
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.ToolButton3Click(Sender: TObject);
|
||
var
|
||
MCIIDS, fPrintFile: string;
|
||
begin
|
||
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
|
||
|
||
MCIIDS := MCIIDS + Trim(CDS_Main.fieldbyname('mjid').AsString) + ',';
|
||
CDS_Main.Delete;
|
||
end
|
||
else
|
||
Next;
|
||
end;
|
||
end;
|
||
CDS_Main.EnableControls;
|
||
|
||
// if CDS_Main.IsEmpty then
|
||
// EXIT;
|
||
ExportFtErpFile(trim(ComboBox1.Text) + '.rmf', ADOQueryTemp);
|
||
if ((trim(ComboBox1.Text) = '<27><>ͨ<EFBFBD>뵥') or (trim(ComboBox1.Text) = '<27><>̧ͷ<CCA7><CDB7>ͨ<EFBFBD>뵥')) then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_Print_CKMDZZ12_G @Filtration=' + quotedstr(Trim(MCIIDS)));
|
||
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_JuanPRT);
|
||
SInitCDSData20(ADOQueryTemp, CDS_JuanPRT);
|
||
end;
|
||
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ComboBox1.Text) + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['ConNo'] := CDS_Main.fieldbyname('ConNo').AsString;
|
||
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
SETSTATUS();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmPBOuGLtList.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 TfrmPBOuGLtList.ToolButton4Click(Sender: TObject);
|
||
var
|
||
FCKOrderNo: string;
|
||
begin
|
||
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
if cxTabControl1.TabIndex <> 1 then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸҳ<CFB8><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
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><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
CDS_Main.EnableControls;
|
||
// if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
// Exit;
|
||
|
||
MovePanel2.Visible := True;
|
||
MovePanel2.Refresh;
|
||
|
||
try
|
||
frmKHList := TfrmKHList.Create(Application);
|
||
with frmKHList do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
CDS_Main.DisableControls;
|
||
with CDS_Main do
|
||
begin
|
||
First;
|
||
while CDS_Main.Locate('SSel', True, []) = True do
|
||
begin
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update CK_PBCP_CR set khname=' + quotedstr(Trim(Order_Main.fieldbyname('CoName').AsString)) + ' where CkOrdNo=' + quotedstr(trim(CDS_Main.fieldbyname('CkOrdNo').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><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('CKOrdNo').AsString) + ' <20><>Ϊ<EFBFBD><CEAA>' + trim(Order_Main.fieldbyname('CoName').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
ExecSQL;
|
||
end;
|
||
CDS_Main.Delete;
|
||
end;
|
||
end;
|
||
end;
|
||
CDS_Main.EnableControls;
|
||
// khname.text := Trim(Order_Main.fieldbyname('CoName').AsString);
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmKHList.Free;
|
||
end;
|
||
InitGrid();
|
||
end;
|
||
|
||
end.
|
||
|