1295 lines
35 KiB
ObjectPascal
1295 lines
35 KiB
ObjectPascal
![]() |
unit U_SalesContractList;
|
|||
|
|
|||
|
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, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System,
|
|||
|
RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus, cxPC, cxButtonEdit,
|
|||
|
cxTextEdit, cxDropDownEdit, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,
|
|||
|
dxSkinsDefaultPainters, cxNavigator, dxDateRanges, dxBarBuiltInMenu,
|
|||
|
U_BaseList, RM_e_Graphic, RM_e_Jpeg, RM_E_llPDF, Vcl.Clipbrd, dxSkinBasic,
|
|||
|
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, dxSkinOffice2016Colorful,
|
|||
|
dxSkinOffice2016Dark, dxSkinOffice2019Black, dxSkinOffice2019Colorful,
|
|||
|
dxSkinOffice2019DarkGray, dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven,
|
|||
|
dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
|
|||
|
dxSkinSpringtime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
|
|||
|
dxSkinTheBezier, dxSkinValentine, dxSkinVisualStudio2013Blue,
|
|||
|
dxSkinVisualStudio2013Dark, dxSkinVisualStudio2013Light, dxSkinVS2010,
|
|||
|
dxSkinWhiteprint, dxSkinWXI, dxSkinXmas2008Blue, dxScrollbarAnnotations;
|
|||
|
|
|||
|
type
|
|||
|
TfrmSalesContractList = class(TfrmBaseList)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
TBPrint: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
GPM_1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DS_1: TDataSource;
|
|||
|
v1OrdDate: TcxGridDBColumn;
|
|||
|
v1DeliveryDate: TcxGridDBColumn;
|
|||
|
v1OrdPerson1: TcxGridDBColumn;
|
|||
|
v1ConNo: TcxGridDBColumn;
|
|||
|
CDS_2: TClientDataSet;
|
|||
|
v1CustomerNoName: TcxGridDBColumn;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
pm2: TPopupMenu;
|
|||
|
Panel1: TPanel;
|
|||
|
Label4: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Label9: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
BuyName: TEdit;
|
|||
|
HZSCSName: TEdit;
|
|||
|
ConNo: TEdit;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
tchk: TToolButton;
|
|||
|
Tnochk: TToolButton;
|
|||
|
cxSplitter1: TcxSplitter;
|
|||
|
DS_2: TDataSource;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
Label2: TLabel;
|
|||
|
Tqx: TToolButton;
|
|||
|
Tnoqx: TToolButton;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
GPM_2: TcxGridPopupMenu;
|
|||
|
CDS_1: TClientDataSet;
|
|||
|
btnTijiao: TToolButton;
|
|||
|
btnCXTijiao: TToolButton;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
Label3: TLabel;
|
|||
|
BuyConNo: TEdit;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
Tv1Column14: TcxGridDBColumn;
|
|||
|
pm1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
btnWC: TToolButton;
|
|||
|
btnWCCX: TToolButton;
|
|||
|
ADOQueryImage: TADOQuery;
|
|||
|
Tv1Column19: TcxGridDBColumn;
|
|||
|
IsJYTime: TCheckBox;
|
|||
|
ToolButton7: TToolButton;
|
|||
|
N3: TMenuItem;
|
|||
|
N4: TMenuItem;
|
|||
|
Tv1Column25: TcxGridDBColumn;
|
|||
|
Tv1Column27: TcxGridDBColumn;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
TV2: TcxGridDBTableView;
|
|||
|
v1XHNo: TcxGridDBColumn;
|
|||
|
VC_SCSCode: TcxGridDBColumn;
|
|||
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1PRTOrderQty: TcxGridDBColumn;
|
|||
|
v1OrderUnit: TcxGridDBColumn;
|
|||
|
v1PRTPrice: TcxGridDBColumn;
|
|||
|
cxGridDBColumn9: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
N5: TMenuItem;
|
|||
|
N6: TMenuItem;
|
|||
|
TV2Column1: TcxGridDBColumn;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
TV2Column2: TcxGridDBColumn;
|
|||
|
TV2Column3: TcxGridDBColumn;
|
|||
|
TV2Column4: TcxGridDBColumn;
|
|||
|
TV2Column5: TcxGridDBColumn;
|
|||
|
TV2Column6: TcxGridDBColumn;
|
|||
|
TV2Column7: TcxGridDBColumn;
|
|||
|
TV2Column8: TcxGridDBColumn;
|
|||
|
TV2Column9: TcxGridDBColumn;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
RMDBDataSet1: TRMDBDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
TV2Column10: TcxGridDBColumn;
|
|||
|
btn1: TToolButton;
|
|||
|
cxgrdbclmnTV2Column11: TcxGridDBColumn;
|
|||
|
cxgrdbclmnTV2Column12: TcxGridDBColumn;
|
|||
|
cxgrdbclmnTV2Column13: TcxGridDBColumn;
|
|||
|
cxgrdbclmnTV2Column14: TcxGridDBColumn;
|
|||
|
cxgrdbclmnTv1Column8: TcxGridDBColumn;
|
|||
|
cxgrdbclmnTV2Column15: TcxGridDBColumn;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure TBEditClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
procedure CheckBox2Click(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure BuyNameChange(Sender: TObject);
|
|||
|
procedure tchkClick(Sender: TObject);
|
|||
|
procedure TnochkClick(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure TqxClick(Sender: TObject);
|
|||
|
procedure TnoqxClick(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure btnTijiaoClick(Sender: TObject);
|
|||
|
procedure btnCXTijiaoClick(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure btnWCClick(Sender: TObject);
|
|||
|
procedure btnWCCXClick(Sender: TObject);
|
|||
|
procedure ConNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure ToolButton7Click(Sender: TObject);
|
|||
|
procedure N3Click(Sender: TObject);
|
|||
|
procedure N4Click(Sender: TObject);
|
|||
|
procedure TBPrintClick(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure N5Click(Sender: TObject);
|
|||
|
procedure N6Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure btn1Click(Sender: TObject);
|
|||
|
procedure TV2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
private
|
|||
|
fFlileFlag: string;
|
|||
|
procedure InitGrid();
|
|||
|
procedure SetStatus();
|
|||
|
procedure InitSub();
|
|||
|
procedure InitImage();
|
|||
|
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
FFInt, FCloth: Integer;
|
|||
|
FAuthority, FGSTT, FSubIdS: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_SalesConInPut, U_RTFun, U_AttachmentUpload, U_LabelPrint;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmSalesContractList.InitImage();
|
|||
|
begin
|
|||
|
|
|||
|
ADOQueryImage.Close;
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
with ADOQueryImage do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from TP_File A');
|
|||
|
sql.Add('where WBID=' + quotedstr(trim(CDS_1.fieldbyname('SubId').AsString)));
|
|||
|
sql.Add('and TFType=' + quotedstr(trim('HX')));
|
|||
|
open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.InitSub();
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select IFJQ = DATEDIFF(day, CONVERT(date, GETDATE()), A.DlyDate),A.* from BS_Contract_sub A ');
|
|||
|
sql.Add(' where ConMID =' + quotedstr((CDS_1.fieldbyname('ConMID').AsString)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTemp, CDS_2);
|
|||
|
SInitCDSData(ADOQueryTemp, CDS_2);
|
|||
|
TV2.DataController.Filter.Clear;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNoFiler(Tv1, True); //ȫѡ
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNoFiler(Tv1, False); //ȫ<><C8AB>
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.N3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Clipboard.SetTextBuf(PChar(Trim(CDS_1.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.N4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Clipboard.SetTextBuf(PChar(Trim(CDS_1.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.N5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_1, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.N6Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_1, False);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.SetStatus();
|
|||
|
begin
|
|||
|
tbedit.Enabled := false;
|
|||
|
Tqx.Enabled := false;
|
|||
|
TNoqx.Enabled := false;
|
|||
|
btnWC.Enabled := False;
|
|||
|
btnWCCX.Enabled := False;
|
|||
|
|
|||
|
if Trim(FAuthority) = '¼<><C2BC>' then
|
|||
|
begin
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
tbedit.Enabled := true;
|
|||
|
Tqx.Enabled := True;
|
|||
|
btnWC.Enabled := True;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
btnWCCX.Enabled := True;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
TNoqx.Enabled := True;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(FAuthority) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
tbedit.Enabled := true;
|
|||
|
Tqx.Enabled := True;
|
|||
|
btnWC.Enabled := True;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
btnWCCX.Enabled := True;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
TNoqx.Enabled := True;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
// frmContractListNX:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
BegDate.DateTime := EndDate.DateTime - 90;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.InitGrid();
|
|||
|
var
|
|||
|
WSql: string;
|
|||
|
begin
|
|||
|
WSql := SGetFilters(Panel1, 1, 2);
|
|||
|
if trim(WSql) <> '' then
|
|||
|
begin
|
|||
|
WSql := ' and ' + trim(WSql);
|
|||
|
end;
|
|||
|
|
|||
|
if IsJYTime.Checked then
|
|||
|
begin
|
|||
|
WSql := WSql + ' and ConDate>' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
|
|||
|
WSql := WSql + ' and ConDate<=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if trim(WSql) <> '' then
|
|||
|
WSql := ' and 1=1' + trim(WSql)
|
|||
|
else
|
|||
|
WSql := WSql + ' and 1=2 ';
|
|||
|
end;
|
|||
|
if trim(WSql) = 'and 1=2' then
|
|||
|
Application.MessageBox('<27><>ѡ<EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
|
|||
|
sql.Add('select AA.* from (select A.*');
|
|||
|
|
|||
|
sql.Add(' ,HZSCSName=cast((SELECT C_Name +'' '' from BS_Contract_Sub X where X.ConMID=A.ConMID FOR XML PATH(''''))as VARCHAR(6000) ) ');
|
|||
|
sql.Add(' from BS_Contract_Main A ) AA ');
|
|||
|
sql.Add('where 1=1 ' + (WSql));
|
|||
|
sql.Add(' and AA.ConType in (''<27><><EFBFBD><EFBFBD>'',''<27><><EFBFBD><EFBFBD>'') ');
|
|||
|
|
|||
|
if Trim(FAuthority) = '¼<><C2BC>' then
|
|||
|
begin
|
|||
|
sql.Add(' and ( SalesId=' + quotedstr(trim(DCode)) + ' or exists (select * from [dbo].[F_Tool_SplitString](TallyId,'','') X where X.RTValue =' + quotedstr(trim(DCode)) + '))');
|
|||
|
end;
|
|||
|
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(AA.status,''0'')=''9''');
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(AA.status,''0'')=''10''');
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(AA.status,''0'')=''-1''');
|
|||
|
end;
|
|||
|
end;
|
|||
|
sql.Add(' order by ConDate desc ');
|
|||
|
//showmessage(sql.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
TV1.DataController.Filter.Clear;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.TBPrintClick(Sender: TObject);
|
|||
|
var
|
|||
|
WSql: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
try
|
|||
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
with frmLabelPrint do
|
|||
|
begin
|
|||
|
FLMType := 'SalesConPrint';
|
|||
|
FFiltration1 := QuotedStr(Trim(Self.CDS_1.fieldbyname('ConMID').AsString));
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
// Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLabelPrint.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
if Trim(FAuthority) <> '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
if Trim(CDS_1.fieldbyname('Filler').AsString) <> Trim(DName) then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Knit_Plan_Sub');
|
|||
|
sql.Add('where ConNo=' + quotedstr(trim(CDS_1.fieldbyname('ConNo').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
// if ADOQueryTemp.IsEmpty = false then
|
|||
|
// begin
|
|||
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
|
|||
|
try
|
|||
|
frmSalesConInPut := TfrmSalesConInPut.Create(Application);
|
|||
|
with frmSalesConInPut do
|
|||
|
begin
|
|||
|
PState := '<27><EFBFBD>';
|
|||
|
FConMId := Trim(Self.CDS_1.fieldbyname('ConMID').AsString);
|
|||
|
FAuthority := self.FAuthority;
|
|||
|
FGSTT := self.FGSTT;
|
|||
|
fFlileFlag := self.fFlileFlag;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmSalesConInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.TBAddClick(Sender: TObject);
|
|||
|
var
|
|||
|
maxno: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
frmSalesConInPut := TfrmSalesConInPut.Create(Application);
|
|||
|
with frmSalesConInPut do
|
|||
|
begin
|
|||
|
PState := '<27><><EFBFBD><EFBFBD>';
|
|||
|
FConMId := '';
|
|||
|
FAuthority := self.FAuthority;
|
|||
|
FGSTT := self.FGSTT;
|
|||
|
fFlileFlag := self.fFlileFlag;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmSalesConInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
fFlileFlag := UserDataFlag + 'HX';
|
|||
|
FAuthority := self.fParameters1;
|
|||
|
readCxGrid(trim(Self.Caption) + 'tv1', Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
readCxGrid(trim(Self.Caption) + 'tv2', Tv2, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
Tv1Column19.Editing := false;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
if ToolButton1.Visible = False then
|
|||
|
Exit;
|
|||
|
ToolButton1.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.CheckBox1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.CheckBox2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.ConNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmSalesConInPut := TfrmSalesConInPut.Create(Application);
|
|||
|
with frmSalesConInPut do
|
|||
|
begin
|
|||
|
PState := '<27>鿴';
|
|||
|
FConMId := Trim(Self.CDS_1.fieldbyname('ConMID').AsString);
|
|||
|
FGSTT := self.FGSTT;
|
|||
|
ToolBar2.Visible := False;
|
|||
|
TBSave.Visible := False;
|
|||
|
// ScrollBox1.Enabled := False;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmSalesConInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmSalesConInPut := TfrmSalesConInPut.Create(Application);
|
|||
|
with frmSalesConInPut do
|
|||
|
begin
|
|||
|
PState := '<27><><EFBFBD><EFBFBD>';
|
|||
|
FConMId := Trim(Self.CDS_1.fieldbyname('ConMID').AsString);
|
|||
|
FAuthority := self.FAuthority;
|
|||
|
fFlileFlag := self.fFlileFlag;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmSalesConInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.ToolButton4Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile, WSql: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
WSql := '';
|
|||
|
CDS_1.DisableControls;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_1.fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
if WSql <> '' then
|
|||
|
begin
|
|||
|
WSql := WSql + ',' + QuotedStr(Trim(CDS_1.fieldbyname('ConMId').AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
WSql := QuotedStr(Trim(CDS_1.fieldbyname('ConMId').AsString));
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_1.Locate('SSel', True, []);
|
|||
|
CDS_1.EnableControls;
|
|||
|
|
|||
|
RMXLSExport1 := TRMXLSExport.Create(RMXLSExport1);
|
|||
|
ExportFtErpFile('<27><><EFBFBD>ۺ<EFBFBD>ͬ.rmf', ADOQueryPrint);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>ۺ<EFBFBD>ͬ.rmf';
|
|||
|
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select AAA.*,B.* from (select AA.* from (select A.*');
|
|||
|
sql.Add(' from BS_Contract_Main A ) AA ');
|
|||
|
sql.Add('where 1=1 and AA.ConMId in(' + (WSql));
|
|||
|
sql.Add(') and AA.ConType in (''<27><><EFBFBD><EFBFBD>'',''<27><><EFBFBD><EFBFBD>'') ');
|
|||
|
|
|||
|
if Trim(FAuthority) = '¼<><C2BC>' then
|
|||
|
begin
|
|||
|
sql.Add(' and ( SalesId=' + quotedstr(trim(DCode)) + ' or exists (select * from [dbo].[F_Tool_SplitString](TallyId,'','') X where X.RTValue =' + quotedstr(trim(DCode)) + '))');
|
|||
|
end;
|
|||
|
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(AA.status,''0'')=''9''');
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(AA.status,''0'')=''10''');
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(AA.status,''0'')=''-1''');
|
|||
|
end;
|
|||
|
end;
|
|||
|
sql.Add(' )AAA INNER JOIN BS_Contract_Sub B on AAA.ConMID=B.ConMID');
|
|||
|
//showmessage(sql.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.btnWCClick(Sender: TObject);
|
|||
|
var
|
|||
|
MConMIDS: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
MConMIDS := '';
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|||
|
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><CDAC><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
application.MessageBox('<27><><EFBFBD>ɳɹ<C9B3>', '<27><>ʾ');
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.BuyNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.tchkClick(Sender: TObject);
|
|||
|
var
|
|||
|
MConMIDS: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
MConMIDS := '';
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|||
|
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><CDAC><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3>', '<27><>ʾ');
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.TnochkClick(Sender: TObject);
|
|||
|
var
|
|||
|
MConMIDS: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
MConMIDS := '';
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|||
|
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><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3>', '<27><>ʾ');
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
SetStatus();
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
InitSub();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.TV2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
if cxTabControl1.TabIndex = 0 then
|
|||
|
begin
|
|||
|
if AViewInfo.GridRecord.Values[tv2.GetColumnByFieldName('IFJQ').Index] <= 3 then
|
|||
|
ACanvas.Brush.Color := $4763FF;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.TqxClick(Sender: TObject);
|
|||
|
var
|
|||
|
MConMIDS: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
MConMIDS := '';
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Knit_Plan_Sub A');
|
|||
|
sql.Add('where ConNo=' + quotedstr(trim(CDS_1.fieldbyname('ConNo').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryTemp.IsEmpty = false then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>!', '<27><>ʾ', 0);
|
|||
|
EnableControls;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
sql.Add(',@Operation=''ȡ<><C8A1>'' ');
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|||
|
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><>ͬȡ<CDAC><C8A1>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
application.MessageBox('ȡ<><C8A1><EFBFBD>ɹ<EFBFBD>', '<27><>ʾ');
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.TnoqxClick(Sender: TObject);
|
|||
|
var
|
|||
|
MConMIDS: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
MConMIDS := '';
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
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><CDAC><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
|
|||
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>'' ');
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
// ShowMessage(sql.Text);
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ɹ<EFBFBD>', '<27><>ʾ');
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.ToolButton5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmAttachmentUpload := TfrmAttachmentUpload.Create(Application);
|
|||
|
with frmAttachmentUpload do
|
|||
|
begin
|
|||
|
fkeyNO := Trim(Self.CDS_1.fieldbyname('ConMID').AsString);
|
|||
|
fType := '<27><>ͬ';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmAttachmentUpload.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.ToolButton7Click(Sender: TObject);
|
|||
|
begin
|
|||
|
writeCxGrid(trim(Self.Caption) + 'tv1', Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
writeCxGrid(trim(Self.Caption) + 'tv2', Tv2, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.btnWCCXClick(Sender: TObject);
|
|||
|
var
|
|||
|
MConMIDS: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
MConMIDS := '';
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|||
|
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><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳɹ<C9B3>', '<27><>ʾ');
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('status').Index] = '2' then
|
|||
|
ACanvas.Brush.Color := clLime;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.btnTijiaoClick(Sender: TObject);
|
|||
|
var
|
|||
|
MConMIDS: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
MConMIDS := '';
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
sql.Add(',@Operation=''<27>ύ'' ');
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|||
|
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>ύ')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
application.MessageBox('<27>ύ<EFBFBD>ɹ<EFBFBD>', '<27><>ʾ');
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.btn1Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile, FLabVolume: string;
|
|||
|
begin
|
|||
|
if CDS_2.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
CDS_2.DisableControls;
|
|||
|
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' EXEC P_BS_Label_Get_Test1 ');
|
|||
|
SQL.Add(' @CIID=''' + Trim(CDS_2.fieldbyname('ConSID').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryPrint.IsEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
FLabVolume := Trim(ADOQueryPrint.fieldbyname('LabName').AsString);
|
|||
|
ExportFtErpFile(FLabVolume + '.rmf', ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + FLabVolume + '.rmf';
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.showReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
CDS_2.EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesContractList.btnCXTijiaoClick(Sender: TObject);
|
|||
|
var
|
|||
|
MConMIDS: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
MConMIDS := '';
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD><EFBFBD>ύ'' ');
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|||
|
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><CDAC><EFBFBD><EFBFBD><EFBFBD>ύ')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD>ɹ<EFBFBD>', '<27><>ʾ');
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|