1346 lines
38 KiB
ObjectPascal
1346 lines
38 KiB
ObjectPascal
unit U_PlanProfit;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||
cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
|
||
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, cxMemo,
|
||
cxRichEdit, ComCtrls, cxContainer, cxTextEdit, cxMaskEdit, cxButtonEdit,
|
||
StdCtrls, ToolWin, DBClient, ADODB, ExtCtrls, BtnEdit, cxCalendar, StrUtils,
|
||
cxCurrencyEdit, cxImage, cxDBEdit, Menus, RM_Common, RM_Class, RM_e_Xls,
|
||
RM_Dataset, RM_System, RM_GridReport, cxGridCustomPopupMenu, cxGridPopupMenu,
|
||
cxPC, cxSplitter, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
|
||
IdFTP, ShellAPI, cxDropDownEdit, cxCheckBox, RM_e_Graphic, RM_e_Jpeg,
|
||
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, Math,
|
||
dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
|
||
IdExplicitTLSClientServerBase, U_BaseList, Vcl.Clipbrd, dxSkinWXI,
|
||
dxScrollbarAnnotations;
|
||
|
||
type
|
||
TfrmPlanProfit = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBAdd: TToolButton;
|
||
TBEdit: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBPrint: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxGrid1: TcxGrid;
|
||
cxgrdpmn1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Label3: TLabel;
|
||
OrderNo: TEdit;
|
||
v1OrderNo: TcxGridDBColumn;
|
||
v1OrdDate: TcxGridDBColumn;
|
||
Order_Main: TClientDataSet;
|
||
TBCK: TToolButton;
|
||
Label12: TLabel;
|
||
MPRTKZ: TEdit;
|
||
btnCopy: TToolButton;
|
||
ADOQuerySub: TADOQuery;
|
||
DataSource2: TDataSource;
|
||
ToolButton4: TToolButton;
|
||
Tchk: TToolButton;
|
||
Tnochk: TToolButton;
|
||
TWC: TToolButton;
|
||
TNowc: TToolButton;
|
||
ADOQueryImage: TADOQuery;
|
||
DSImage: TDataSource;
|
||
IdFTP1: TIdFTP;
|
||
v1Column11: TcxGridDBColumn;
|
||
TBTJ: TToolButton;
|
||
TBTJCX: TToolButton;
|
||
v1Column16: TcxGridDBColumn;
|
||
ORDER_SUB: TClientDataSet;
|
||
PopupMenu2: TPopupMenu;
|
||
N3: TMenuItem;
|
||
N4: TMenuItem;
|
||
ComboBox1: TComboBox;
|
||
Label1: TLabel;
|
||
CustName: TEdit;
|
||
Tv1Column6: TcxGridDBColumn;
|
||
cxgrdpmn2: TcxGridPopupMenu;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
Tv1Column10: TcxGridDBColumn;
|
||
Tv1Column11: TcxGridDBColumn;
|
||
Label2: TLabel;
|
||
C_Name: TEdit;
|
||
CDS_WXTS: TClientDataSet;
|
||
Label4: TLabel;
|
||
ConNo: TEdit;
|
||
Tv1Column22: TcxGridDBColumn;
|
||
CheckBox1: TCheckBox;
|
||
ToolButton2: TToolButton;
|
||
PM_1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
GPM_3: TcxGridPopupMenu;
|
||
DS_3: TDataSource;
|
||
CDS_3: TClientDataSet;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
Tv1Column12: TcxGridDBColumn;
|
||
Tv1Column13: TcxGridDBColumn;
|
||
Tv1Column14: TcxGridDBColumn;
|
||
Tv1Column15: TcxGridDBColumn;
|
||
Tv1Column16: TcxGridDBColumn;
|
||
Tv1Column4: TcxGridDBColumn;
|
||
ToolButton1: TToolButton;
|
||
ToolButton3: TToolButton;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Tv1Column5: TcxGridDBColumn;
|
||
Tv1Column7: TcxGridDBColumn;
|
||
Tv1Column8: TcxGridDBColumn;
|
||
cxTabControl1: TcxTabControl;
|
||
ADOQuery1: TADOQuery;
|
||
Tv1Column9: TcxGridDBColumn;
|
||
Tv1Column17: TcxGridDBColumn;
|
||
Tv1Column18: TcxGridDBColumn;
|
||
BuyConNo: TEdit;
|
||
Label5: TLabel;
|
||
Tv1Column19: TcxGridDBColumn;
|
||
Tv1Column20: TcxGridDBColumn;
|
||
Tv1Column21: TcxGridDBColumn;
|
||
Tv1Column23: TcxGridDBColumn;
|
||
Tv1Column24: TcxGridDBColumn;
|
||
Tv1Column25: TcxGridDBColumn;
|
||
Tv1Column26: TcxGridDBColumn;
|
||
ToolButton5: TToolButton;
|
||
ToolButton6: TToolButton;
|
||
ToolButton7: TToolButton;
|
||
Tv1Column27: TcxGridDBColumn;
|
||
Tv1Column28: TcxGridDBColumn;
|
||
Tv1Column29: TcxGridDBColumn;
|
||
Tv1Column30: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure TBPrintClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure OrderNoMChange(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBTPClick(Sender: TObject);
|
||
procedure CheckBox2Click(Sender: TObject);
|
||
procedure Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
||
procedure v1DeliveryDateCustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
procedure TBCKClick(Sender: TObject);
|
||
procedure btnCopyClick(Sender: TObject);
|
||
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure TchkClick(Sender: TObject);
|
||
procedure TnochkClick(Sender: TObject);
|
||
procedure TWCClick(Sender: TObject);
|
||
procedure TNowcClick(Sender: TObject);
|
||
procedure TBTJClick(Sender: TObject);
|
||
procedure TBTJCXClick(Sender: TObject);
|
||
procedure N3Click(Sender: TObject);
|
||
procedure N4Click(Sender: TObject);
|
||
procedure ComboBox1Change(Sender: TObject);
|
||
procedure CustomerNoNameKeyPress(Sender: TObject; var Key: Char);
|
||
procedure ToolButton10Click(Sender: TObject);
|
||
procedure JGTypeChange(Sender: TObject);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure OrderNoChange(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
procedure ToolButton7Click(Sender: TObject);
|
||
private
|
||
DQdate: TDateTime;
|
||
procedure InitGrid();
|
||
procedure InitForm();
|
||
function DelData(): Boolean;
|
||
procedure InitGridFH();
|
||
procedure SetStatus();
|
||
procedure InitImage(fwbid: string);
|
||
procedure SendMessageQR(MDateId, KeyWord1, KeyWord2, KeyWord3: string);
|
||
// procedure InitData(ADO1: TADOQuery; Tv1: TcxGridDBTableView; SqlStr, FilterStr, MarkStr: string);
|
||
{ Private declarations }
|
||
public
|
||
FFInt, FCloth: Integer;
|
||
canshu1, canshu2: string;
|
||
fFlileFlag: string;
|
||
FNOTE: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_TradePlanMulFtyInPut, U_RTFun, U_ZDYHelp, U_LabelPrint,
|
||
U_TradeInspSet, U_AttachmentUpload, U_PlanProfitDetails;
|
||
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmPlanProfit.InitImage(fwbid: string);
|
||
begin
|
||
ADOQueryImage.close;
|
||
if fwbid = '' then
|
||
exit;
|
||
with ADOQueryImage do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from TP_File A');
|
||
sql.Add('where WBID=' + quotedstr(trim(fwbid)));
|
||
open;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.SetStatus();
|
||
begin
|
||
btnCopy.Enabled := false;
|
||
tbadd.Enabled := false;
|
||
TBEdit.Enabled := False;
|
||
TBDel.Enabled := False;
|
||
TBTJ.Enabled := False;
|
||
TBTJCX.Enabled := False;
|
||
tchk.Enabled := false;
|
||
tnochk.Enabled := false;
|
||
TWC.Enabled := False;
|
||
TNowc.Enabled := False;
|
||
TBDel.Enabled := False;
|
||
ToolButton6.Visible := False;
|
||
ToolButton7.Visible := False;
|
||
case cxTabControl1.TabIndex of
|
||
1:
|
||
begin
|
||
ToolButton6.Visible := True;
|
||
|
||
end;
|
||
2:
|
||
begin
|
||
ToolButton7.Visible := True;
|
||
end;
|
||
end;
|
||
|
||
// case cxTabControl1.TabIndex of
|
||
// 0:
|
||
// begin
|
||
// tbadd.Enabled := True;
|
||
// TBEdit.Enabled := True;
|
||
// TBDel.Enabled := True;
|
||
// TBDel.Enabled := True;
|
||
// TBTJ.Enabled := True;
|
||
// btnCopy.Enabled := True;
|
||
// end;
|
||
// 1:
|
||
// begin
|
||
// TBTJCX.Enabled := True;
|
||
// btnCopy.Enabled := True;
|
||
// TBDel.Enabled := True;
|
||
// tchk.Enabled := True;
|
||
//
|
||
// end;
|
||
// 2:
|
||
// begin
|
||
// TWC.Enabled := True;
|
||
// btnCopy.Enabled := True;
|
||
// tnochk.Enabled := True;
|
||
// end;
|
||
// 3:
|
||
// begin
|
||
// TNowc.Enabled := True;
|
||
// btnCopy.Enabled := True;
|
||
// end;
|
||
// end;
|
||
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.JGTypeChange(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
// frmProductOrderList:=nil;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
cxgrid1.Align := alClient;
|
||
DQdate := SGetServerDate(ADOQueryTemp);
|
||
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TBCloseClick(Sender: TObject);
|
||
begin
|
||
|
||
Close;
|
||
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.InitGrid();
|
||
//var
|
||
// MCG, MDH, MTP, MFH, MLen, MWeight: Double;
|
||
begin
|
||
|
||
application.ProcessMessages;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
Filtered := False;
|
||
sql.Add(' exec P_Trade_Profit_Plan ');
|
||
if CheckBox1.Checked = true then
|
||
begin
|
||
sql.Add(' @begdate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', begdate.DateTime))));
|
||
sql.Add(' ,@Enddate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', Enddate.DateTime + 1))));
|
||
end
|
||
else
|
||
begin
|
||
sql.Add(' @begdate=' + QuotedStr(''));
|
||
sql.Add(' ,@Enddate=' + QuotedStr(''));
|
||
end;
|
||
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
sql.Add(' ,@WCFlag=''δ<><CEB4><EFBFBD><EFBFBD>'' ');
|
||
end;
|
||
1:
|
||
begin
|
||
sql.Add(' ,@WCFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
end;
|
||
2:
|
||
begin
|
||
sql.Add(' ,@WCFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
end;
|
||
3:
|
||
begin
|
||
sql.Add(' ,@WCFlag=''ȫ<><C8AB>'' ');
|
||
end;
|
||
|
||
end;
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(ADOQueryMain, Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
ToolButton2.Click;
|
||
|
||
TV1.DataController.Filter.Clear;
|
||
end;
|
||
|
||
end;
|
||
|
||
|
||
//
|
||
//procedure TfrmPlanProfit.InitGrid();
|
||
//var
|
||
// STRwhere, Pwhere: string;
|
||
//begin
|
||
// STRwhere := '';
|
||
// Pwhere := SGetFilters(Panel1, 1, 2);
|
||
//
|
||
// begin
|
||
// if trim(Pwhere) <> '' then
|
||
// STRwhere := STRwhere + ' and ' + trim(Pwhere);
|
||
// end;
|
||
//
|
||
//// case cxTabControl1.TabIndex of
|
||
//// 0:
|
||
//// begin
|
||
//// STRwhere := STRwhere + ' and isnull(status,''0'')=''0'' ';
|
||
//// end;
|
||
//// 1:
|
||
//// begin
|
||
//// STRwhere := STRwhere + ' and isnull(status,''0'')=''1'' ';
|
||
//// end;
|
||
//// 2:
|
||
//// begin
|
||
//// STRwhere := STRwhere + ' and isnull(status,''0'')=''9'' ';
|
||
//// end;
|
||
//// 3:
|
||
//// begin
|
||
//// STRwhere := STRwhere + ' and isnull(status,''0'')=''10'' ';
|
||
//// end;
|
||
//// end;
|
||
//
|
||
// try
|
||
// ADOQueryMain.DisableControls;
|
||
//
|
||
// with ADOQueryMain do
|
||
// begin
|
||
// Filtered := False;
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.add(' select A.* from V_Trade_Plan_Multiple A');
|
||
//
|
||
// if (ComboBox1.Text = '<27>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD>') and (CheckBox1.Checked = True) then
|
||
// begin
|
||
// sql.add(' where A.OrdDate>=' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime))));
|
||
// sql.add(' and A.OrdDate<' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1))));
|
||
// end;
|
||
// if (ComboBox1.Text = '<27>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD>') and (CheckBox1.Checked = False) then
|
||
// begin
|
||
// sql.add(' where A.OrdDate>=' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime - 39999))));
|
||
// sql.add(' and A.OrdDate<' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1))));
|
||
// end;
|
||
//
|
||
// if (ComboBox1.Text = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') and (CheckBox1.Checked = True) then
|
||
// begin
|
||
// sql.add(' where A.DlyDate>=' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime))));
|
||
// sql.add(' and A.DlyDate<' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1))));
|
||
// end;
|
||
// if (ComboBox1.Text = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') and (CheckBox1.Checked = False) then
|
||
// begin
|
||
// sql.add(' where A.DlyDate>=' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime - 39999))));
|
||
// sql.add(' and A.DlyDate<' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1))));
|
||
// end;
|
||
//
|
||
// if canshu1 = '¼<><C2BC>' then
|
||
// begin
|
||
// sql.add(' and A.Filler= ' + QuotedStr(Trim(DName)));
|
||
// end;
|
||
// sql.add(' ' + STRwhere);
|
||
//
|
||
// sql.add(' order by filltime desc');
|
||
// ShowMessage(SQL.Text);
|
||
// Open;
|
||
// end;
|
||
//
|
||
// SCreateCDS(ADOQueryMain, Order_Main);
|
||
// SInitCDSData(ADOQueryMain, Order_Main);
|
||
// finally
|
||
// ADOQueryMain.EnableControls;
|
||
// TV1.DataController.Filter.Clear;
|
||
//
|
||
// end;
|
||
//end;
|
||
|
||
procedure TfrmPlanProfit.SendMessageQR(MDateId, KeyWord1, KeyWord2, KeyWord3: string);
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select distinct A.* from SY_User A inner join SY_Purview B on A.UserID=B.UserID where A.Valid=''Y'' ');
|
||
SQL.Add('and isnull(A.wxid,'''')<>''''');
|
||
SQL.Add(' and exists(select 1 from SY_ModuleSub X where X.ModuleID=B.ModuleID and X.ModuleSubID=B.ModuleSubID and X.FormName=''<27><><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' )');
|
||
// showmessage(sql.text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_WXTS);
|
||
SInitCDSData(ADOQueryTemp, CDS_WXTS);
|
||
|
||
if CDS_WXTS.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27>û<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><CEA2>,<2C>ύʧ<E1BDBB>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
Exit;
|
||
end;
|
||
CDS_WXTS.First;
|
||
while not CDS_WXTS.eof do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select * from WeixinMessage where 1<>1');
|
||
Open;
|
||
Append;
|
||
FieldByName('MessageType').Value := 'OrderToAudit';
|
||
FieldByName('MessageName').Value := '<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('Title').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('URL').Value := 'subpages/plan/view?id=' + Trim(MDateId);
|
||
FieldByName('OpenId').Value := Trim(CDS_WXTS.FieldByName('wxid').AsString);
|
||
FieldByName('Status').Value := '0';
|
||
FieldByName('CreateDate').Value := FormatDateTime('yyyymmdd', SGetServerDateTime(ADOQueryTemp));
|
||
FieldByName('CreateTime').Value := FormatDateTime('HH:mm:ss', SGetServerDateTime(ADOQueryTemp));
|
||
FieldByName('BusinessId').Value := Trim(MDateId);
|
||
FieldByName('KeyWord1').Value := Trim(KeyWord1);
|
||
FieldByName('KeyWord2').Value := Trim(KeyWord2);
|
||
FieldByName('KeyWord3').Value := Trim(KeyWord3);
|
||
FieldByName('Remark').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ɲ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD>飡';
|
||
Post;
|
||
end;
|
||
CDS_WXTS.Next;
|
||
end;
|
||
|
||
GetHTTP('http://aotang.rightsoft.top/api/message/send/OrderToAudit');
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.InitGridFH();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec Order_QryList :MainId,:WSql');
|
||
Parameters.ParamByName('WSql').Value := ' and FillTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''' + ' and FillTime<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1)) + '''';
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(ADOQueryMain, Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.InitForm();
|
||
begin
|
||
ReadCxGrid('ָʾ<D6B8><CABE><EFBFBD>б<EFBFBD>FF1', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
|
||
BegDate.DateTime := SGetServerDate(ADOQueryTemp) - 180;
|
||
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
|
||
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TBEditClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
|
||
if Trim(Order_Main.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;
|
||
|
||
try
|
||
frmTradePlanMulFtyInPut := TfrmTradePlanMulFtyInPut.Create(Application);
|
||
with frmTradePlanMulFtyInPut do
|
||
begin
|
||
|
||
PState := 1;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
FOrderNo := Trim(Self.Order_Main.fieldbyname('OrderNo').AsString);
|
||
canshu1 := self.canshu1;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmTradePlanMulFtyInPut.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TBDelClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if Trim(Order_Main.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;
|
||
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Trade_Cloth_Inspect where isnull(mainID,'''')<>'''' and mainID=''' + Trim(Order_Main.fieldbyname('mainID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>Ѽ<EFBFBD><D1BC>鲻<EFBFBD><E9B2BB>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
while Order_Main.Locate('SSel', true, []) do
|
||
begin
|
||
if Trim(Order_Main.fieldbyname('MainId').AsString) <> '' then
|
||
begin
|
||
DelData()
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
|
||
function TfrmPlanProfit.DelData(): Boolean;
|
||
begin
|
||
try
|
||
Result := false;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Trade_Plan_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add('delete Trade_Plan_Sub where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add('delete Trade_Plan_Fty where MainId=''' + Trim(Order_Main.fieldbyname('MainId').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('ָʾ<D6B8><CABE>ɾ<EFBFBD><C9BE>')));
|
||
sql.Add(',' + quotedstr(trim('ָʾ<D6B8><CABE><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('OrderNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
ExecSQL;
|
||
end;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Result := False;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TBPrintClick(Sender: TObject);
|
||
var
|
||
WSql: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
WSql := QuotedStr(Trim(Order_Main.fieldbyname('MainId').AsString));
|
||
|
||
try
|
||
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
||
with frmLabelPrint do
|
||
begin
|
||
FLMType := 'TradePlanPrint';
|
||
FFiltration1 := WSql;
|
||
if ShowModal = 1 then
|
||
begin
|
||
// Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmLabelPrint.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TBAddClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmTradePlanMulFtyInPut := TfrmTradePlanMulFtyInPut.Create(Application);
|
||
with frmTradePlanMulFtyInPut do
|
||
begin
|
||
PState := 0;
|
||
FMainId := '';
|
||
canshu1 := self.canshu1;
|
||
if ShowModal = 1 then
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmTradePlanMulFtyInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.OrderNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
canshu1 := self.fParameters1;
|
||
fFlileFlag := UserDataFlag + 'HX';
|
||
// cxTabControl1.TabIndex := 0;
|
||
InitForm();
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TBTPClick(Sender: TObject);
|
||
var
|
||
FQty, FQty1, FMxQty, FPQty, FMxQtyS, FPQtyS: string;
|
||
begin
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.CheckBox2Click(Sender: TObject);
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
||
var
|
||
id, id10: Integer;
|
||
begin
|
||
{try
|
||
if Tv1.GroupedItemCount=0 then
|
||
begin
|
||
Id:=Tv1.GetColumnByFieldName('DeliveryDate').Index-tv1.GroupedItemCount;
|
||
Id10:=Tv1.GetColumnByFieldName('SubStatus').Index-tv1.GroupedItemCount;
|
||
if Trim(VarToStr(ARecord.Values[id]))='' then Exit;
|
||
if Id<0 then Exit;
|
||
if ARecord.Values[id10]='<27><><EFBFBD><EFBFBD>' then exit;
|
||
if (ARecord.Values[id]-DQdate)>=4 then Exit;
|
||
if ((ARecord.Values[id]-DQdate)>=0) and ((ARecord.Values[id]-DQdate)<4) then
|
||
AStyle:=DataLink_.QHuangSe
|
||
else
|
||
if ARecord.Values[id]-DQdate<0 then
|
||
begin
|
||
AStyle:=DataLink_OrderManage.FenHongS;
|
||
end;
|
||
end else
|
||
begin
|
||
|
||
end;
|
||
except
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.v1DeliveryDateCustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
begin
|
||
{ Id:=TV1.GetColumnByFieldName('DeliveryDate').Index;//;-TV1.GroupedItemCount;
|
||
Id10:=TV1.GetColumnByFieldName('SubStatus').Index;
|
||
if Id<0 then Exit;
|
||
if AViewInfo.GridRecord.Values[Id10]='<27><><EFBFBD><EFBFBD>' then Exit;
|
||
if AViewInfo.GridRecord.Values[Id]-SGetServerDate(ADOQueryTemp)>=4 then Exit;
|
||
if ((AViewInfo.GridRecord.Values[id]-SGetServerDate(ADOQueryTemp))>=0) and ((AViewInfo.GridRecord.Values[id]-SGetServerDate(ADOQueryTemp))<4) then
|
||
ACanvas.Brush.Color:=clYellow
|
||
else
|
||
if (AViewInfo.GridRecord.Values[id])-(SGetServerDate(ADOQueryTemp)<0) then
|
||
begin
|
||
ACanvas.Brush.Color:=clRed;
|
||
end;
|
||
begin
|
||
ACanvas.Brush.Color:=clRed;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]='Purple' then
|
||
begin
|
||
ACanvas.Brush.Color:=clPurple;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]='Olive' then
|
||
begin
|
||
ACanvas.Brush.Color:=clOlive;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]='Teal' then
|
||
begin
|
||
ACanvas.Brush.Color:=clTeal;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]='Background' then
|
||
begin
|
||
ACanvas.Brush.Color:=clBackground;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TBCKClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select Top 1 OrdUnit from Trade_Plan_Sub A left join Trade_Plan_Main B on A.MainID=B.MainID ');
|
||
SQL.Add('where OrderNO=''' + Trim(Order_Main.fieldbyname('OrderNo').AsString) + '''');
|
||
open;
|
||
end;
|
||
|
||
try
|
||
frmPlanProfitDetails := TfrmPlanProfitDetails.Create(Application);
|
||
with frmPlanProfitDetails do
|
||
begin
|
||
// begdate.DateTime := self.begdate.DateTime;
|
||
// enddate.DateTime := self.Enddate.DateTime;
|
||
OrderNo.Text := self.Order_Main.fieldbyname('OrderNo').AsString;
|
||
FOrderNo := self.Order_Main.fieldbyname('OrderNo').AsString;
|
||
FMainID := self.Order_Main.fieldbyname('MainID').AsString;
|
||
FUnit := Self.ADOQuery1.FieldByName('OrdUnit').ASString;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmPlanProfitDetails.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.btnCopyClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
|
||
try
|
||
frmTradePlanMulFtyInPut := TfrmTradePlanMulFtyInPut.Create(Application);
|
||
with frmTradePlanMulFtyInPut do
|
||
begin
|
||
PState := 1;
|
||
CopyInt := 99;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
canshu1 := self.canshu1;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmTradePlanMulFtyInPut.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.OrderNoChange(Sender: TObject);
|
||
begin
|
||
ToolButton2.Click;
|
||
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.OrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
|
||
if Key = #13 then
|
||
begin
|
||
ToolButton3.Click;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
Clipboard.SetTextBuf(PChar(Trim(Order_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmAttachmentUpload := TfrmAttachmentUpload.Create(Application);
|
||
with frmAttachmentUpload do
|
||
begin
|
||
if Trim(canshu1) <> '<27><>ѯ' then
|
||
FEditAuthority := True;
|
||
fkeyNO := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
fType := 'ָʾ<D6B8><CABE>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmAttachmentUpload.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
TcxGridToExcel(self.Caption, cxGrid1);
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.ToolButton6Click(Sender: TObject);
|
||
var
|
||
topIndex: Integer;
|
||
mainIDS: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
if not Order_Main.Locate('ssel', True, []) then
|
||
begin
|
||
ShowMessage('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
Exit;
|
||
end;
|
||
|
||
if Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>㣿', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
topIndex := Tv1.Controller.TopRowIndex;
|
||
mainIDS := '';
|
||
|
||
Tv1.BeginUpdate;
|
||
Order_Main.DisableConstraints;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if FieldByName('ssel').Value = true then
|
||
begin
|
||
mainIDS := mainIDS + ',' + FieldByName('mainId').AsString;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
|
||
try
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Trade_Plan_Main SET SettleDate=getdate(),status = ''12'' ');
|
||
sql.Add('where mainID in (select rtvalue from F_Tool_SplitString(' + QuotedStr(mainIDS) + ', '','') ) ');
|
||
// ShowMessage(sql.text);
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
TBRafresh.Click;
|
||
Order_Main.EnableConstraints;
|
||
Tv1.EndUpdate;
|
||
Tv1.Controller.TopRowIndex := topIndex;
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
except
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.ToolButton7Click(Sender: TObject);
|
||
var
|
||
topIndex: Integer;
|
||
mainIDS: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
if not Order_Main.Locate('ssel', True, []) then
|
||
begin
|
||
ShowMessage('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㣿', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
mainIDS := '';
|
||
Tv1.BeginUpdate;
|
||
Order_Main.DisableConstraints;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if FieldByName('ssel').Value = true then
|
||
begin
|
||
mainIDS := mainIDS + ',' + FieldByName('mainId').AsString;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
|
||
try
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Trade_Plan_Main SET SettleDate=null,status = ''10'' ');
|
||
sql.Add('where mainID in (select rtvalue from F_Tool_SplitString(' + QuotedStr(mainIDS) + ', '','') ) ');
|
||
// ShowMessage(sql.text);
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
TBRafresh.Click;
|
||
Order_Main.EnableConstraints;
|
||
Tv1.endUpdate;
|
||
Tv1.Controller.TopRowIndex := topIndex;
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
except
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TchkClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
// if cxTabControl1.TabIndex <> 1 then
|
||
// begin
|
||
// Application.MessageBox('ֻ<><D6BB><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>!', '<27><>ʾ', 0);
|
||
// Exit;
|
||
// end;
|
||
if Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Trade_Plan_Main SET status=''9'',chker=''' + trim(DName) + ''',Chktime=getdate() ');
|
||
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').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><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('orderNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
|
||
except
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TnochkClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
// if cxTabControl1.TabIndex <> 2 then
|
||
// begin
|
||
// Application.MessageBox('ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>!', '<27><>ʾ', 0);
|
||
// Exit;
|
||
// end;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Trade_Plan_Main SET status=''1'',chker=null,Chktime=null ');
|
||
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').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><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('orderNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TWCClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
if Trim(Order_Main.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;
|
||
if Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
with Order_Main do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Trade_Plan_Main SET status=''10'' ');
|
||
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
|
||
sql.Add('exec P_Ord_Up_SuoLv @DataID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').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><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('orderNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
except
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TNowcClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
if Trim(Order_Main.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;
|
||
if Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Trade_Plan_Main SET status=''9'' ');
|
||
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').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><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('orderNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TBTJClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
|
||
if canshu1 <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
if Trim(Order_Main.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;
|
||
|
||
// if cxTabControl1.TabIndex <> 0 then
|
||
// begin
|
||
// Application.MessageBox('ֻ<><D6BB><EFBFBD>ڴ<EFBFBD><DAB4>ύ״̬<D7B4>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
// Exit;
|
||
// end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Trade_Plan_Main SET status=''1'' ');
|
||
sql.Add(' where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').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><C6BB><EFBFBD><EFBFBD>ύ')));
|
||
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('orderNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
SendMessageQR(trim(Order_Main.FieldByName('mainid').AsString), trim(Order_Main.FieldByName('Filler').AsString), trim(Order_Main.FieldByName('orderNO').AsString), Trim(FormatDateTime('yyyy-MM-dd', Order_Main.FieldByName('OrdDate').asdatetime)));
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('exec P_MSG_in ');
|
||
sql.Add(' @MSG=' + QuotedStr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('orderNO').AsString) + ' <20><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>')));
|
||
sql.Add(',@FillUserid=' + QuotedStr(trim(DCode)));
|
||
sql.Add(',@FillUserName=' + QuotedStr(trim(DName)));
|
||
sql.Add(',@FillType=' + QuotedStr(trim('<27><>Ҫȷ<D2AA><C8B7>')));
|
||
sql.Add(',@MegType=' + QuotedStr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ύ')));
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ύ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
|
||
except
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ύʧ<E1BDBB>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.TBTJCXClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
if canshu1 <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
if Trim(Order_Main.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;
|
||
//
|
||
// if cxTabControl1.TabIndex <> 1 then
|
||
// begin
|
||
// Application.MessageBox('ֻ<><D6BB><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
// Exit;
|
||
// end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Trade_Plan_Main SET status=''0'' ');
|
||
sql.Add(' where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
sql.Add(' and isnull(status,''0'')=''1'' ');
|
||
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><C6BB><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('orderNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.N1Click(Sender: TObject);
|
||
begin
|
||
Clipboard.SetTextBuf(PChar(Trim(Order_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.N3Click(Sender: TObject);
|
||
begin
|
||
SelOKNoFiler(Tv1, True); //ȫѡ
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.N4Click(Sender: TObject);
|
||
begin
|
||
SelOKNoFiler(Tv1, False); //ȫ<><C8AB>
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.ComboBox1Change(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.CustomerNoNameKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.ToolButton10Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('ָʾ<D6B8><CABE><EFBFBD>б<EFBFBD>FF1', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmTradeInspSet := TfrmTradeInspSet.Create(Application);
|
||
with frmTradeInspSet do
|
||
begin
|
||
|
||
FDataID := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmTradeInspSet.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('ָʾ<D6B8><CABE><EFBFBD>б<EFBFBD>FF1', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
|
||
end;
|
||
|
||
procedure TfrmPlanProfit.ToolButton3Click(Sender: TObject);
|
||
var
|
||
wsql: string;
|
||
begin
|
||
wsql := '';
|
||
if CheckBox1.Checked = true then
|
||
begin
|
||
if SGetFilters(Panel1, 1, 2) <> '' then
|
||
wsql := ' and ';
|
||
wsql := wsql + ' (OrdDate >= ' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', begdate.DateTime)));
|
||
wsql := wsql + ' and OrdDate <= ' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime))) + ')';
|
||
end;
|
||
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2) + wsql);
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(ADOQueryMain, Order_Main);
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|
||
|
||
|
||
|
||
|
||
|
||
// * _ooOoo_
|
||
// * o8888888o
|
||
// * 88" . "88
|
||
// * (| -_- |)
|
||
// * O\ = /O
|
||
// * ____/`---'\____
|
||
// * . ' \\| |// `.
|
||
// * / \\||| : |||// \
|
||
// * / _||||| -:- |||||- \
|
||
// * | | \\\ - /// | |
|
||
// * | \_| ''\---/'' | |
|
||
// * \ .-\__ `-` ___/-. /
|
||
// * ___`. .' /--.--\ `. . __
|
||
// * ."" '< `.___\_<|>_/___.' >'"".
|
||
// * | | : `- \`.;`\ _ /`;.`/ - ` : | |
|
||
// * \ \ `-. \_ __\ /__ _/ .-` / /
|
||
// * ======`-.____`-.___\_____/___.-`____.-'======
|
||
// * `=---='
|
||
// *
|
||
// * .............................................
|
||
|
||
|