795 lines
26 KiB
ObjectPascal
795 lines
26 KiB
ObjectPascal
unit U_ClothSCListSel;
|
||
|
||
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;
|
||
|
||
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;
|
||
v1PRTMF: TcxGridDBColumn;
|
||
v1PRTKZ: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
RMDBPRT: TRMDBDataSet;
|
||
v1Column12: TcxGridDBColumn;
|
||
TBCopy: TToolButton;
|
||
TBView: TToolButton;
|
||
v1Column19: TcxGridDBColumn;
|
||
RMDBPZ: TRMDBDataSet;
|
||
CDS_PZ: TClientDataSet;
|
||
CDS_SJ: TClientDataSet;
|
||
RMDBSJ: TRMDBDataSet;
|
||
v1Column21: TcxGridDBColumn;
|
||
Label10: TLabel;
|
||
C_Code: TEdit;
|
||
v1Column22: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column15: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
v1Column16: TcxGridDBColumn;
|
||
v1Column17: TcxGridDBColumn;
|
||
v1Column20: TcxGridDBColumn;
|
||
v1Column23: TcxGridDBColumn;
|
||
v1Column24: TcxGridDBColumn;
|
||
v1Column25: TcxGridDBColumn;
|
||
v1Column26: TcxGridDBColumn;
|
||
v1Column27: TcxGridDBColumn;
|
||
v1Column28: TcxGridDBColumn;
|
||
ToolButton1: TToolButton;
|
||
RMDBDataSet1: TRMDBDataSet;
|
||
ClientDataSet1: TClientDataSet;
|
||
Panel2: TPanel;
|
||
WFGYSName: TComboBox;
|
||
Label4: TLabel;
|
||
v1Column14: TcxGridDBColumn;
|
||
CDS_WJG: TClientDataSet;
|
||
RMDBWJG: TRMDBDataSet;
|
||
v1Column18: TcxGridDBColumn;
|
||
v1Column29: TcxGridDBColumn;
|
||
Label6: TLabel;
|
||
BatchNoHZ: TEdit;
|
||
v1Column31: TcxGridDBColumn;
|
||
v1Column30: TcxGridDBColumn;
|
||
v1Column32: TcxGridDBColumn;
|
||
v1Column33: TcxGridDBColumn;
|
||
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);
|
||
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_RTFun, 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;
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
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(' ,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(' from Cloth_Main A inner join CLoth_Sub B on A.Mainid=B.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)) + '''');
|
||
if canshu1 = 'һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
sql.Add(' and B.JHChejian=''һ<><D2BB><EFBFBD><EFBFBD>'' ');
|
||
end;
|
||
if canshu1 = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
sql.Add(' and B.JHChejian=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
end;
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(ADOQueryMain, Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.InitForm();
|
||
begin
|
||
InitButton();
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
BegDate.DateTime := SGetServerDate(ADOQueryTemp) - 7;
|
||
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure 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);
|
||
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 ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Cloth_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 Cloth_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 Cloth_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
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 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: string;
|
||
i, j, k: integer;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
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 WeiZhi=WeiZhi1,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 ');
|
||
sql.Add(' from Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add(' and RTrim(PZType)=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_PZ);
|
||
SInitCDSData(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;
|
||
SCreateCDS(ADOQueryTemp, CDS_SJ);
|
||
j := 0;
|
||
k := 1;
|
||
if ADOQueryTemp.RecordCount < 2 then
|
||
begin
|
||
SInitCDSData(ADOQueryTemp, CDS_SJ);
|
||
end
|
||
else
|
||
begin
|
||
ADOQueryTemp.First;
|
||
while not ADOQueryTemp.Eof do
|
||
begin
|
||
if j = 2 then
|
||
begin
|
||
with CDS_SJ do
|
||
begin
|
||
Append;
|
||
for i := 0 to ADOQueryTemp.FieldCount - 1 do
|
||
begin
|
||
if ((fields[i].FieldName <> 'Filltime') and (fields[i].FieldName <> 'Edittime')) then
|
||
fields[i].value := '__________';
|
||
end;
|
||
fieldByName('Sflag').AsString := '1';
|
||
fieldByName('Sindex').value := k;
|
||
fieldByName('Ssel').value := false;
|
||
fieldByName('SDefNote').value := '';
|
||
inc(k);
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
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;
|
||
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) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_PRT);
|
||
SInitCDSData(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;
|
||
SCreateCDS(ADOQueryTemp, ClientDataSet1);
|
||
SInitCDSData(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['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;
|
||
// showmessage(Order_Main.fieldbyname('ShaChang').asstring);
|
||
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['PBKZ'] := Order_Main.fieldbyname('PBKZ').Value;
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>.rmf'), '<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 := '';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
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));
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmClothSCList.FormShow(Sender: TObject);
|
||
begin
|
||
InitForm();
|
||
end;
|
||
|
||
procedure TfrmClothSCList.conPress(Sender: TObject; var Key: Char);
|
||
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 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;
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(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);
|
||
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 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 ');
|
||
sql.Add(' from Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add(' and RTrim(PZType)=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_PZ);
|
||
SInitCDSData(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;
|
||
SCreateCDS(ADOQueryTemp, CDS_SJ);
|
||
SInitCDSData(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;
|
||
SCreateCDS(ADOQueryTemp, CDS_PRT);
|
||
SInitCDSData(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;
|
||
SCreateCDS(ADOQueryTemp, ClientDataSet1);
|
||
SInitCDSData(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;
|
||
SCreateCDS(ADOQueryTemp, CDS_WJG);
|
||
SInitCDSData(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;
|
||
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;
|
||
|
||
end.
|
||
|