1047 lines
32 KiB
ObjectPascal
1047 lines
32 KiB
ObjectPascal
unit U_SXCKOutListDBCK;
|
||
|
||
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, cxCalendar, cxButtonEdit, cxSplitter, RM_Common, RM_Class,
|
||
RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, cxTextEdit, cxPC, cxCheckBox,
|
||
cxCurrencyEdit, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
||
dxBarBuiltInMenu;
|
||
|
||
type
|
||
TfrmSXCKOutListDBCK = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBAdd: TToolButton;
|
||
TBEdit: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBPrint: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Label3: TLabel;
|
||
ConNo: TEdit;
|
||
Label5: TLabel;
|
||
C_CodeName: TEdit;
|
||
TBExport: TToolButton;
|
||
Order_Main: TClientDataSet;
|
||
Label4: TLabel;
|
||
C_Spec: TEdit;
|
||
ScrollBox1: TScrollBox;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1OrderNo: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1DeliveryDate: TcxGridDBColumn;
|
||
v1FactoryNo1Name: TcxGridDBColumn;
|
||
v1PRTSpec: TcxGridDBColumn;
|
||
v1PRTMF: TcxGridDBColumn;
|
||
v1PRTKZ: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
v1OrderUnit: TcxGridDBColumn;
|
||
v1Price: TcxGridDBColumn;
|
||
v1Money: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
ClientDataSet3: TClientDataSet;
|
||
DataSource2: TDataSource;
|
||
DataSource3: TDataSource;
|
||
ClientDataSet2: TClientDataSet;
|
||
v1Qty1: TcxGridDBColumn;
|
||
RM1: TRMGridReport;
|
||
RMDBMain: TRMDBDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
CDS_PRT: TClientDataSet;
|
||
Label6: TLabel;
|
||
FactoryNoName: TEdit;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1T_money: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyle1: TcxStyle;
|
||
cxStyle2: TcxStyle;
|
||
cxStyle_gridRow: TcxStyle;
|
||
cxStyle_gridFoot: TcxStyle;
|
||
cxStyle_gridHead: TcxStyle;
|
||
cxStyle_gridGroupBox: TcxStyle;
|
||
cxStyle_yellow: TcxStyle;
|
||
cxStyle_Red: TcxStyle;
|
||
cxStyle_fontBlack: TcxStyle;
|
||
cxStyle_fontclFuchsia: TcxStyle;
|
||
cxStyle_fontclPurple: TcxStyle;
|
||
cxStyle_fontclGreen: TcxStyle;
|
||
cxStyle_fontclBlue: TcxStyle;
|
||
cxStyle_fontclTeal: TcxStyle;
|
||
cxStyle_fontclOlive: TcxStyle;
|
||
ToolButton1: TToolButton;
|
||
Tth: TToolButton;
|
||
cxTabControl1: TcxTabControl;
|
||
tchk: TToolButton;
|
||
Tnochk: TToolButton;
|
||
v1Column12: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
v1Column16: TcxGridDBColumn;
|
||
v1Column17: TcxGridDBColumn;
|
||
v1Column14: TcxGridDBColumn;
|
||
v1Column15: TcxGridDBColumn;
|
||
Label7: TLabel;
|
||
JHPlace: TEdit;
|
||
v1Column18: TcxGridDBColumn;
|
||
v1Column19: TcxGridDBColumn;
|
||
v1Column20: TcxGridDBColumn;
|
||
v1Column21: TcxGridDBColumn;
|
||
v1Column22: TcxGridDBColumn;
|
||
v1Column23: TcxGridDBColumn;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
Tv1Column4: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBPrintClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure ConNoChange(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure Tv2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure v2Column3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure conPress(Sender: TObject; var Key: Char);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure TthClick(Sender: TObject);
|
||
procedure tchkClick(Sender: TObject);
|
||
procedure TnochkClick(Sender: TObject);
|
||
procedure Tv1CustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
||
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
private
|
||
FInt, PFInt: Integer;
|
||
procedure InitGrid();
|
||
procedure InitForm();
|
||
function DelData(): Boolean;
|
||
{ Private declarations }
|
||
public
|
||
fDParameters1: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmSXCKOutListDBCK: TfrmSXCKOutListDBCK;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, U_ZDYHelp;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmSXCKOutListDBCK.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmSXCKOutListDBCK := nil;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.FormCreate(Sender: TObject);
|
||
begin
|
||
ScrollBox1.Align := alClient;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid(self.Caption, Tv1, 'ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Get_Contract_copy1');
|
||
sql.Add('@begdate=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + ''' ');
|
||
sql.Add(',@enddate=''' + Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)) + ''' ');
|
||
sql.Add(',@conType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(',@status=''' + inttostr(cxTabControl1.TabIndex) + ''' ');
|
||
// ShowMessage(SQL.text);
|
||
{ sql.Add('select *,fromConNo=(select Top 1 conNo from Contract_Main X where X.MainID=A.fromMainID) ');
|
||
sql.Add('from Contract_Main A');
|
||
sql.Add('inner join Contract_sub B on B.MainID=A.mainID ');
|
||
sql.Add('where A.FillTime>= '''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.DateTime))+''' ');
|
||
sql.Add('and A.FillTime< '''+Trim(FormatDateTime('yyyy-MM-dd',endDate.DateTime+1))+''' ');
|
||
sql.Add('and A.conType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
IF cxTabControl1.TabIndex<2 then
|
||
sql.Add('and isnull(B.C_status,''0'')='''+inttostr(cxTabControl1.TabIndex)+''' '); }
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
TBFind.Click;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.InitForm();
|
||
begin
|
||
if fDParameters1 = '<27><>ѯ' then
|
||
begin
|
||
TBADD.Visible := false;
|
||
// TBEdit.Visible:=false;
|
||
TBDel.Visible := false;
|
||
// Tchk.Visible:=false;
|
||
// TNochk.Visible:=false;
|
||
Tth.Visible := false;
|
||
v1Price.Visible := false;
|
||
v1Price.Hidden := true;
|
||
v1money.Visible := false;
|
||
v1money.Hidden := true;
|
||
v1T_money.Visible := false;
|
||
v1T_money.Hidden := true;
|
||
ToolButton1.Visible := false;
|
||
end;
|
||
|
||
TBEdit.Enabled := false;
|
||
TBDel.Enabled := false;
|
||
Tchk.Enabled := false;
|
||
TNochk.Enabled := false;
|
||
Tth.Enabled := false;
|
||
if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
TBEdit.Enabled := true;
|
||
TBDel.Enabled := true;
|
||
Tchk.Enabled := true;
|
||
Tth.Enabled := true;
|
||
end;
|
||
if cxTabControl1.TabIndex = 1 then
|
||
begin
|
||
TNochk.Enabled := true;
|
||
end;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.TBEditClick(Sender: TObject);
|
||
var
|
||
i: integer;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select YFID from YF_money_CR ');
|
||
sql.Add('where mainID=''' + trim(Order_Main.FieldByName('mainID').AsString) + ''' ');
|
||
sql.Add('and status>0 ');
|
||
open;
|
||
if not IsEmpty then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
end;
|
||
// try
|
||
// frmClothContractInPut:=TfrmClothContractInPut.Create(Application);
|
||
// with frmClothContractInPut do
|
||
// begin
|
||
// if trim(fDParameters1)='<27><>ѯ' then
|
||
// begin
|
||
// frmClothContractInPut.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ';
|
||
// v1Money.Visible:=false;
|
||
// v1Price.Visible:=false;
|
||
// v1Money.Hidden:=true;
|
||
// v1Price.Hidden:=true;
|
||
// v1T_money.Visible:=false;
|
||
// v1T_money.Hidden:=true;
|
||
// v1T_price.Visible:=false;
|
||
// v1T_price.Hidden:=true;
|
||
// ScrollBox1.Enabled:=false;
|
||
// for i:=0 to tv1.ColumnCount -1 do
|
||
// begin
|
||
// tv1.Columns[i].Options.Editing:=false;
|
||
// end;
|
||
// v1Mrate.Options.Editing:=true;
|
||
// ToolBar2.Enabled:=false;
|
||
// end;
|
||
// PState:=1;
|
||
// FMainId:=Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
// if ShowModal=1 then
|
||
// begin
|
||
// // TBRafresh.Click;
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmClothContractInPut.Free;
|
||
// TBRafresh.Click;
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.TBDelClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select YFID from YF_money_CR ');
|
||
sql.Add('where mainID=''' + trim(Order_Main.FieldByName('mainID').AsString) + ''' ');
|
||
sql.Add('and status>0 ');
|
||
open;
|
||
if not IsEmpty then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
if trim(Order_Main.FieldByName('mainID').AsString) = 'CM001' then
|
||
exit;
|
||
if DelData() then
|
||
begin
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
|
||
function TfrmSXCKOutListDBCK.DelData(): Boolean;
|
||
begin
|
||
try
|
||
Result := false;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete YF_Money_CR where MainID=''' + Trim(Order_Main.fieldbyname('MainID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
// sql.Add(' where CRID='+CRID);
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Contract_Sub where SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Sub where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Contract_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
if Trim(Order_Main.fieldbyname('SubId').AsString) = '' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Contract_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
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 TfrmSXCKOutListDBCK.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
Exit;
|
||
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', cxGrid1);
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.TBPrintClick(Sender: TObject);
|
||
var
|
||
fPrintFile, FConNoM: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.rmf';
|
||
with ADOQueryTemp do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select *,fromConNo=(select Top 1 conNo from Contract_Main X where X.MainID=A.fromMainID) ');
|
||
sql.Add('from Contract_Main A');
|
||
sql.Add('inner join Contract_sub B on B.MainID=A.mainID ');
|
||
sql.Add('where A.FillTime>= ''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + ''' ');
|
||
sql.Add('and A.FillTime< ''' + Trim(FormatDateTime('yyyy-MM-dd', endDate.DateTime + 1)) + ''' ');
|
||
sql.Add('and A.mainID=' + quotedstr(trim(Order_Main.fieldbyname('MainID').AsString)));
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_PRT);
|
||
SInitCDSData20(ADOQueryTemp, CDS_PRT);
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['dtxz'] := formatdateTime('yyyy-MM-dd', Now);
|
||
RMVariables['zdr'] := Trim(dName);
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.rmf'), '<27><>ʾ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.TBAddClick(Sender: TObject);
|
||
var
|
||
i: integer;
|
||
begin
|
||
// try
|
||
// frmClothContractInPut:=TfrmClothContractInPut.Create(Application);
|
||
// with frmClothContractInPut do
|
||
// begin
|
||
// if trim(fDParameters1)='<27><>ѯ' then
|
||
// begin
|
||
// frmClothContractInPut.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ';
|
||
// v1Money.Visible:=false;
|
||
// v1Price.Visible:=false;
|
||
// v1Money.Hidden:=true;
|
||
// v1Price.Hidden:=true;
|
||
// v1T_money.Visible:=false;
|
||
// v1T_money.Hidden:=true;
|
||
// ScrollBox1.Enabled:=false;
|
||
// for i:=0 to tv1.ColumnCount -2 do
|
||
// begin
|
||
// tv1.Columns[i].Options.Editing:=false;
|
||
// end;
|
||
// v1Mrate.Options.Editing:=true;
|
||
// ToolBar2.Enabled:=false;
|
||
// end;
|
||
// PState:=0;
|
||
// FMainId:='';
|
||
// if ShowModal=1 then
|
||
// begin
|
||
//
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmClothContractInPut.Free;
|
||
// TBRafresh.Click;
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.ConNoChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid(self.Caption, Tv1, 'ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
BegDate.DateTime := SGetServerDate10(ADOQueryTemp) - 7;
|
||
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
||
initForm();
|
||
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.Tv2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
FInt := 2;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
FInt := 1;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.ToolButton5Click(Sender: TObject);
|
||
var
|
||
maxno: string;
|
||
begin
|
||
if ClientDataSet3.IsEmpty then
|
||
Exit;
|
||
if ClientDataSet2.IsEmpty then
|
||
Exit;
|
||
if Trim(ClientDataSet2.fieldbyname('MXId').AsString) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δȷ<CEB4><C8B7><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if ClientDataSet3.Locate('OrderNo', null, []) then
|
||
begin
|
||
Application.MessageBox('ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
BegDate.SetFocus;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
//<2F><><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD>
|
||
with ClientDataSet3 do
|
||
begin
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if Trim(ClientDataSet3.fieldbyname('ToId').AsString) = '' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd, maxno, 'To', 'Contract_Sub_MxTo', 4, 1) = False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡȥ<C8A1><C8A5><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(ClientDataSet3.fieldbyname('ToId').AsString);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Sub_MxTo where ToId=''' + Trim(ClientDataSet3.fieldbyname('ToId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(ClientDataSet3.fieldbyname('ToId').AsString) = '' then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('MxId').Value := Trim(ClientDataSet2.fieldbyname('MxId').AsString);
|
||
FieldByName('ToId').Value := Trim(maxno);
|
||
FieldByName('OrdSubId').Value := Trim(ClientDataSet3.fieldbyname('OrdSubId').AsString);
|
||
FieldByName('TPDate').Value := ClientDataSet3.fieldbyname('TPDate').Value;
|
||
FieldByName('TPPerson').Value := ClientDataSet3.fieldbyname('TPPerson').Value;
|
||
FieldByName('TPNote').Value := ClientDataSet3.fieldbyname('TPNote').Value;
|
||
if Trim(ClientDataSet3.fieldbyname('TPQty').AsString) <> '' then
|
||
FieldByName('TPQty').Value := ClientDataSet3.fieldbyname('TPQty').Value
|
||
else
|
||
FieldByName('TPQty').Value := 0;
|
||
if Trim(ClientDataSet3.fieldbyname('Qty1').AsString) <> '' then
|
||
FieldByName('Qty1').Value := ClientDataSet3.fieldbyname('Qty1').Value
|
||
else
|
||
FieldByName('Qty1').Value := 0;
|
||
if Trim(ClientDataSet3.fieldbyname('Qty2').AsString) <> '' then
|
||
FieldByName('Qty2').Value := ClientDataSet3.fieldbyname('Qty2').Value
|
||
else
|
||
FieldByName('Qty2').Value := 0;
|
||
if Trim(ClientDataSet3.fieldbyname('Qty3').AsString) <> '' then
|
||
FieldByName('Qty3').Value := ClientDataSet3.fieldbyname('Qty3').Value
|
||
else
|
||
FieldByName('Qty3').Value := 0;
|
||
Post;
|
||
end;
|
||
with ClientDataSet3 do
|
||
begin
|
||
Edit;
|
||
FieldByName('ToId').Value := Trim(maxno);
|
||
Post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
if FInt = 2 then
|
||
begin
|
||
if ClientDataSet2.IsEmpty then
|
||
Exit;
|
||
if ClientDataSet3.IsEmpty = false then
|
||
begin
|
||
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(ClientDataSet2.fieldbyname('MxId').AsString) <> '' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Contract_Sub_Mx where MxId=''' + Trim(ClientDataSet2.fieldbyname('MxId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
ClientDataSet2.Delete;
|
||
end
|
||
else if FInt = 3 then
|
||
begin
|
||
if ClientDataSet3.IsEmpty then
|
||
Exit;
|
||
if Trim(ClientDataSet3.fieldbyname('ToId').AsString) <> '' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Contract_Sub_MxTo where ToId=''' + Trim(ClientDataSet3.fieldbyname('ToId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
ClientDataSet3.Delete;
|
||
with ClientDataSet2 do
|
||
begin
|
||
Edit;
|
||
if ClientDataSet3.IsEmpty = False then
|
||
// FieldByName('KCSL').Value:=ClientDataSet2.fieldbyname('MxQty').Value-tv3.DataController.Summary.FooterSummaryValues[0]
|
||
|
||
else
|
||
FieldByName('KCSL').Value := ClientDataSet2.fieldbyname('MxQty').Value;
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.v2Column3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'RKPlace';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
with ClientDataSet2 do
|
||
begin
|
||
Edit;
|
||
FieldByName('RKPlace').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.conPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
{ if Key=#13 then
|
||
begin
|
||
if Length(Trim(ConNoM.Text))<4 then Exit;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec ClothContract_QryList :MainId,:WSql');
|
||
Parameters.ParamByName('WSql').Value:=' and OM.conNo like '''+'%'+Trim(ConNoM.Text)+'%'+'''';
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,Order_Main);
|
||
SInitCDSData20(ADOQueryMain,Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
// if Order_Main.IsEmpty then Exit;
|
||
// try
|
||
// frmClothContractInPut:=TfrmClothContractInPut.Create(Application);
|
||
// with frmClothContractInPut do
|
||
// begin
|
||
// PState:=3;
|
||
// TBSave.Enabled:=false;
|
||
// FMainId:=Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
// if ShowModal=1 then
|
||
// begin
|
||
//
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmClothContractInPut.Free;
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
ToolButton1.Click;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.TthClick(Sender: TObject);
|
||
begin
|
||
// if Order_Main.IsEmpty then Exit;
|
||
// try
|
||
// frmClothContractInPut:=TfrmClothContractInPut.Create(Application);
|
||
// with frmClothContractInPut do
|
||
// begin
|
||
// Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>';
|
||
// PState:=1;
|
||
// v1T_money.Visible:=true;
|
||
// v1T_ps.Visible:=true;
|
||
// v1T_Qty.Visible:=true;
|
||
// v1T_Price.Visible:=true;
|
||
// FMainId:=Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
// if ShowModal=1 then
|
||
// begin
|
||
// TBRafresh.Click;
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmClothContractInPut.Free;
|
||
// TBRafresh.Click;
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.tchkClick(Sender: TObject);
|
||
var
|
||
maxno: string;
|
||
begin
|
||
// IF Order_Main.IsEmpty then exit;
|
||
if Order_Main.Locate('ssel', true, []) = false then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with Order_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if Fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
|
||
if GetLSNo(ADOQueryCmd, maxno, 'DB', 'CK_SXPB_CR', 4, 1) = False then
|
||
begin
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⵥ<EFBFBD><E2B5A5>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_SXPB_CR where 1<>1');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Append;
|
||
// FieldByName('SPID').Value := CRID;
|
||
FieldByName('SPID').Value := Trim(maxno);
|
||
FieldByName('FZSPID').Value := Trim(maxno);
|
||
FieldByName('CRTime').Value := FormatDateTime('yyyy-MM-dd', SGetServerDateTime(ADOQueryTemp));
|
||
FieldByName('CRType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('FactoryName').Value := Trim(Order_Main.fieldbyname('JHPlace').AsString);
|
||
FieldByName('ToFactoryName').Value := Trim(Order_Main.fieldbyname('ToFactoryName').AsString);
|
||
// FieldByName('C_Code').Value := Trim(Order_Main.fieldbyname('C_Code').AsString);
|
||
|
||
FieldByName('mainid').Value := Order_Main.fieldbyname('mainid').AsString;
|
||
FieldByName('subid').Value := Trim(Order_Main.fieldbyname('subid').AsString);
|
||
FieldByName('SPCode').Value := Trim(Order_Main.fieldbyname('C_Code').AsString);
|
||
FieldByName('SPName').Value := Trim(Order_Main.fieldbyname('C_CodeName').AsString);
|
||
FieldByName('SPSpec').Value := Trim(Order_Main.fieldbyname('C_Spec').AsString);
|
||
// FieldByName('SPCF').Value := Trim(Order_Main.fieldbyname(' ').AsString);
|
||
FieldByName('SPMF').Value := Trim(Order_Main.fieldbyname('MF').AsString);
|
||
FieldByName('SPKZ').Value := Trim(Order_Main.fieldbyname('KZ').AsString);
|
||
|
||
FieldByName('PiQty').Value := Order_Main.fieldbyname('Qty1').Value;
|
||
FieldByName('Qty').Value := Order_Main.fieldbyname('T_Qty').Value;
|
||
FieldByName('QtyUnit').Value := Order_Main.fieldbyname('C_Unit').Value;
|
||
|
||
FieldByName('MXKCQty').Value := Order_Main.fieldbyname('T_Qty').Value;
|
||
FieldByName('MXKCPiQty').Value := Order_Main.fieldbyname('Qty1').Value;
|
||
FieldByName('MXKCKGQty').Value := Order_Main.fieldbyname('T_Qty').Value;
|
||
|
||
FieldByName('Price').Value := Order_Main.fieldbyname('Price').Value;
|
||
FieldByName('Money').Value := Order_Main.fieldbyname('Money').Value;
|
||
FieldByName('CKName').Value := '<27><><EFBFBD><EFBFBD>';
|
||
FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
||
FieldByName('CRQtyFlag').Value := 1;
|
||
FieldByName('Note').Value := Order_Main.fieldbyname('C_Note').Value;
|
||
// fieldbyname('kcKw').Value := GetKw(ADOQueryTemp, Order_Main.fieldbyname('C_CodeName').AsString, Order_Main.fieldbyname('PRTColor').AsString);
|
||
Post;
|
||
end;
|
||
// with ADOQueryCmd do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add('Update CK_SXPB_CR Set MXKCQty=(select sum(isnull(Qty,0)*CRQtyFlag) from CK_SXPB_CR A where A.FZSPID=CK_SXPB_CR.SPID)');
|
||
// sql.Add(',MXKCPiQty=(select sum(isnull(PiQty,0)*CRQtyFlag) from CK_SXPB_CR A where A.FZSPID=CK_SXPB_CR.SPID)');
|
||
// sql.Add(',MXKCKGQty=(select sum(isnull(kgQty,0)*CRQtyFlag) from CK_SXPB_CR A where A.FZSPID=CK_SXPB_CR.SPID)');
|
||
// sql.Add(' where SPID=''' + Trim(maxno) + '''');
|
||
// ShowMessage(SQL.text);
|
||
// ExecSQL;
|
||
// end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Contract_Main SET status=''1'' ');
|
||
sql.Add('where mainID =' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
// sql.Add('and subID ='+quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
|
||
execsql;
|
||
end;
|
||
end;
|
||
next;
|
||
end;
|
||
First;
|
||
EnableControls;
|
||
end;
|
||
|
||
InitGrid();
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
|
||
|
||
|
||
// try
|
||
// frmClothContractInPut:=TfrmClothContractInPut.Create(Application);
|
||
// with frmClothContractInPut do
|
||
// begin
|
||
// PState:=1;
|
||
// FMainId:=Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
// if ShowModal=1 then
|
||
// begin
|
||
// with self.ADOQueryCmd do
|
||
// begin
|
||
// close;
|
||
// sql.Clear;
|
||
// sql.Add('update Contract_sub SET C_status=''1'' ');
|
||
// sql.Add('where mainID ='+quotedstr(trim(self.Order_Main.fieldbyname('mainID').AsString)));
|
||
// sql.Add('and subID ='+quotedstr(trim(self.Order_Main.fieldbyname('subID').AsString)));
|
||
// execsql;
|
||
// end;
|
||
// self.InitGrid();
|
||
// end
|
||
// else
|
||
// begin
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmClothContractInPut.Free;
|
||
// // TBRafresh.Click;
|
||
// end;
|
||
{ if Order_Main.Locate('ssel',true,[])=false then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
|
||
|
||
{ with Order_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
IF Fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Contract_sub SET C_status=''1'' ');
|
||
sql.Add('where mainID ='+quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
sql.Add('and subID ='+quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
|
||
execsql;
|
||
end;
|
||
end;
|
||
next;
|
||
end;
|
||
First;
|
||
EnableControls;
|
||
end;
|
||
|
||
InitGrid();
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.TnochkClick(Sender: TObject);
|
||
begin
|
||
// if Order_Main.IsEmpty then
|
||
// exit;
|
||
if Order_Main.Locate('ssel', true, []) = false then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
// try
|
||
// ADOQueryCmd.Connection.BeginTrans;
|
||
// with ADOQueryCmd do
|
||
// begin
|
||
// close;
|
||
// sql.Clear;
|
||
// sql.Add('update Contract_main SET status=''0'' ');
|
||
// sql.Add('where mainID =' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
//// sql.Add('and subID =' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
|
||
// execsql;
|
||
// end;
|
||
with Order_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if Fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Contract_Main SET status=''0'' ');
|
||
sql.Add('where mainID =' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
// sql.Add('and subID =' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
|
||
execsql;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete CK_SXPB_CR');
|
||
sql.Add('where mainID =' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
sql.Add('and subID =' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
next;
|
||
end;
|
||
First;
|
||
EnableControls;
|
||
end;
|
||
|
||
InitGrid();
|
||
// ADOQueryCmd.Connection.CommitTrans;
|
||
// except
|
||
// ADOQueryCmd.Connection.RollbackTrans;
|
||
// application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.Tv1CustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
||
var
|
||
FValue: string;
|
||
FBounds: TRect;
|
||
begin
|
||
FBounds := AViewInfo.Bounds;
|
||
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
|
||
begin
|
||
ACanvas.FillRect(FBounds);
|
||
ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);
|
||
FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index + 1);
|
||
InflateRect(FBounds, -1, -1);
|
||
ACanvas.Font.Color := clBlack;
|
||
ACanvas.Brush.Style := bsClear;
|
||
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
|
||
ADone := True;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
begin
|
||
if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('H_PS').Index] >= AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('Qty1').Index] then
|
||
begin
|
||
ACanvas.Brush.Color := clSkyBlue;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSXCKOutListDBCK.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
initForm();
|
||
end;
|
||
|
||
end.
|
||
|