2025-04-16 09:11:01 +08:00
unit U_ClothContractList_Help;
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-05-12 15:20:41 +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, cxCheckBox,
cxCurrencyEdit, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel,
dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven,
dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
dxSkinXmas2008Blue, dxSkinscxPCPainter;
2025-04-16 09:11:01 +08:00
type
TfrmClothContractList_Help = class( TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: 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;
Label4: TLabel;
C_Spec: TEdit;
ScrollBox1: TScrollBox;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1OrderNo: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v1FactoryNo1Name: TcxGridDBColumn;
v1PRTSpec: TcxGridDBColumn;
v1PRTOrderQty: TcxGridDBColumn;
v1OrderUnit: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
ClientDataSet3: TClientDataSet;
DataSource2: TDataSource;
DataSource3: TDataSource;
ClientDataSet2: TClientDataSet;
v1Qty1: TcxGridDBColumn;
RM1: TRMGridReport;
RMDBMain: TRMDBDataSet;
RMXLSExport1: TRMXLSExport;
CDS_PRT: TClientDataSet;
Label6: TLabel;
FactoryNoName: TEdit;
v1Column8: TcxGridDBColumn;
v1Ssel: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
v1Column13: 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;
v1Column18: TcxGridDBColumn;
v1Column19: TcxGridDBColumn;
v1Column15: TcxGridDBColumn;
Label7: TLabel;
JHPlace: TEdit;
Order_Main: TClientDataSet;
ToolButton1: TToolButton;
2025-05-12 15:20:41 +08:00
CheckBox2: TCheckBox;
2025-04-16 09:11:01 +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 TBExportClick( Sender: TObject) ;
procedure TBPrintClick( Sender: TObject) ;
procedure TBRafreshClick( Sender: TObject) ;
procedure ConNoChange( Sender: TObject) ;
procedure FormShow( Sender: TObject) ;
2025-05-12 15:20:41 +08:00
procedure v2Column3PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
2025-04-16 09:11:01 +08:00
procedure conPress( Sender: TObject; var Key: Char ) ;
procedure ToolButton1Click( Sender: TObject) ;
2025-05-12 15:20:41 +08:00
procedure Tv1CustomDrawIndicatorCell( Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean ) ;
2025-04-16 09:11:01 +08:00
private
2025-05-12 15:20:41 +08:00
FInt, PFInt: Integer ;
2025-04-16 09:11:01 +08:00
procedure InitGrid( ) ;
procedure InitForm( ) ;
2025-05-12 15:20:41 +08:00
function DelData( ) : Boolean ;
2025-04-16 09:11:01 +08:00
{ Private declarations }
public
{ Public declarations }
end ;
var
frmClothContractList_Help: TfrmClothContractList_Help;
implementation
2025-05-12 15:20:41 +08:00
2025-04-16 09:11:01 +08:00
uses
2025-05-12 15:20:41 +08:00
U_DataLink, U_ClothContractInPut, U_Fun, U_ProductOrderList, U_ZDYHelp;
2025-04-16 09:11:01 +08:00
{$R *.dfm}
procedure TfrmClothContractList_Help. FormDestroy( Sender: TObject) ;
begin
2025-05-12 15:20:41 +08:00
frmClothContractList_Help : = nil ;
2025-04-16 09:11:01 +08:00
end ;
2025-05-12 15:20:41 +08:00
procedure TfrmClothContractList_Help. FormClose( Sender: TObject; var Action: TCloseAction) ;
2025-04-16 09:11:01 +08:00
begin
2025-05-12 15:20:41 +08:00
Action : = caFree;
2025-04-16 09:11:01 +08:00
end ;
procedure TfrmClothContractList_Help. FormCreate( Sender: TObject) ;
begin
2025-05-12 15:20:41 +08:00
ScrollBox1. Align : = alClient;
2025-04-16 09:11:01 +08:00
end ;
procedure TfrmClothContractList_Help. TBCloseClick( Sender: TObject) ;
begin
Close;
2025-05-12 15:20:41 +08:00
WriteCxGrid( self. Caption, Tv1, 'ָʾ <D6B8> <CABE> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ) ;
2025-04-16 09:11:01 +08:00
end ;
procedure TfrmClothContractList_Help. InitGrid( ) ;
begin
try
ADOQueryMain. DisableControls;
with ADOQueryMain do
begin
Close;
sql. Clear;
2025-05-12 15:20:41 +08:00
Filtered : = False ;
2025-04-16 09:11:01 +08:00
sql. Add( 'exec P_Get_Contract' ) ;
2025-05-12 15:20:41 +08:00
if CheckBox2. Checked = True then
begin
sql. Add( '@begdate=' '' + Trim( FormatDateTime( 'yyyy-MM-dd' , BegDate. DateTime) ) + '' ' ' ) ;
sql. Add( ',@enddate=' '' + Trim( FormatDateTime( 'yyyy-MM-dd' , enddate. DateTime + 1 ) ) + '' ' ' ) ;
end
else
begin
sql. Add( '@begdate=' '2000-01-01' ' ' ) ;
sql. Add( ',@enddate=' '2050-01-01' ' ' ) ;
end ;
// sql.Add('@begdate=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + ''' ');
// sql.Add(',@enddate=''' + Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)) + ''' ');
2025-04-16 09:11:01 +08:00
sql. Add( ',@conType=' '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ' ' ) ;
2025-05-12 15:20:41 +08:00
sql. Add( ',@status=' '' + inttostr( 0 ) + '' ' ' ) ;
2025-04-16 09:11:01 +08:00
Open;
end ;
2025-05-12 15:20:41 +08:00
SCreateCDS20( ADOQueryMain, Order_Main) ;
SInitCDSData20( ADOQueryMain, Order_Main) ;
2025-04-16 09:11:01 +08:00
finally
ADOQueryMain. EnableControls;
end ;
end ;
procedure TfrmClothContractList_Help. InitForm( ) ;
begin
2025-05-12 15:20:41 +08:00
ReadCxGrid( self. Caption, Tv1, 'ָʾ <D6B8> <CABE> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ) ;
BegDate. DateTime : = SGetServerDate10( ADOQueryTemp) - 7 ;
EndDate. DateTime : = SGetServerDate10( ADOQueryTemp) ;
2025-04-16 09:11:01 +08:00
InitGrid( ) ;
end ;
procedure TfrmClothContractList_Help. TBFindClick( Sender: TObject) ;
begin
2025-05-12 15:20:41 +08:00
if ADOQueryMain. Active = False then
Exit;
SDofilter( ADOQueryMain, SGetFilters( Panel1, 1 , 2 ) ) ;
SCreateCDS20( ADOQueryMain, Order_Main) ;
SInitCDSData20( ADOQueryMain, Order_Main) ;
2025-04-16 09:11:01 +08:00
end ;
procedure TfrmClothContractList_Help. TBEditClick( Sender: TObject) ;
begin
2025-05-12 15:20:41 +08:00
if Order_Main. IsEmpty then
Exit;
2025-04-16 09:11:01 +08:00
try
2025-05-12 15:20:41 +08:00
frmClothContractInPut : = TfrmClothContractInPut. Create( Application) ;
2025-04-16 09:11:01 +08:00
with frmClothContractInPut do
begin
2025-05-12 15:20:41 +08:00
PState : = 1 ;
FMainId : = Trim( Self. Order_Main. fieldbyname( 'MainId' ) . AsString) ;
if ShowModal = 1 then
2025-04-16 09:11:01 +08:00
begin
end ;
end ;
finally
frmClothContractInPut. Free;
end ;
end ;
2025-05-12 15:20:41 +08:00
function TfrmClothContractList_Help. DelData( ) : Boolean ;
2025-04-16 09:11:01 +08:00
begin
end ;
procedure TfrmClothContractList_Help. TBExportClick( Sender: TObject) ;
begin
2025-05-12 15:20:41 +08:00
if ADOQueryMain. IsEmpty then
Exit;
TcxGridToExcel( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͬ<EFBFBD> <CDAC> <EFBFBD> <EFBFBD> <EFBFBD> б <EFBFBD> ' , cxGrid1) ;
2025-04-16 09:11:01 +08:00
end ;
procedure TfrmClothContractList_Help. TBPrintClick( Sender: TObject) ;
var
2025-05-12 15:20:41 +08:00
fPrintFile, FConNoM: string ;
2025-04-16 09:11:01 +08:00
begin
2025-05-12 15:20:41 +08:00
if Order_Main. IsEmpty then
Exit;
fPrintFile : = ExtractFilePath( Application. ExeName) + 'Report\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͬ.rmf' ;
2025-04-16 09:11:01 +08:00
with ADOQueryTemp do
begin
2025-05-12 15:20:41 +08:00
Filtered : = False ;
2025-04-16 09:11:01 +08:00
Close;
sql. Clear;
sql. Add( 'exec ClothContract_QryList :MainId,:WSql' ) ;
2025-05-12 15:20:41 +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-16 09:11:01 +08:00
Open;
end ;
2025-05-12 15:20:41 +08:00
SCreateCDS20( ADOQueryTemp, CDS_PRT) ;
SInitCDSData20( ADOQueryTemp, CDS_PRT) ;
FConNoM : = Trim( CDS_PRT. fieldbyname( 'ConNoM' ) . AsString) ;
2025-04-16 09:11:01 +08:00
//SDofilter(ADOQueryMain,' ConNoM='''+Trim(Order_Main.fieldbyname('ConNoM').AsString)+'''');
//SCreateCDS20(ADOQueryMain,Order_Main);
//SInitCDSData20(ADOQueryMain,Order_Main);
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;
2025-05-12 15:20:41 +08:00
end
else
2025-04-16 09:11:01 +08:00
begin
2025-05-12 15:20:41 +08:00
Application. MessageBox( PChar( 'û<> <C3BB> <EFBFBD> <EFBFBD> ' + ExtractFilePath( Application. ExeName) + 'Report\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͬ.rmf' ) , '<27> <> ʾ ' , 0 ) ;
2025-04-16 09:11:01 +08:00
end ;
end ;
procedure TfrmClothContractList_Help. TBRafreshClick( Sender: TObject) ;
begin
2025-05-12 15:20:41 +08:00
InitGrid( ) ;
2025-04-16 09:11:01 +08:00
end ;
procedure TfrmClothContractList_Help. ConNoChange( Sender: TObject) ;
begin
2025-05-12 15:20:41 +08:00
if ADOQueryMain. Active = False then
Exit;
SDofilter( ADOQueryMain, SGetFilters( Panel1, 1 , 2 ) ) ;
SCreateCDS20( ADOQueryMain, Order_Main) ;
SInitCDSData20( ADOQueryMain, Order_Main) ;
2025-04-16 09:11:01 +08:00
end ;
procedure TfrmClothContractList_Help. FormShow( Sender: TObject) ;
begin
InitForm( ) ;
end ;
2025-05-12 15:20:41 +08:00
procedure TfrmClothContractList_Help. v2Column3PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
2025-04-16 09:11:01 +08:00
begin
try
2025-05-12 15:20:41 +08:00
frmZDYHelp : = TfrmZDYHelp. Create( Application) ;
2025-04-16 09:11:01 +08:00
with frmZDYHelp do
begin
2025-05-12 15:20:41 +08:00
flag : = 'RKPlace' ;
flagname : = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> ص<EFBFBD> ' ;
if ShowModal = 1 then
2025-04-16 09:11:01 +08:00
begin
with ClientDataSet2 do
begin
Edit;
2025-05-12 15:20:41 +08:00
FieldByName( 'RKPlace' ) . Value : = Trim( frmZDYHelp. ClientDataSet1. fieldbyname( 'ZDYName' ) . AsString) ;
2025-04-16 09:11:01 +08:00
end ;
end ;
end ;
finally
frmZDYHelp. Free;
end ;
end ;
2025-05-12 15:20:41 +08:00
procedure TfrmClothContractList_Help. conPress( Sender: TObject; var Key: Char ) ;
2025-04-16 09:11:01 +08:00
begin
2025-05-12 15:20:41 +08:00
if Key = #13 then
2025-04-16 09:11:01 +08:00
begin
2025-05-12 15:20:41 +08:00
if Length( Trim( ConNo. Text ) ) < 4 then
Exit;
2025-04-16 09:11:01 +08:00
try
ADOQueryMain. DisableControls;
with ADOQueryMain do
begin
2025-05-12 15:20:41 +08:00
Filtered : = False ;
2025-04-16 09:11:01 +08:00
Close;
sql. Clear;
sql. Add( 'exec ClothContract_QryList :MainId,:WSql' ) ;
2025-05-12 15:20:41 +08:00
Parameters. ParamByName( 'WSql' ) . Value : = ' and OM.conNo like ' '' + '%' + Trim( ConNo. Text ) + '%' + '' '' ;
2025-04-16 09:11:01 +08:00
Open;
end ;
2025-05-12 15:20:41 +08:00
SCreateCDS20( ADOQueryMain, Order_Main) ;
SInitCDSData20( ADOQueryMain, Order_Main) ;
2025-04-16 09:11:01 +08:00
finally
ADOQueryMain. EnableControls;
end ;
end ;
end ;
procedure TfrmClothContractList_Help. ToolButton1Click( Sender: TObject) ;
begin
2025-05-12 15:20:41 +08:00
if Order_Main. IsEmpty then
exit;
ModalResult : = 1 ;
2025-04-16 09:11:01 +08:00
end ;
2025-05-12 15:20:41 +08:00
procedure TfrmClothContractList_Help. Tv1CustomDrawIndicatorCell( Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean ) ;
2025-04-16 09:11:01 +08:00
var
2025-05-12 15:20:41 +08:00
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 ;
2025-04-16 09:11:01 +08:00
end .
2025-05-12 15:20:41 +08:00