D7wmbeiqi/贝其贸易管理/U_ClothContractList.pas

830 lines
25 KiB
ObjectPascal
Raw Normal View History

2025-04-30 16:20:38 +08:00
unit U_ClothContractList;
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,
2025-11-21 09:37:23 +08:00
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,
cxDropDownEdit, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,
dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee,
dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven,
dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
dxSkinXmas2008Blue, dxSkinscxPCPainter, cxNavigator, dxBarBuiltInMenu;
2025-04-30 16:20:38 +08:00
type
TfrmClothContractList = 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_CodeNameM: TEdit;
TBExport: TToolButton;
Order_Main: TClientDataSet;
Label4: TLabel;
C_Spec: TEdit;
ScrollBox1: TScrollBox;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1OrderNo: TcxGridDBColumn;
v1DeliveryDate: TcxGridDBColumn;
v1FactoryNo1Name: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
ClientDataSet3: TClientDataSet;
DataSource2: TDataSource;
DataSource3: TDataSource;
ClientDataSet2: TClientDataSet;
RM1: TRMGridReport;
RMDBMain: TRMDBDataSet;
RMXLSExport1: TRMXLSExport;
v1Column4: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
CDS_PRT: TClientDataSet;
cxTabControl1: TcxTabControl;
Tchk: TToolButton;
TNochk: TToolButton;
FactoryNoName: TEdit;
Label6: TLabel;
v1Column1: TcxGridDBColumn;
ToolButton1: TToolButton;
cxGrid2: TcxGrid;
TV2: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
cxGridDBColumn2: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
cxGridDBColumn5: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
v1ClothQty: TcxGridDBColumn;
cxGridDBColumn7: TcxGridDBColumn;
v1ClothUnit: TcxGridDBColumn;
cxGridDBColumn8: TcxGridDBColumn;
cxGridDBColumn9: TcxGridDBColumn;
cxGridDBColumn10: TcxGridDBColumn;
cxGridDBColumn11: TcxGridDBColumn;
cxGridDBColumn12: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
v1Column13: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
cxGridDBColumn13: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
cxSplitter1: TcxSplitter;
ADOQuerySub: TADOQuery;
DSsub: TDataSource;
v1Column2: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
v1Column6: TcxGridDBColumn;
cxGridPopupMenu2: TcxGridPopupMenu;
SQNO: TEdit;
Label7: TLabel;
Panel4: TPanel;
Label14: TLabel;
Panel10: TPanel;
Image2: TImage;
Button1: TButton;
RadioGroup1: TRadioGroup;
2025-11-21 09:37:23 +08:00
TReview: TToolButton;
TnoReview: TToolButton;
2025-04-30 16:20:38 +08:00
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);
2025-11-21 09:37:23 +08:00
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
procedure Tv2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure Tv3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure Tv2CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-04-30 16:20:38 +08:00
procedure ToolButton5Click(Sender: TObject);
2025-11-21 09:37:23 +08:00
procedure v2Column3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
2025-04-30 16:20:38 +08:00
procedure conPress(Sender: TObject; var Key: Char);
2025-11-21 09:37:23 +08:00
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-04-30 16:20:38 +08:00
procedure TchkClick(Sender: TObject);
procedure TNochkClick(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
2025-11-21 09:37:23 +08:00
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
2025-04-30 16:20:38 +08:00
procedure ToolButton1Click(Sender: TObject);
2025-11-21 09:37:23 +08:00
procedure Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-04-30 16:20:38 +08:00
procedure Image2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure SQNOKeyPress(Sender: TObject; var Key: Char);
2025-11-21 09:37:23 +08:00
procedure TReviewClick(Sender: TObject);
procedure TnoReviewClick(Sender: TObject);
2025-04-30 16:20:38 +08:00
private
2025-11-21 09:37:23 +08:00
FInt, PFInt: Integer;
2025-04-30 16:20:38 +08:00
procedure InitGrid();
procedure InitForm();
2025-11-21 09:37:23 +08:00
function DelData(): Boolean;
2025-04-30 16:20:38 +08:00
procedure SetStatus();
procedure InitSub();
{ Private declarations }
public
2025-11-21 09:37:23 +08:00
FType: string;
2025-04-30 16:20:38 +08:00
{ Public declarations }
end;
var
frmClothContractList: TfrmClothContractList;
implementation
2025-11-21 09:37:23 +08:00
2025-04-30 16:20:38 +08:00
uses
2025-11-21 09:37:23 +08:00
U_DataLink, U_ClothContractInPutPB, U_Fun, U_ProductOrderList, U_ZDYHelp,
2025-04-30 16:20:38 +08:00
U_FjList_RZ;
{$R *.dfm}
procedure TfrmClothContractList.InitSub();
begin
ADOQuerySub.Close;
2025-11-21 09:37:23 +08:00
if Order_Main.IsEmpty then
exit;
2025-04-30 16:20:38 +08:00
with ADOQuerySub do
begin
close;
sql.Clear;
sql.Add('select * from Contract_Sub ');
2025-11-21 09:37:23 +08:00
sql.Add('where mainID =' + quotedstr((Order_Main.fieldbyname('mainID').AsString)));
2025-04-30 16:20:38 +08:00
open;
end;
end;
procedure TfrmClothContractList.SetStatus();
begin
2025-11-21 09:37:23 +08:00
TBAdd.Visible := false;
tchk.Visible := false;
tnochk.Visible := false;
TReview.Visible := false;
tnoReview.Visible := false;
tbedit.Visible := false;
tbdel.Visible := false;
if FType = '' then
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
if Trim(DParameters1) = '<27><>Ȩ<EFBFBD><C8A8>' then
begin
case cxTabControl1.TabIndex of
0:
begin
TReview.Visible := true;
tbedit.Visible := true;
tbdel.Visible := true;
TBAdd.Visible := true;
end;
1:
begin
tnoReview.Visible := true;
end;
2025-04-30 16:20:38 +08:00
end;
2025-11-21 09:37:23 +08:00
end
else
begin
case cxTabControl1.TabIndex of
0:
begin
tbedit.Visible := true;
tbdel.Visible := true;
TBAdd.Visible := true;
end;
1:
begin
end;
2025-04-30 16:20:38 +08:00
end;
end;
2025-11-21 09:37:23 +08:00
2025-04-30 16:20:38 +08:00
end;
2025-11-21 09:37:23 +08:00
if FType = '<27><>ѯ' then
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
Tbadd.Visible := false;
TBPrint.Visible := false;
2025-04-30 16:20:38 +08:00
//v1Price.Visible:=false;
// v1PriceUnit.Visible:=false;
// v1Money.Visible:=false;
// v1Price.Hidden:=true;
// v1PriceUnit.Hidden:=true;
// v1Money.Hidden:=true;
2025-11-21 09:37:23 +08:00
cxTabControl1.TabIndex := 2;
cxTabControl1.Visible := false;
2025-04-30 16:20:38 +08:00
end;
end;
procedure TfrmClothContractList.FormDestroy(Sender: TObject);
begin
2025-11-21 09:37:23 +08:00
frmClothContractList := nil;
2025-04-30 16:20:38 +08:00
end;
2025-11-21 09:37:23 +08:00
procedure TfrmClothContractList.FormClose(Sender: TObject; var Action: TCloseAction);
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
Action := caFree;
2025-04-30 16:20:38 +08:00
end;
procedure TfrmClothContractList.FormCreate(Sender: TObject);
begin
2025-11-21 09:37:23 +08:00
ScrollBox1.Align := alClient;
2025-04-30 16:20:38 +08:00
end;
procedure TfrmClothContractList.TBCloseClick(Sender: TObject);
begin
Close;
2025-11-21 09:37:23 +08:00
WriteCxGrid(self.Caption + tv1.Name + '1', Tv1, ʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid(self.Caption + tv2.Name, Tv2, ʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
2025-04-30 16:20:38 +08:00
end;
procedure TfrmClothContractList.InitGrid();
2025-11-21 09:37:23 +08:00
var
strwhere: string;
begin
strwhere := ' where QDTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''' + ' and QDTime<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1)) + '''' + ' and HTType=''<27>ɹ<EFBFBD><C9B9><EFBFBD>ͬ''';
// if cxTabControl1.TabIndex = 0 then
// strwhere := strwhere + ' and isnull(C_status,''0'')=''0'' ';
// if cxTabControl1.TabIndex = 1 then
// strwhere := strwhere + ' and isnull(C_status,''0'')=''1'' ';
// if cxTabControl1.TabIndex < 2 then
// begin
// strwhere := strwhere + ' and isnull(A.ChkStatus,''0'')=''' + inttostr(cxTabControl1.TabIndex) + '''';
// end;
2025-04-30 16:20:38 +08:00
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
2025-11-21 09:37:23 +08:00
Filtered := False;
2025-04-30 16:20:38 +08:00
Close;
sql.Clear;
sql.Add(' select A.* ');
sql.Add(' from Contract_Main A');
2025-11-21 09:37:23 +08:00
sql.Add(' where QDTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + ''' ');
sql.Add(' and QDTime<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1)) + ''' ');
2025-04-30 16:20:38 +08:00
sql.Add(' and HTType=''<27>ɹ<EFBFBD><C9B9><EFBFBD>ͬ'' ');
2025-11-21 09:37:23 +08:00
if cxTabControl1.TabIndex = 0 then
sql.Add(' and isnull(A.ChkStatus,''0'')=''0'' ');
if cxTabControl1.TabIndex = 1 then
sql.Add(' and isnull(A.ChkStatus,''0'')=''1'' ');
2025-04-30 16:20:38 +08:00
Open;
end;
2025-11-21 09:37:23 +08:00
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
2025-04-30 16:20:38 +08:00
finally
ADOQueryMain.EnableControls;
TBFind.Click;
end;
end;
procedure TfrmClothContractList.InitForm();
begin
2025-11-21 09:37:23 +08:00
ReadCxGrid(self.Caption + tv1.Name + '1', Tv1, ʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
ReadCxGrid(self.Caption + tv2.Name, Tv2, ʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
cxTabControl1.TabIndex := 0;
if Trim(DParameters1) = '1' then
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
TBPrint.Visible := False;
end
else
2025-04-30 16:20:38 +08:00
begin
// v1Column1.Visible:=True;
// v1Column1.Hidden:=False;
// v1PRTUnit.Visible:=True;
// v1PRTUnit.Hidden:=False;
// v1PRTQty.Visible:=True;
// v1PRTQty.Hidden:=False;
2025-11-21 09:37:23 +08:00
TBPrint.Visible := True;
2025-04-30 16:20:38 +08:00
end;
2025-11-21 09:37:23 +08:00
BegDate.DateTime := SGetServerDate10(ADOQueryTemp) - 7;
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
2025-04-30 16:20:38 +08:00
InitGrid();
end;
procedure TfrmClothContractList.TBFindClick(Sender: TObject);
begin
2025-11-21 09:37:23 +08:00
if ADOQueryMain.Active = False then
Exit;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
2025-04-30 16:20:38 +08:00
end;
procedure TfrmClothContractList.TBEditClick(Sender: TObject);
begin
2025-11-21 09:37:23 +08:00
if Order_Main.IsEmpty then
Exit;
2025-04-30 16:20:38 +08:00
try
2025-11-21 09:37:23 +08:00
frmClothContractInPutPB := TfrmClothContractInPutPB.Create(Application);
2025-04-30 16:20:38 +08:00
with frmClothContractInPutPB do
begin
2025-11-21 09:37:23 +08:00
PState := 1;
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
FConNo := Trim(Self.Order_Main.fieldbyname('ConNo').AsString);
if ShowModal = 1 then
2025-04-30 16:20:38 +08:00
begin
InitGrid();
end;
end;
finally
frmClothContractInPutPB.Free;
end;
end;
procedure TfrmClothContractList.TBDelClick(Sender: TObject);
begin
2025-11-21 09:37:23 +08:00
if Order_Main.IsEmpty then
Exit;
if ClientDataSet2.IsEmpty = false then
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
Application.MessageBox('<27>ѵ<EFBFBD><D1B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>', '<27><>ʾ', 0);
2025-04-30 16:20:38 +08:00
Exit;
end;
2025-11-21 09:37:23 +08:00
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
2025-04-30 16:20:38 +08:00
if DelData() then
begin
//TBRafresh.Click;
//TBFind.Click;
Order_Main.Delete;
end;
end;
2025-11-21 09:37:23 +08:00
function TfrmClothContractList.DelData(): Boolean;
2025-04-30 16:20:38 +08:00
begin
try
2025-11-21 09:37:23 +08:00
Result := false;
2025-04-30 16:20:38 +08:00
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryTemp do
begin
Close;
sql.Clear;
2025-11-21 09:37:23 +08:00
sql.Add('delete from Contract_Sub where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
sql.Add('delete Contract_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
2025-04-30 16:20:38 +08:00
execsql;
end;
ADOQueryCmd.Connection.CommitTrans;
2025-11-21 09:37:23 +08:00
Result := True;
2025-04-30 16:20:38 +08:00
except
ADOQueryCmd.Connection.RollbackTrans;
2025-11-21 09:37:23 +08:00
Result := False;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
2025-04-30 16:20:38 +08:00
end;
end;
procedure TfrmClothContractList.TBExportClick(Sender: TObject);
begin
2025-11-21 09:37:23 +08:00
if ADOQueryMain.IsEmpty then
Exit;
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', cxGrid1);
2025-04-30 16:20:38 +08:00
end;
procedure TfrmClothContractList.TBPrintClick(Sender: TObject);
var
2025-11-21 09:37:23 +08:00
fPrintFile, FConNoM: string;
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
if Order_Main.IsEmpty then
Exit;
2025-04-30 16:20:38 +08:00
2025-11-21 09:37:23 +08:00
Panel4.Left := (self.Width - Panel4.Width) div 2;
Panel4.Visible := true;
2025-04-30 16:20:38 +08:00
{ 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('exec ClothContract_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))+'''';
Parameters.ParamByName('MainId').Value:=Trim(Order_Main.fieldbyname('MainId').AsString);
Parameters.ParamByName('WSql').Value:='';
Open;
end;
SCreateCDS20(ADOQueryTemp,CDS_PRT);
SInitCDSData20(ADOQueryTemp,CDS_PRT);
FConNoM:=Trim(CDS_PRT.fieldbyname('ConNoM').AsString);
if FileExists(fPrintFile) then
begin
//RMVariables['begindate']:=begindate.DateTime;
//RMVariables['enddate']:=enddate.DateTime;
//RMVariables['printtime']:=Now;
//RMVariables['printer']:=Trim(gUserName);
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 TfrmClothContractList.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmClothContractList.TBAddClick(Sender: TObject);
begin
try
2025-11-21 09:37:23 +08:00
frmClothContractInPutPB := TfrmClothContractInPutPB.Create(Application);
2025-04-30 16:20:38 +08:00
with frmClothContractInPutPB do
begin
2025-11-21 09:37:23 +08:00
PState := 0;
FMainId := '';
if ShowModal = 1 then
2025-04-30 16:20:38 +08:00
begin
InitGrid();
end;
end;
finally
frmClothContractInPutPB.Free;
end;
end;
procedure TfrmClothContractList.ConNoChange(Sender: TObject);
begin
2025-11-21 09:37:23 +08:00
if ADOQueryMain.Active = False then
Exit;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
2025-04-30 16:20:38 +08:00
end;
procedure TfrmClothContractList.FormShow(Sender: TObject);
begin
InitForm();
SetStatus();
end;
2025-11-21 09:37:23 +08:00
procedure TfrmClothContractList.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
2025-04-30 16:20:38 +08:00
begin
{ with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('select A.*,KCSL=A.MXQty-(select isnull(Sum(TPQty),0) from Contract_Sub_Mxto B where B.MXID=A.MXID),');
sql.Add(' KCPS=A.Qty1-(select isnull(Sum(Qty1),0) from Contract_Sub_Mxto B where B.MXID=A.MXID)');
sql.Add('from Contract_Sub_Mx A');
sql.Add(' where A.SubId='''+Trim(Order_Main.fieldbyname('SubId').AsString)+'''');
Open;
end;
SCreateCDS20(ADOQueryTemp,ClientDataSet2);
SInitCDSData20(ADOQueryTemp,ClientDataSet2);
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('select A.*,C.MPRTSpec,B.PRTColor,C.MPRTCodeName,C.OrderNo ,');
sql.Add('C_Unit=(select Top 1 C_Unit from Contract_Sub AA,Contract_Sub_Mx BB where AA.SubId=BB.SubId and BB.MXid=A.Mxid)');
SQL.Add('from Contract_Sub_MxTo A inner join JYOrder_Sub B on A.OrdSubId=B.SubId');
SQL.Add(' inner join JYOrder_Main C on C.MainId=B.MainId ');
sql.Add('where A.MxId='''+Trim(ClientDataSet2.fieldbyname('MxId').AsString)+'''');
Open;
end;
SCreateCDS20(ADOQueryTemp,ClientDataSet3);
SInitCDSData20(ADOQueryTemp,ClientDataSet3); }
end;
2025-11-21 09:37:23 +08:00
procedure TfrmClothContractList.Tv2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
FInt := 2;
2025-04-30 16:20:38 +08:00
end;
2025-11-21 09:37:23 +08:00
procedure TfrmClothContractList.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
FInt := 1;
2025-04-30 16:20:38 +08:00
end;
2025-11-21 09:37:23 +08:00
procedure TfrmClothContractList.Tv3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
FInt := 3;
2025-04-30 16:20:38 +08:00
end;
2025-11-21 09:37:23 +08:00
procedure TfrmClothContractList.Tv2CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-04-30 16:20:38 +08:00
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('select A.*,C.MPRTSpec,B.PRTColor,C.MPRTCodeName,C.OrderNo ,');
sql.Add('C_Unit=(select Top 1 C_Unit from Contract_Sub AA,Contract_Sub_Mx BB where AA.SubId=BB.SubId and BB.MXid=A.Mxid)');
SQL.Add(' from Contract_Sub_MxTo A inner join JYOrder_Sub B on A.OrdSubId=B.SubId ');
SQL.Add(' inner join JYOrder_Main C on C.MainId=B.MainId ');
2025-11-21 09:37:23 +08:00
sql.Add('where A.MxId=''' + Trim(ClientDataSet2.fieldbyname('MxId').AsString) + '''');
2025-04-30 16:20:38 +08:00
Open;
end;
2025-11-21 09:37:23 +08:00
SCreateCDS20(ADOQueryTemp, ClientDataSet3);
SInitCDSData20(ADOQueryTemp, ClientDataSet3);
2025-04-30 16:20:38 +08:00
end;
procedure TfrmClothContractList.ToolButton5Click(Sender: TObject);
var
2025-11-21 09:37:23 +08:00
maxno: string;
2025-04-30 16:20:38 +08:00
begin
end;
2025-11-21 09:37:23 +08:00
procedure TfrmClothContractList.v2Column3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
2025-04-30 16:20:38 +08:00
begin
try
2025-11-21 09:37:23 +08:00
frmZDYHelp := TfrmZDYHelp.Create(Application);
2025-04-30 16:20:38 +08:00
with frmZDYHelp do
begin
2025-11-21 09:37:23 +08:00
flag := 'RKPlace';
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>';
if ShowModal = 1 then
2025-04-30 16:20:38 +08:00
begin
with ClientDataSet2 do
begin
Edit;
2025-11-21 09:37:23 +08:00
FieldByName('RKPlace').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZDYName').AsString);
2025-04-30 16:20:38 +08:00
end;
end;
end;
finally
frmZDYHelp.Free;
end;
end;
2025-11-21 09:37:23 +08:00
procedure TfrmClothContractList.conPress(Sender: TObject; var Key: Char);
2025-04-30 16:20:38 +08:00
begin
{if Key=#13 then
begin
if Length(Trim(ConNo.Text))<4 then Exit;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('exec ClothContract_QryList :MainId,:WSql');
Parameters.ParamByName('WSql').Value:=' and OM.conNo like '''+'%'+Trim(ConNo.Text)+'%'+''''
+' and HTType=''<27>ɹ<EFBFBD><C9B9><EFBFBD>ͬ''';
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end; }
end;
2025-11-21 09:37:23 +08:00
procedure TfrmClothContractList.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
if Order_Main.IsEmpty then
Exit;
2025-04-30 16:20:38 +08:00
try
2025-11-21 09:37:23 +08:00
frmClothContractInPutPB := TfrmClothContractInPutPB.Create(Application);
2025-04-30 16:20:38 +08:00
with frmClothContractInPutPB do
begin
2025-11-21 09:37:23 +08:00
PState := 1;
ToolBar1.Enabled := false;
ToolBar2.Enabled := false;
Tv1.OptionsData.Editing := false;
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
FConNo := Trim(Self.Order_Main.fieldbyname('ConNoM').AsString);
if ShowModal = 1 then
2025-04-30 16:20:38 +08:00
begin
InitGrid();
end;
end;
finally
frmClothContractInPutPB.Free;
2025-11-21 09:37:23 +08:00
end;
2025-04-30 16:20:38 +08:00
end;
procedure TfrmClothContractList.TchkClick(Sender: TObject);
begin
2025-11-21 09:37:23 +08:00
if Order_Main.IsEmpty then
exit;
2025-04-30 16:20:38 +08:00
try
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update Contract_Sub SET C_status=''1'' ');
2025-11-21 09:37:23 +08:00
sql.Add('where subID=' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
2025-04-30 16:20:38 +08:00
execsql;
end;
2025-11-21 09:37:23 +08:00
application.MessageBox('<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>ɣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
2025-04-30 16:20:38 +08:00
TBRafresh.Click;
except
2025-11-21 09:37:23 +08:00
application.MessageBox('<27>ɹ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
2025-04-30 16:20:38 +08:00
end;
end;
procedure TfrmClothContractList.TNochkClick(Sender: TObject);
begin
2025-11-21 09:37:23 +08:00
if Order_Main.IsEmpty then
exit;
2025-04-30 16:20:38 +08:00
try
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update Contract_Sub SET C_status=''0'' ');
2025-11-21 09:37:23 +08:00
sql.Add('where subID=' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
2025-04-30 16:20:38 +08:00
execsql;
end;
2025-11-21 09:37:23 +08:00
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
2025-04-30 16:20:38 +08:00
TBRafresh.Click;
except
2025-11-21 09:37:23 +08:00
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
2025-04-30 16:20:38 +08:00
end;
end;
procedure TfrmClothContractList.cxTabControl1Change(Sender: TObject);
begin
SetStatus();
TBRafresh.Click;
end;
2025-11-21 09:37:23 +08:00
procedure TfrmClothContractList.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
2025-04-30 16:20:38 +08:00
begin
{ if cxTabControl1.TabIndex=0 then
begin
with Order_Main do
begin
if (AViewInfo.GridRecord.Values[v1MXQty.Index]<
AViewInfo.GridRecord.Values[v1C_Qty.Index]*0.97) or
(AViewInfo.GridRecord.Values[v1MXQty.Index]>
AViewInfo.GridRecord.Values[v1C_Qty.Index]*1.03) then
begin
ACanvas.Font.Color:=clRed;
end;
if AViewInfo.GridRecord.Values[v1DHQty.Index]<
AViewInfo.GridRecord.Values[v1Qty1.Index] then
begin
ACanvas.Font.Color:=clRed;
end;
end;
end; }
end;
procedure TfrmClothContractList.ToolButton1Click(Sender: TObject);
begin
2025-11-21 09:37:23 +08:00
if Order_Main.IsEmpty then
Exit;
2025-04-30 16:20:38 +08:00
try
2025-11-21 09:37:23 +08:00
frmFjList_RZ := TfrmFjList_RZ.Create(Application);
2025-04-30 16:20:38 +08:00
with frmFjList_RZ do
begin
// PState:=1;
2025-11-21 09:37:23 +08:00
// if Trim(canshu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then cxButton1.Visible:=false;
fkeyNO := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
fType := '<27><>ƥ<EFBFBD>ɹ<EFBFBD>';
if ShowModal = 1 then
2025-04-30 16:20:38 +08:00
begin
end;
end;
finally
frmFjList_RZ.Free;
end;
end;
2025-11-21 09:37:23 +08:00
procedure TfrmClothContractList.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
InitSub();
2025-04-30 16:20:38 +08:00
end;
procedure TfrmClothContractList.Image2Click(Sender: TObject);
begin
2025-11-21 09:37:23 +08:00
Panel4.Visible := false;
2025-04-30 16:20:38 +08:00
end;
procedure TfrmClothContractList.Button1Click(Sender: TObject);
var
2025-11-21 09:37:23 +08:00
fPrintFile, FConNoM: string;
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
if Order_Main.IsEmpty then
Exit;
2025-04-30 16:20:38 +08:00
// fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ.rmf' ;
2025-11-21 09:37:23 +08:00
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(RadioGroup1.Items.Strings[RadioGroup1.ItemIndex]) + '.rmf';
2025-04-30 16:20:38 +08:00
with ADOQueryTemp do
begin
Close;
2025-11-21 09:37:23 +08:00
Filtered := False;
2025-04-30 16:20:38 +08:00
sql.Clear;
sql.Add('exec ClothContract_QryList :MainId,:WSql');
2025-11-21 09:37:23 +08:00
Parameters.ParamByName('WSql').Value := ' and FillTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''' + ' and FillTime<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1)) + '''';
Parameters.ParamByName('MainId').Value := Trim(Order_Main.fieldbyname('MainId').AsString);
Parameters.ParamByName('WSql').Value := '';
2025-04-30 16:20:38 +08:00
Open;
end;
2025-11-21 09:37:23 +08:00
SCreateCDS20(ADOQueryTemp, CDS_PRT);
SInitCDSData20(ADOQueryTemp, CDS_PRT);
FConNoM := Trim(CDS_PRT.fieldbyname('ConNoM').AsString);
2025-04-30 16:20:38 +08:00
if FileExists(fPrintFile) then
begin
RM1.LoadFromFile(fPrintFile);
RM1.ShowReport;
2025-11-21 09:37:23 +08:00
end
else
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
Application.MessageBox(PChar(<><C3BB><EFBFBD>ҵ<EFBFBD>' + trim(fPrintFile)), '<27><>ʾ', 0);
2025-04-30 16:20:38 +08:00
end;
end;
2025-11-21 09:37:23 +08:00
procedure TfrmClothContractList.SQNOKeyPress(Sender: TObject; var Key: Char);
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
if Key = #13 then
2025-04-30 16:20:38 +08:00
begin
2025-11-21 09:37:23 +08:00
if trim(SQNo.Text) = '' then
exit;
2025-04-30 16:20:38 +08:00
with ADOQueryMain do
begin
2025-11-21 09:37:23 +08:00
Filtered := False;
2025-04-30 16:20:38 +08:00
Close;
sql.Clear;
sql.Add(' select A.* ');
sql.Add(' from Contract_Main A');
2025-11-21 09:37:23 +08:00
sql.Add(' where SQNO like ''%' + trim(SQNo.Text) + '%'' ');
2025-04-30 16:20:38 +08:00
sql.Add(' and HTType=''<27>ɹ<EFBFBD><C9B9><EFBFBD>ͬ'' ');
Open;
end;
2025-11-21 09:37:23 +08:00
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
end;
end;
procedure TfrmClothContractList.TReviewClick(Sender: TObject);
begin
if Order_Main.IsEmpty then
exit;
try
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update Contract_Main SET ChkStatus=''1'',chktime=getdate(),chker=' + quotedstr(trim(Dname)));
sql.Add('where MainId=' + quotedstr(trim(Order_Main.fieldbyname('MainId').AsString)));
execsql;
end;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
TBRafresh.Click;
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmClothContractList.TnoReviewClick(Sender: TObject);
begin
if Order_Main.IsEmpty then
exit;
try
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update Contract_Main SET ChkStatus=''0'',chktime=null,chker='''' ');
sql.Add('where MainId=' + quotedstr(trim(Order_Main.fieldbyname('MainId').AsString)));
execsql;
end;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
TBRafresh.Click;
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
2025-04-30 16:20:38 +08:00
end;
end;
end.
2025-11-21 09:37:23 +08:00