1167 lines
40 KiB
ObjectPascal
1167 lines
40 KiB
ObjectPascal
unit U_ClothSCList;
|
||
|
||
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, cxLookAndFeels,
|
||
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, cxPC, dxSkinsCore,
|
||
dxSkinsDefaultPainters, dxSkinscxPCPainter;
|
||
|
||
type
|
||
TfrmClothSCList = 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;
|
||
RM1: TRMGridReport;
|
||
RMXLSExport1: TRMXLSExport;
|
||
CDS_PRT: TClientDataSet;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1OrderNo: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1PRTKZ: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
RMDBPRT: TRMDBDataSet;
|
||
TBCopy: TToolButton;
|
||
TBView: TToolButton;
|
||
v1Column19: TcxGridDBColumn;
|
||
RMDBPZ: TRMDBDataSet;
|
||
CDS_PZ: TClientDataSet;
|
||
CDS_SJ: TClientDataSet;
|
||
RMDBSJ: TRMDBDataSet;
|
||
v1Column21: TcxGridDBColumn;
|
||
Label10: TLabel;
|
||
ylname: TEdit;
|
||
v1Column22: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
v1Column20: TcxGridDBColumn;
|
||
ToolButton1: TToolButton;
|
||
RMDBDataSet1: TRMDBDataSet;
|
||
ClientDataSet1: TClientDataSet;
|
||
Panel2: TPanel;
|
||
WFGYSName: TComboBox;
|
||
Label4: TLabel;
|
||
v1Column14: TcxGridDBColumn;
|
||
CDS_WJG: TClientDataSet;
|
||
RMDBWJG: TRMDBDataSet;
|
||
v1Column18: TcxGridDBColumn;
|
||
v1Column29: TcxGridDBColumn;
|
||
v1Column31: TcxGridDBColumn;
|
||
v1Column34: TcxGridDBColumn;
|
||
KHNAME: TEdit;
|
||
Label7: TLabel;
|
||
btn1: TToolButton;
|
||
lbl1: TLabel;
|
||
orderflag: TComboBox;
|
||
cxTabControl1: TcxTabControl;
|
||
ToolButton2: TToolButton;
|
||
ToolButton3: TToolButton;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
ToolButton4: TToolButton;
|
||
ToolButton5: TToolButton;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
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 conPress(Sender: TObject; var Key: Char);
|
||
procedure TBViewClick(Sender: TObject);
|
||
procedure TBCopyClick(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
procedure btn1Click(Sender: TObject);
|
||
procedure orderflagChange(Sender: TObject);
|
||
procedure ylnameKeyPress(Sender: TObject; var Key: Char);
|
||
procedure BatchNoHZKeyPress(Sender: TObject; var Key: Char);
|
||
procedure KHNAMEKeyPress(Sender: TObject; var Key: Char);
|
||
procedure C_CodeNameKeyPress(Sender: TObject; var Key: Char);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
private
|
||
FInt, PFInt: Integer;
|
||
procedure InitGrid();
|
||
procedure InitForm();
|
||
function DelData(): Boolean;
|
||
procedure InitButton();
|
||
{ Private declarations }
|
||
public
|
||
canshu1, FCheJian: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
//var
|
||
//frmClothSCList: TfrmClothSCList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_ClothSCInPut, U_Fun, U_ZDYHelp, U_SCPerson, U_ClothSCInPutSC;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmClothSCList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.InitButton();
|
||
begin
|
||
|
||
if Trim(canshu1) = '<27><>ѯ' then
|
||
begin
|
||
TBAdd.Visible := False;
|
||
TBCopy.Visible := False;
|
||
TBEdit.Visible := False;
|
||
TBDel.Visible := False;
|
||
end;
|
||
if (Trim(canshu1) = 'һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') or (Trim(canshu1) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
|
||
begin
|
||
TBAdd.Visible := False;
|
||
TBCopy.Visible := False;
|
||
TBEdit.Visible := False;
|
||
TBDel.Visible := False;
|
||
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.*,CustomerNoName=(select TOP 1 CustomerNoName from JYOrderCon_Main_PB X where X.MainId=A.ConMainId) ');
|
||
|
||
SQL.Add(',ylname=cast(STUFF(( SELECT distinct '','' +convert(VARCHAR, YCLName+'' '' +ISNULL(YCLSPEC,'''')+'' '' +ISNULL(BatchNo,'''') ) FROM Cloth_YCL_PB y where y.mainid=a.mainid FOR XML PATH('''')), 1, 1, '''') as varchar(500))');
|
||
|
||
sql.Add(' ,HTSYRName=(select TOP 1 SYRName from JYOrderCon_Main_PB X where X.MainId=A.ConMainId)');
|
||
sql.Add(' ,ConPayment=(select TOP 1 Payment from JYOrderCon_Main_PB X where X.MainId=A.ConMainId)');
|
||
sql.Add(' ,ConPRTPrice=(select TOP 1 PRTPrice from JYOrderCon_Sub_PB X where X.SubId=A.ConSubId) ');
|
||
sql.Add(' ,ConDYMoney=(select TOP 1 DYMoney from JYOrderCon_Sub_PB X where X.SubId=A.ConSubId) ');
|
||
sql.Add(' ,ZdyNameZ=(select TOP 1 X.ZdyNameZ from KH_Zdy_Attachment X inner join JYOrderCon_Main_PB Y on X.Type=''KHName'' and X.ZdyCode=Y.CustomerNo where Y.MainId=A.ConMainId) ');
|
||
// sql.Add(' ,DDZT=(case when BegFlag=0 then ''<27><><EFBFBD><EFBFBD>ʼ'' else (case when EndFlag=0 then ''<27>ѿ<EFBFBD>ʼ'' else ''<27>ѽ<EFBFBD><D1BD><EFBFBD>'' end ) end) ');
|
||
sql.Add(' from Cloth_Main A inner join CLoth_Sub B on A.Mainid=B.MainId');
|
||
sql.Add('where 1=1');
|
||
|
||
sql.Add('and A.ORDERFLAG=''' + Trim(orderflag.Text) + '''');
|
||
if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
sql.Add(' and EndFlag=0 ');
|
||
end
|
||
else if cxTabControl1.TabIndex = 1 then
|
||
begin
|
||
sql.Add(' and EndFlag=1');
|
||
sql.Add(' and A.FillTIme>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''');
|
||
sql.Add(' and A.FillTIme<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1)) + '''');
|
||
end
|
||
else
|
||
begin
|
||
sql.Add(' and A.FillTIme>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''');
|
||
sql.Add(' and A.FillTIme<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1)) + '''');
|
||
end;
|
||
|
||
sql.Add('and isnull(jhchejian,''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'')=' + QuotedStr(Trim(FCheJian)));
|
||
sql.add('order by A.FILLTIME DESC');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.InitForm();
|
||
begin
|
||
InitButton();
|
||
|
||
BegDate.DateTime := SGetServerDate10(ADOQueryTemp) - 90;
|
||
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
||
ToolButton2.Visible := False;
|
||
ToolButton3.Visible := False;
|
||
|
||
if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
ToolButton2.Visible := True;
|
||
end;
|
||
if cxTabControl1.TabIndex = 1 then
|
||
begin
|
||
|
||
ToolButton3.Visible := True;
|
||
end
|
||
else if cxTabControl1.TabIndex = 2 then
|
||
begin
|
||
|
||
end;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBFindClick(Sender: TObject);
|
||
begin
|
||
TBRafresh.Click;
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBEditClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmClothSCInPut := TfrmClothSCInPut.Create(Application);
|
||
with frmClothSCInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
FSubId := Trim(Self.Order_Main.fieldbyname('SubId').AsString);
|
||
JHCHEJIAN.Text := Self.FCheJian;
|
||
if ShowModal = 1 then
|
||
begin
|
||
InitGrid();
|
||
Self.Order_Main.Locate('MainId', frmClothSCInPut.FMainId, []);
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothSCInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBDelClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select A.*');
|
||
sql.Add('from JYCon_Sub_AnPai A');
|
||
sql.Add(' where A.SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
sql.Add(' and A.MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
if DelData() then
|
||
begin
|
||
//TBRafresh.Click;
|
||
//TBFind.Click;
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
|
||
function TfrmClothSCList.DelData(): Boolean;
|
||
begin
|
||
try
|
||
Result := false;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Cloth_Sub where SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Cloth_Main 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('<27>ƻ<EFBFBD><C6BB><EFBFBD>ɾ<EFBFBD><C9BE>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + trim(Order_Main.FieldByName('ConNo').AsString) + 'mainid:' + trim(Order_Main.FieldByName('MainId').AsString) + ' subid:' + trim(Order_Main.FieldByName('subid').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete ZDEL_Cloth_YCL_PB where mainid=''' + Trim(Order_Main.fieldbyname('mainid').AsString) + '''');
|
||
SQL.Add('insert into ZDEL_Cloth_YCL_PB ');
|
||
sql.Add('select * from Cloth_YCL_PB where mainid=''' + Trim(Order_Main.fieldbyname('mainid').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZDEL_Cloth_YCL_PB Set DELNOTE=''ɾ<><C9BE><EFBFBD><EFBFBD>:''+''' + Trim(DName) + '''');
|
||
sql.Add('+'' ''+Convert(Varchar(20),getdate(),120)');
|
||
sql.Add(' where mainid=''' + Trim(Order_Main.fieldbyname('mainid').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Cloth_YCL_PB where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
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 TfrmClothSCList.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
Exit;
|
||
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', cxGrid1);
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBPrintClick(Sender: TObject);
|
||
var
|
||
fPrintFile, FWeiZhi: string;
|
||
i, j, k: integer;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
ExportFtErpFile('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>.rmf', ADOQueryTemp);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>.rmf';
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select PZNote1=PZNote,WeiZhi1=WeiZhi,SPZ1=PZ1,SPZ2=PZ2,SPZ3=PZ3,SPZ4=PZ4,SPZ5=PZ5,SPZ6=PZ6,SPZ7=PZ7,SPZ8=PZ8,SPZ9=PZ9,SPZ10=PZ10 ');
|
||
sql.Add(' ,SPZ11=PZ11,SPZ12=PZ12,SPZ13=PZ13,SPZ14=PZ14,SPZ15=PZ15,SPZ16=PZ16,SPZ17=PZ17,SPZ18=PZ18,SPZ19=PZ19,SPZ20=PZ20 ');
|
||
sql.Add(' ,SPZ21=PZ21,SPZ22=PZ22,SPZ23=PZ23,SPZ24=PZ24,SPZ25=PZ25,SPZ26=PZ26,SPZ27=PZ27,SPZ28=PZ28,SPZ29=PZ29,SPZ30=PZ30 ');
|
||
sql.Add(' ,SPZ31=PZ31,SPZ32=PZ32,SPZ33=PZ33,SPZ34=PZ34,SPZ35=PZ35,SPZ36=PZ36,SPZ37=PZ37, SPZ38=PZ38, SPZ39=PZ39, SPZ40=PZ40 ');
|
||
sql.Add(' ,SPZ41=PZ41, SPZ42=PZ42, SPZ43=PZ43, SPZ44=PZ44, SPZ45=PZ45, SPZ46=PZ46, SPZ47=PZ47, SPZ48=PZ48, SPZ49=PZ49, SPZ50=PZ50 ');
|
||
sql.Add(' ,SPZ51=PZ51, SPZ52=PZ52, SPZ53=PZ53, SPZ54=PZ54, SPZ55=PZ55, SPZ56=PZ56, SPZ57=PZ57, SPZ58=PZ58, SPZ59=PZ59, SPZ60=PZ60');
|
||
sql.Add(' ,SPZ61=PZ61, SPZ62=PZ62, SPZ63=PZ63, SPZ64=PZ64, SPZ65=PZ65, SPZ66=PZ66, SPZ67=PZ67, SPZ68=PZ68, SPZ69=PZ69, SPZ70=PZ70');
|
||
sql.Add(' ,SPZ71=PZ71, SPZ72=PZ72, SPZ73=PZ73, SPZ74=PZ74, SPZ75=PZ75, SPZ76=PZ76, SPZ77=PZ77, SPZ78=PZ78, SPZ79=PZ79, SPZ80=PZ80');
|
||
sql.Add(' ,SPZ81=PZ81, SPZ82=PZ82, SPZ83=PZ83, SPZ84=PZ84, SPZ85=PZ85, SPZ86=PZ86, SPZ87=PZ87, SPZ88=PZ88, SPZ89=PZ89, SPZ90=PZ90');
|
||
sql.Add(' ,SPZ91=PZ91, SPZ92=PZ92, SPZ93=PZ93, SPZ94=PZ94, SPZ95=PZ95, SPZ96=PZ96, SPZ97=PZ97, SPZ98=PZ98, SPZ99=PZ99, SPZ100=PZ100');
|
||
sql.Add(' ,SPZ101=PZ101, SPZ102=PZ102, SPZ103=PZ103, SPZ104=PZ104, SPZ105=PZ105, SPZ106=PZ106, SPZ107=PZ107, SPZ108=PZ108 ,SPZ109=PZ109 ,SPZ110=PZ110');
|
||
sql.Add(',SPZ111=PZ111 ,SPZ112=PZ112 ,SPZ113=PZ113 ,SPZ114=PZ114 ,SPZ115=PZ115 ,SPZ116=PZ116 ,SPZ117=PZ117 ,SPZ118=PZ118 ,SPZ119=PZ119 ,SPZ120=PZ120');
|
||
sql.Add(',SPZ121=PZ121 ,SPZ122=PZ122 ,SPZ123=PZ123 ,SPZ124=PZ124 ,SPZ125=PZ125 ,SPZ126=PZ126 ,SPZ127=PZ127 ,SPZ128=PZ128 ,SPZ129=PZ129 ,SPZ130=PZ130');
|
||
sql.Add(',SPZ131=PZ131 ,SPZ132=PZ132 ,SPZ133=PZ133 ,SPZ134=PZ134 ,SPZ135=PZ135 ,SPZ136=PZ136 ,SPZ137=PZ137 ,SPZ138=PZ138 ,SPZ139=PZ139 ,SPZ140=PZ140');
|
||
sql.Add(',SPZ141=PZ141 ,SPZ142=PZ142 ,SPZ143=PZ143 ,SPZ144=PZ144 ');
|
||
sql.Add(' from Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add(' and RTrim(PZType)=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_PZ);
|
||
SInitCDSData20(ADOQueryTemp, CDS_PZ);
|
||
if CDS_PZ.IsEmpty then
|
||
begin
|
||
CDS_PZ.Append;
|
||
CDS_PZ.Post;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add(' and RTrim(PZType)=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_SJ);
|
||
SInitCDSData20(ADOQueryTemp, CDS_SJ);
|
||
|
||
// j := 0;
|
||
// k := 1;
|
||
//
|
||
// ADOQueryTemp.First;
|
||
// FWeiZhi := ADOQueryTemp.FieldByName('WeiZhi').AsString;
|
||
// while not ADOQueryTemp.Eof do
|
||
// begin
|
||
// if Trim(ADOQueryTemp.FieldByName('WeiZhi').AsString) <> FWeiZhi then
|
||
// begin
|
||
// with CDS_SJ do
|
||
// begin
|
||
// Append;
|
||
// Post;
|
||
// end;
|
||
// end;
|
||
// FWeiZhi := ADOQueryTemp.FieldByName('WeiZhi').AsString;
|
||
// with CDS_SJ do
|
||
// begin
|
||
// Append;
|
||
// for i := 0 to ADOQueryTemp.FieldCount - 1 do
|
||
// begin
|
||
// fields[i].value := ADOQueryTemp.Fields[i].Value;
|
||
// end;
|
||
// fieldByName('Sflag').AsString := '1';
|
||
// fieldByName('Sindex').value := k;
|
||
// fieldByName('Ssel').value := false;
|
||
// fieldByName('SDefNote').value := '';
|
||
// inc(k);
|
||
// Post;
|
||
// end;
|
||
//
|
||
// ADOQueryTemp.Next;
|
||
// j := j + 1;
|
||
// end;
|
||
|
||
if CDS_SJ.IsEmpty then
|
||
begin
|
||
CDS_SJ.Append;
|
||
CDS_SJ.Post;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Select A.* ');
|
||
sql.Add(',YLQty=Cast(C_Qty*PBQty*0.01*(1+isnull(ZPSH,0)*0.01) as decimal(18,1))');
|
||
sql.Add(' from Cloth_YCL_PB A');
|
||
sql.Add(' inner join Cloth_Sub B on A.SubId=B.SubId');
|
||
sql.Add(' where A.SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
SQL.Add('ORDER BY PBID');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_PRT);
|
||
SInitCDSData20(ADOQueryTemp, CDS_PRT);
|
||
|
||
if CDS_PRT.IsEmpty then
|
||
begin
|
||
CDS_PRT.Append;
|
||
CDS_PRT.Post;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Cloth_Sub where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, ClientDataSet1);
|
||
SInitCDSData20(ADOQueryTemp, ClientDataSet1);
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RMVariables['ZSCPS'] := ClientDataSet1.fieldbyname('ZSCPS').Value;
|
||
RMVariables['ZSCQty'] := ClientDataSet1.fieldbyname('ZSCQty').Value;
|
||
RMVariables['WFJHPSHZ'] := ClientDataSet1.fieldbyname('WFJHPSHZ').Value;
|
||
RMVariables['WFJHQtyHZ'] := ClientDataSet1.fieldbyname('WFJHQtyHZ').Value;
|
||
RMVariables['C_Code'] := Order_Main.fieldbyname('C_Code').Value;
|
||
|
||
RMVariables['SHACHANG'] := Order_Main.fieldbyname('SHACHANG').Value;
|
||
|
||
RMVariables['ConNo'] := Order_Main.fieldbyname('ConNo').Value;
|
||
RMVariables['C_CodeName'] := Order_Main.fieldbyname('C_CodeName').Value;
|
||
RMVariables['DayQty'] := Order_Main.fieldbyname('DayQty').Value;
|
||
RMVariables['CarType'] := Order_Main.fieldbyname('CarType').Value;
|
||
RMVariables['ChouZhen'] := Order_Main.fieldbyname('ChouZhen').Value;
|
||
RMVariables['KZQty'] := Order_Main.fieldbyname('KZQty').Value;
|
||
RMVariables['MFQty'] := Order_Main.fieldbyname('MFQty').Value;
|
||
RMVariables['KZ'] := Order_Main.fieldbyname('KZ').Value;
|
||
RMVariables['MF'] := Order_Main.fieldbyname('MF').Value;
|
||
RMVariables['PiKgQty'] := Order_Main.fieldbyname('PiKgQty').Value;
|
||
RMVariables['ZhuanQty'] := Order_Main.fieldbyname('ZhuanQty').Value;
|
||
RMVariables['PiQty'] := Order_Main.fieldbyname('PiQty').Value;
|
||
RMVariables['C_Qty'] := Order_Main.fieldbyname('C_Qty').Value;
|
||
RMVariables['QDTime'] := Order_Main.fieldbyname('QDTime').Value;
|
||
RMVariables['JHChejian'] := Order_Main.fieldbyname('JHChejian').Value;
|
||
RMVariables['DeliveryDate'] := Order_Main.fieldbyname('DeliveryDate').Value;
|
||
RMVariables['ShaChang1'] := Order_Main.fieldbyname('ShaChang').Value;
|
||
RMVariables['SJCarNO'] := Order_Main.fieldbyname('SJCarNO').Value;
|
||
RMVariables['C_Spec'] := Order_Main.fieldbyname('C_Spec').Value;
|
||
RMVariables['C_Color'] := Order_Main.fieldbyname('C_Color').Value;
|
||
RMVariables['C_Note'] := Order_Main.fieldbyname('C_Note').Value;
|
||
RMVariables['SJCarNO'] := Order_Main.fieldbyname('SJCarNO').Value;
|
||
RMVariables['ChouZhen'] := Order_Main.fieldbyname('ChouZhen').Value;
|
||
RMVariables['PiKgQtyFD'] := Order_Main.fieldbyname('PiKgQtyFD').Value;
|
||
RMVariables['BatchNoHZ'] := Order_Main.fieldbyname('BatchNoHZ').Value;
|
||
RMVariables['ConPayment'] := Order_Main.fieldbyname('ConPayment').Value;
|
||
RMVariables['ConPRTPrice'] := Order_Main.fieldbyname('ConPRTPrice').Value;
|
||
RMVariables['ConDYMoney'] := Order_Main.fieldbyname('ConDYMoney').Value;
|
||
RMVariables['ZdyNameZ'] := Order_Main.fieldbyname('ZdyNameZ').Value;
|
||
RMVariables['Zdr'] := Order_Main.fieldbyname('Filler').Value;
|
||
RMVariables['WzPrice'] := Order_Main.fieldbyname('WzPrice').Value;
|
||
RMVariables['BZNote'] := Order_Main.fieldbyname('BZNote').Value;
|
||
RMVariables['ZZYQ'] := Order_Main.fieldbyname('ZZYQ').Value;
|
||
RMVariables['ZZSH'] := Order_Main.fieldbyname('ZZSH').Value;
|
||
RMVariables['MFZZS'] := Order_Main.fieldbyname('MFZZS').Value;
|
||
RMVariables['ALBL'] := Order_Main.fieldbyname('ALBL').Value;
|
||
RMVariables['gongyi'] := Order_Main.fieldbyname('gongyi').Value;
|
||
RMVariables['ZongJieNote'] := Order_Main.fieldbyname('ZongJieNote').Value;
|
||
RMVariables['ZhenCun'] := Order_Main.fieldbyname('ZhenCun').Value;
|
||
RMVariables['Filler'] := Order_Main.fieldbyname('Filler').Value;
|
||
RMVariables['JHChejian'] := Order_Main.fieldbyname('JHChejian').Value;
|
||
RMVariables['HTSYRName'] := Order_Main.fieldbyname('HTSYRName').Value;
|
||
RMVariables['YWY'] := Order_Main.fieldbyname('YWY').Value;
|
||
RMVariables['KJTS'] := Order_Main.fieldbyname('KJTS').Value;
|
||
RMVariables['PBMF'] := Order_Main.fieldbyname('PBMF').Value;
|
||
RMVariables['kzzhuan'] := Order_Main.fieldbyname('kzzhuan').Value;
|
||
RMVariables['PBKZ'] := Order_Main.fieldbyname('PBKZ').Value;
|
||
RMVariables['ZongZhenQty'] := Order_Main.fieldbyname('ZongZhenQty').Value;
|
||
RMVariables['KHName'] := Order_Main.fieldbyname('KHName').Value;
|
||
RMVariables['HZPaiSha'] := Order_Main.fieldbyname('HZPaiSha').Value;
|
||
RMVariables['KHConNo'] := Order_Main.fieldbyname('KHConNo').Value;
|
||
RMVariables['maogao'] := Order_Main.fieldbyname('maogao').Value;
|
||
RMVariables['yuantong'] := Order_Main.fieldbyname('yuantong').Value;
|
||
RMVariables['kzzhuanshu'] := Order_Main.fieldbyname('kzzhuanshu').Value;
|
||
|
||
RMVariables['JQZHENQTY'] := Order_Main.fieldbyname('JQZHENQTY').Value;
|
||
RMVariables['BJMF'] := Order_Main.fieldbyname('BJMF').Value;
|
||
RMVariables['yzbz'] := Order_Main.fieldbyname('yzbz').Value;
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBAddClick(Sender: TObject);
|
||
begin
|
||
|
||
try
|
||
frmClothSCInPut := TfrmClothSCInPut.Create(Application);
|
||
with frmClothSCInPut do
|
||
begin
|
||
PState := 0;
|
||
FMainId := '';
|
||
FSubId := '';
|
||
frmClothSCInPut.orderflag.text := '<27><><EFBFBD><EFBFBD>';
|
||
JHCHEJIAN.Text := Self.FCheJian;
|
||
if ShowModal = 1 then
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothSCInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.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 TfrmClothSCList.FormShow(Sender: TObject);
|
||
begin
|
||
if FCheJian = 'һ<><D2BB><EFBFBD><EFBFBD>' then
|
||
begin
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>XXX', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>XXX');
|
||
end
|
||
else
|
||
begin
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>XXX', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>XXX');
|
||
end;
|
||
|
||
InitForm();
|
||
end;
|
||
|
||
procedure TfrmClothSCList.conPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
InitGrid();
|
||
|
||
// if Length(Trim(ConNo.Text)) < 4 then
|
||
// Exit;
|
||
// try
|
||
// ADOQueryMain.DisableControls;
|
||
// with ADOQueryMain do
|
||
// begin
|
||
// Filtered := False;
|
||
// Close;
|
||
// sql.Clear;
|
||
// //sql.Add('exec Cloth_QryList :MainId,:WSql');
|
||
// // Parameters.ParamByName('WSql').Value:=' and OM.conNo like '''+'%'+Trim(ConNoM.Text)+'%'+''''
|
||
// // +' and ConType=''<27><><EFBFBD><EFBFBD>'' ';
|
||
// sql.Add('select * from Cloth_Main A inner join CLoth_Sub B on A.Mainid=B.MainId');
|
||
// sql.Add(' where A.ConNo like ''' + '%' + Trim(ConNo.Text) + '%' + '''');
|
||
//
|
||
// Open;
|
||
// end;
|
||
// SCreateCDS20(ADOQueryMain, Order_Main);
|
||
// SInitCDSData20(ADOQueryMain, Order_Main);
|
||
// finally
|
||
// ADOQueryMain.EnableControls;
|
||
// end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBViewClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmClothSCInPut := TfrmClothSCInPut.Create(Application);
|
||
with frmClothSCInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
FSubId := Trim(Self.Order_Main.fieldbyname('SubId').AsString);
|
||
FConNo := Trim(Self.Order_Main.fieldbyname('ConNo').AsString);
|
||
TBSave.Visible := False;
|
||
ToolBar3.Visible := False;
|
||
ScrollBox1.Enabled := False;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothSCInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBCopyClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmClothSCInPut := TfrmClothSCInPut.Create(Application);
|
||
with frmClothSCInPut do
|
||
begin
|
||
PState := 1;
|
||
FCopyInt := 1;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
FConNo := Trim(Self.Order_Main.fieldbyname('ConNo').AsString);
|
||
JHCHEJIAN.Text := Self.FCheJian;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothSCInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.ToolButton1Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if Trim(WFGYSName.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27>ⷢ<EFBFBD><E2B7A2>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C>ⷢ<EFBFBD><E2B7A2><EFBFBD>յ<EFBFBD>.rmf';
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select PZNote1=PZNote,WeiZhi1=WeiZhi,SPZ1=PZ1,SPZ2=PZ2,SPZ3=PZ3,SPZ4=PZ4,SPZ5=PZ5,SPZ6=PZ6,SPZ7=PZ7,SPZ8=PZ8,SPZ9=PZ9,SPZ10=PZ10 ');
|
||
sql.Add(' ,SPZ11=PZ11,SPZ12=PZ12,SPZ13=PZ13,SPZ14=PZ14,SPZ15=PZ15,SPZ16=PZ16,SPZ17=PZ17,SPZ18=PZ18,SPZ19=PZ19,SPZ20=PZ20 ');
|
||
sql.Add(' ,SPZ21=PZ21,SPZ22=PZ22,SPZ23=PZ23,SPZ24=PZ24,SPZ25=PZ25,SPZ26=PZ26,SPZ27=PZ27,SPZ28=PZ28,SPZ29=PZ29,SPZ30=PZ30 ');
|
||
sql.Add(' ,SPZ31=PZ31,SPZ32=PZ32,SPZ33=PZ33,SPZ34=PZ34,SPZ35=PZ35,SPZ36=PZ36,SPZ37=PZ37, SPZ38=PZ38, SPZ39=PZ39, SPZ40=PZ40 ');
|
||
sql.Add(' ,SPZ41=PZ41, SPZ42=PZ42, SPZ43=PZ43, SPZ44=PZ44, SPZ45=PZ45, SPZ46=PZ46, SPZ47=PZ47, SPZ48=PZ48, SPZ49=PZ49, SPZ50=PZ50 ');
|
||
sql.Add(' ,SPZ51=PZ51, SPZ52=PZ52, SPZ53=PZ53, SPZ54=PZ54, SPZ55=PZ55, SPZ56=PZ56, SPZ57=PZ57, SPZ58=PZ58, SPZ59=PZ59, SPZ60=PZ60');
|
||
sql.Add(' ,SPZ61=PZ61, SPZ62=PZ62, SPZ63=PZ63, SPZ64=PZ64, SPZ65=PZ65, SPZ66=PZ66, SPZ67=PZ67, SPZ68=PZ68, SPZ69=PZ69, SPZ70=PZ70');
|
||
sql.Add(' ,SPZ71=PZ71, SPZ72=PZ72, SPZ73=PZ73, SPZ74=PZ74, SPZ75=PZ75, SPZ76=PZ76, SPZ77=PZ77, SPZ78=PZ78, SPZ79=PZ79, SPZ80=PZ80');
|
||
sql.Add(' ,SPZ81=PZ81, SPZ82=PZ82, SPZ83=PZ83, SPZ84=PZ84, SPZ85=PZ85, SPZ86=PZ86, SPZ87=PZ87, SPZ88=PZ88, SPZ89=PZ89, SPZ90=PZ90');
|
||
sql.Add(' ,SPZ91=PZ91, SPZ92=PZ92, SPZ93=PZ93, SPZ94=PZ94, SPZ95=PZ95, SPZ96=PZ96, SPZ97=PZ97, SPZ98=PZ98, SPZ99=PZ99, SPZ100=PZ100');
|
||
sql.Add(' ,SPZ101=PZ101, SPZ102=PZ102, SPZ103=PZ103, SPZ104=PZ104, SPZ105=PZ105, SPZ106=PZ106, SPZ107=PZ107, SPZ108=PZ108 ,SPZ109=PZ109 ,SPZ110=PZ110');
|
||
sql.Add(' ,SPZ111=PZ111 ,SPZ112=PZ112 ,SPZ113=PZ113 ,SPZ114=PZ114 ,SPZ115=PZ115 ,SPZ116=PZ116 ,SPZ117=PZ117 ,SPZ118=PZ118 ,SPZ119=PZ119 ,SPZ120=PZ120');
|
||
sql.Add(' ,SPZ121=PZ121 ,SPZ122=PZ122 ,SPZ123=PZ123 ,SPZ124=PZ124 ,SPZ125=PZ125 ,SPZ126=PZ126 ,SPZ127=PZ127 ,SPZ128=PZ128 ,SPZ129=PZ129 ,SPZ130=PZ130');
|
||
sql.Add(' ,SPZ131=PZ131 ,SPZ132=PZ132 ,SPZ133=PZ133 ,SPZ134=PZ134 ,SPZ135=PZ135 ,SPZ136=PZ136 ,SPZ137=PZ137 ,SPZ138=PZ138 ,SPZ139=PZ139 ,SPZ140=PZ140');
|
||
sql.Add(' ,SPZ141=PZ141 ,SPZ142=PZ142 ,SPZ143=PZ143 ,SPZ144=PZ144 ');
|
||
sql.Add(' from Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add(' and RTrim(PZType)=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_PZ);
|
||
SInitCDSData20(ADOQueryTemp, CDS_PZ);
|
||
if CDS_PZ.IsEmpty then
|
||
begin
|
||
CDS_PZ.Append;
|
||
CDS_PZ.Post;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add(' and RTrim(PZType)=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_SJ);
|
||
SInitCDSData20(ADOQueryTemp, CDS_SJ);
|
||
if CDS_SJ.IsEmpty then
|
||
begin
|
||
CDS_SJ.Append;
|
||
CDS_SJ.Post;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Select A.* ');
|
||
sql.Add(',YLQty=Cast(C_Qty*PBQty*0.01*(1+isnull(ZPSH,0)*0.01) as decimal(18,1))');
|
||
sql.Add(' from Cloth_YCL_PB A');
|
||
sql.Add(' inner join Cloth_Sub B on A.SubId=B.SubId');
|
||
sql.Add(' where A.SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_PRT);
|
||
SInitCDSData20(ADOQueryTemp, CDS_PRT);
|
||
if CDS_PRT.IsEmpty then
|
||
begin
|
||
CDS_PRT.Append;
|
||
CDS_PRT.Post;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Cloth_Sub where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, ClientDataSet1);
|
||
SInitCDSData20(ADOQueryTemp, ClientDataSet1);
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Cloth_WJG where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add(' and WFGYSName=''' + Trim(WFGYSName.Text) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_WJG);
|
||
SInitCDSData20(ADOQueryTemp, CDS_WJG);
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RMVariables['WFGYSName'] := CDS_WJG.fieldbyname('WFGYSName').Value;
|
||
RMVariables['WFJHPS'] := CDS_WJG.fieldbyname('WFJHPS').Value;
|
||
RMVariables['WFJHQty'] := CDS_WJG.fieldbyname('WFJHQty').Value;
|
||
RMVariables['JGPrice'] := CDS_WJG.fieldbyname('JGPrice').Value;
|
||
RMVariables['JHJiaoQi'] := CDS_WJG.fieldbyname('JHJiaoQi').Value;
|
||
RMVariables['C_Code'] := Order_Main.fieldbyname('C_Code').Value;
|
||
RMVariables['ConNo'] := Order_Main.fieldbyname('ConNo').Value;
|
||
RMVariables['C_CodeName'] := Order_Main.fieldbyname('C_CodeName').Value;
|
||
RMVariables['DayQty'] := Order_Main.fieldbyname('DayQty').Value;
|
||
RMVariables['CarType'] := Order_Main.fieldbyname('CarType').Value;
|
||
RMVariables['ChouZhen'] := Order_Main.fieldbyname('ChouZhen').Value;
|
||
RMVariables['KZQty'] := Order_Main.fieldbyname('KZQty').Value;
|
||
RMVariables['MFQty'] := Order_Main.fieldbyname('MFQty').Value;
|
||
RMVariables['KZ'] := Order_Main.fieldbyname('KZ').Value;
|
||
RMVariables['MF'] := Order_Main.fieldbyname('MF').Value;
|
||
RMVariables['PiKgQty'] := Order_Main.fieldbyname('PiKgQty').Value;
|
||
RMVariables['ZhuanQty'] := Order_Main.fieldbyname('ZhuanQty').Value;
|
||
RMVariables['PiQty'] := Order_Main.fieldbyname('PiQty').Value;
|
||
RMVariables['C_Qty'] := Order_Main.fieldbyname('C_Qty').Value;
|
||
RMVariables['QDTime'] := Order_Main.fieldbyname('QDTime').Value;
|
||
RMVariables['C_Note'] := Order_Main.fieldbyname('C_Note').Value;
|
||
RMVariables['DeliveryDate'] := Order_Main.fieldbyname('DeliveryDate').Value;
|
||
RMVariables['ShaChang1'] := Order_Main.fieldbyname('ShaChang').Value;
|
||
RMVariables['SJCarNO'] := Order_Main.fieldbyname('SJCarNO').Value;
|
||
RMVariables['C_Spec'] := Order_Main.fieldbyname('C_Spec').Value;
|
||
RMVariables['C_Color'] := Order_Main.fieldbyname('C_Color').Value;
|
||
RMVariables['SJCarNO'] := Order_Main.fieldbyname('SJCarNO').Value;
|
||
RMVariables['ChouZhen'] := Order_Main.fieldbyname('ChouZhen').Value;
|
||
RMVariables['PiKgQtyFD'] := Order_Main.fieldbyname('PiKgQtyFD').Value;
|
||
RMVariables['Price'] := Order_Main.fieldbyname('Price').Value;
|
||
RMVariables['MFZZS'] := Order_Main.fieldbyname('MFZZS').Value;
|
||
RMVariables['ALBL'] := Order_Main.fieldbyname('ALBL').Value;
|
||
RMVariables['gongyi'] := Order_Main.fieldbyname('gongyi').Value;
|
||
RMVariables['ZongJieNote'] := Order_Main.fieldbyname('ZongJieNote').Value;
|
||
RMVariables['ZhenCun'] := Order_Main.fieldbyname('ZhenCun').Value;
|
||
RMVariables['BZNote'] := Order_Main.fieldbyname('BZNote').Value;
|
||
RMVariables['ZZYQ'] := Order_Main.fieldbyname('ZZYQ').Value;
|
||
RMVariables['Zdr'] := Order_Main.fieldbyname('Filler').Value;
|
||
RMVariables['JHChejian'] := Order_Main.fieldbyname('JHChejian').Value;
|
||
RMVariables['HTSYRName'] := Order_Main.fieldbyname('HTSYRName').Value;
|
||
RMVariables['YWY'] := Order_Main.fieldbyname('YWY').Value;
|
||
RMVariables['KJTS'] := Order_Main.fieldbyname('KJTS').Value;
|
||
RMVariables['PBMF'] := Order_Main.fieldbyname('PBMF').Value;
|
||
RMVariables['PBKZ'] := Order_Main.fieldbyname('PBKZ').Value;
|
||
RMVariables['ZongZhenQty'] := Order_Main.fieldbyname('ZongZhenQty').Value;
|
||
RMVariables['KHName'] := Order_Main.fieldbyname('KHName').Value;
|
||
RMVariables['HZPaiSha'] := Order_Main.fieldbyname('HZPaiSha').Value;
|
||
RMVariables['KHConNo'] := Order_Main.fieldbyname('KHConNo').Value;
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C>ⷢ<EFBFBD><E2B7A2><EFBFBD>յ<EFBFBD>.rmf'), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
var
|
||
fsj: string;
|
||
begin
|
||
if Order_Main.IsEmpty = False then
|
||
fsj := 'select Name=WFGYSName,Code=WFGYSNo from Cloth_WJG where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + ''''
|
||
else
|
||
fsj := 'select Name=WFGYSName,Code=WFGYSNo from Cloth_WJG where 1=2';
|
||
WFGYSName.Items.Clear;
|
||
SInitComBoxBySql(ADOQueryTemp, WFGYSName, True, fsj);
|
||
end;
|
||
|
||
procedure TfrmClothSCList.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
var
|
||
FDDZT: string;
|
||
begin
|
||
|
||
if AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('DDZT').Index] = null then
|
||
Exit;
|
||
|
||
FDDZT := AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('DDZT').Index];
|
||
|
||
// if FDDZT = '<27>ѿ<EFBFBD>ʼ' then
|
||
// ACanvas.Font.Color := $FF0000;
|
||
if FDDZT = '<27>ѽ<EFBFBD><D1BD><EFBFBD>' then
|
||
ACanvas.Font.Color := $0000FF;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothSCList.btn1Click(Sender: TObject);
|
||
begin
|
||
|
||
try
|
||
frmClothSCInPut := TfrmClothSCInPut.Create(Application);
|
||
with frmClothSCInPut do
|
||
begin
|
||
PState := 0;
|
||
frmClothSCInPut.FMainId := '';
|
||
FSubId := '';
|
||
frmClothSCInPut.orderflag.text := '<27><><EFBFBD><EFBFBD>';
|
||
JHCHEJIAN.Text := Self.FCheJian;
|
||
if ShowModal = 1 then
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothSCInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.orderflagChange(Sender: TObject);
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.ylnameKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
TBRafresh.Click();
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmClothSCList.BatchNoHZKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
TBRafresh.Click();
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmClothSCList.KHNAMEKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
TBRafresh.Click();
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmClothSCList.C_CodeNameKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
TBRafresh.Click();
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmClothSCList.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
ToolButton2.Visible := False;
|
||
ToolButton3.Visible := False;
|
||
|
||
if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
ToolButton2.Visible := True;
|
||
end;
|
||
if cxTabControl1.TabIndex = 1 then
|
||
begin
|
||
ToolButton3.Visible := True;
|
||
|
||
end
|
||
else if cxTabControl1.TabIndex = 2 then
|
||
begin
|
||
|
||
end;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothSCList.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate Cloth_Main Set Endtime=getdate(),EndPerson=''' + Trim(DName) + ''',EndFlag=1');
|
||
sql.Add(' where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add('UPdate Cloth_JiTai SET StopFlag=1,DOTime=getdate(),DOPerson=''' + Trim(DName) + '''');
|
||
sql.Add(',TYTime=getdate(),TYPerson=''' + Trim(DName) + '''');
|
||
sql.Add(' where MainId=' + quotedstr(trim(Order_Main.fieldbyname('MainId').AsString)));
|
||
sql.Add(' and StopFlag=0');
|
||
ExecSQL;
|
||
end;
|
||
// UpdateJTInfo(Trim(Order_Main.fieldbyname('MainId').AsString));
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update Cloth_Sub Set RTAPJTQty=(select Count(*) from Cloth_JiTai A where A.MainId=Cloth_Sub.MainId )');
|
||
sql.Add(',RTAPJTInfo=dbo.F_Get_Order_SubStr_PB(Cloth_Sub.MainId,''RTAPJTInfo'')');
|
||
sql.Add(',RTQYJTQty=(select Count(*) from Cloth_JiTai A where A.MainId=Cloth_Sub.MainId and StopFlag=0 )');
|
||
sql.Add(',RTQYJTInfo=dbo.F_Get_Order_SubStr_PB(Cloth_Sub.MainId,''RTQYJTInfo'')');
|
||
sql.Add(',RTTYJTQty=(select Count(*) from Cloth_JiTai A where A.MainId=Cloth_Sub.MainId and StopFlag=1 )');
|
||
sql.Add(',RTTYJTInfo=dbo.F_Get_Order_SubStr_PB(Cloth_Sub.MainId,''RTTYJTInfo'')');
|
||
sql.Add(' where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
//Parameters.ParamByName('MainId').Value:=Trim(RTMainId);
|
||
ExecSQL;
|
||
end;
|
||
Order_Main.Delete;
|
||
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate Cloth_Main Set Endtime=NULL,EndPerson=NULL,EndFlag=0');
|
||
sql.Add(' where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
Order_Main.Delete;
|
||
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
|
||
if FCheJian = 'һ<><D2BB><EFBFBD><EFBFBD>' then
|
||
begin
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>XXX', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>XXX');
|
||
end
|
||
else
|
||
begin
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>XXX', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>XXX');
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.ToolButton5Click(Sender: TObject);
|
||
var
|
||
FCHEJIAN: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
FCHEJIAN := Order_Main.fieldbyname('jhchejian').AsString;
|
||
if FCHEJIAN = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD>Ѹüƻ<C3BC><C6BB><EFBFBD><EFBFBD><EFBFBD>Ϊһ<CEAA><D2BB><EFBFBD>䣿', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate Cloth_sub Set JHCHEJIAN=''һ<><D2BB><EFBFBD><EFBFBD>''');
|
||
sql.Add(' where MAINID=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
Order_Main.Delete;
|
||
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
|
||
end
|
||
else
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD>Ѹüƻ<C3BC><C6BB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>䣿', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate Cloth_sub Set JHCHEJIAN=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
|
||
sql.Add(' where MAINID=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
Order_Main.Delete;
|
||
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
|
||
end.
|
||
|