1130 lines
31 KiB
ObjectPascal
1130 lines
31 KiB
ObjectPascal
unit U_ShaRKListWSQ;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||
cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView,
|
||
cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses,
|
||
cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls,
|
||
ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient,
|
||
cxDropDownEdit, cxCheckBox, RM_Common, RM_Class, RM_e_Xls, RM_Dataset,
|
||
RM_System, RM_GridReport, Menus, cxCalendar, cxButtonEdit, cxTextEdit, cxPC,
|
||
IniFiles, jpeg, U_SLT;
|
||
|
||
type
|
||
TfrmShaRKListWSQ = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBExport: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
CDS_Main: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
RMDBMain: TRMDBDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
RMDBHZ: TRMDBDataSet;
|
||
CDS_HZ: TClientDataSet;
|
||
CDS_PRT: TClientDataSet;
|
||
TBDel: TToolButton;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
TBRKHC: TToolButton;
|
||
TBEdit: TToolButton;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
Label8: TLabel;
|
||
Label12: TLabel;
|
||
SPName: TEdit;
|
||
FactoryName: TEdit;
|
||
SPID: TEdit;
|
||
SPSpec: TEdit;
|
||
CRType: TComboBox;
|
||
Label6: TLabel;
|
||
SPCF: TEdit;
|
||
Label7: TLabel;
|
||
PBNO: TEdit;
|
||
cxGrid2: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
v1Column14: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v2Column6: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
cxGrid2Level1: TcxGridLevel;
|
||
v1Column16: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
Label11: TLabel;
|
||
FromFactoryName: TEdit;
|
||
v1Column10: TcxGridDBColumn;
|
||
Label9: TLabel;
|
||
ToFactoryName: TEdit;
|
||
v1Column15: TcxGridDBColumn;
|
||
v1Column17: TcxGridDBColumn;
|
||
v1Column18: TcxGridDBColumn;
|
||
Label10: TLabel;
|
||
SXPinPai: TEdit;
|
||
TBZF: TToolButton;
|
||
cxTabControl1: TcxTabControl;
|
||
Label13: TLabel;
|
||
BatchNo: TEdit;
|
||
ToolButton1: TToolButton;
|
||
TBRKQC: TToolButton;
|
||
TBRKZD: TToolButton;
|
||
TBRKCGJG: TToolButton;
|
||
GroupBox1: TGroupBox;
|
||
ScrollBox1: TScrollBox;
|
||
ToolButton2: TToolButton;
|
||
adoqueryPicture: TADOQuery;
|
||
v1Column19: TcxGridDBColumn;
|
||
v1Column20: TcxGridDBColumn;
|
||
CDS_MX: TClientDataSet;
|
||
DSMX: TDataSource;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
cxGrid1: TcxGrid;
|
||
TvMX: TcxGridDBTableView;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
ToolButton3: TToolButton;
|
||
vMXColumn1: TcxGridDBColumn;
|
||
v1Column21: TcxGridDBColumn;
|
||
PopupMenu2: TPopupMenu;
|
||
N3: TMenuItem;
|
||
N4: TMenuItem;
|
||
v1Column22: TcxGridDBColumn;
|
||
Panel2: TPanel;
|
||
Button1: TButton;
|
||
Button2: TButton;
|
||
CGJGType: TComboBox;
|
||
Label14: TLabel;
|
||
Panel3: TPanel;
|
||
Label15: TLabel;
|
||
Button3: TButton;
|
||
Button4: TButton;
|
||
JGWZHCType: TComboBox;
|
||
v1Column23: TcxGridDBColumn;
|
||
ToolButton4: TToolButton;
|
||
ToolButton5: TToolButton;
|
||
RMDBDataSet1: TRMDBDataSet;
|
||
ClientDataSet1: TClientDataSet;
|
||
RMGridReport1: TRMGridReport;
|
||
v1Column24: TcxGridDBColumn;
|
||
ToolButton6: TToolButton;
|
||
chkprice: TCheckBox;
|
||
TBPrice: TToolButton;
|
||
v1Column25: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ConNoMChange(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure TBRKHCClick(Sender: TObject);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure SPIDKeyPress(Sender: TObject; var Key: Char);
|
||
procedure SPIDChange(Sender: TObject);
|
||
procedure SPSpecChange(Sender: TObject);
|
||
procedure FactoryNameChange(Sender: TObject);
|
||
procedure TBZFClick(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure BatchNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure TBRKQCClick(Sender: TObject);
|
||
procedure TBRKZDClick(Sender: TObject);
|
||
procedure TBRKCGJGClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
procedure N3Click(Sender: TObject);
|
||
procedure N4Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure Button3Click(Sender: TObject);
|
||
procedure Button4Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
procedure TBPriceClick(Sender: TObject);
|
||
procedure chkpriceClick(Sender: TObject);
|
||
private
|
||
canshu1, canshu2, canshu3: string;
|
||
procedure InitGrid();
|
||
procedure InitImage();
|
||
procedure ReadINIFile();
|
||
{ Private declarations }
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
//var
|
||
// frmShaRKList: TfrmShaRKList;
|
||
var
|
||
Mach: array of TfrmSlt;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ShaRKInPutWSQ, U_FileUp;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmShaRKListWSQ.FormDestroy(Sender: TObject);
|
||
begin
|
||
//frmShaRKList:=nil;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
var
|
||
i, j: integer;
|
||
begin
|
||
j := length(Mach);
|
||
if j > 0 then
|
||
begin
|
||
for i := 0 to j - 1 do
|
||
begin
|
||
Mach[i].free;
|
||
end;
|
||
end;
|
||
SetLength(Mach, 0);
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.ReadINIFile();
|
||
var
|
||
programIni: Tinifile; //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||
FileName: string;
|
||
begin
|
||
FileName := ExtractFilePath(Paramstr(0)) + 'SYSTEMSET.INI';
|
||
programIni := Tinifile.create(FileName);
|
||
server := programIni.ReadString('SERVER', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ', '127.0.0.1');
|
||
programIni.Free;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.FormCreate(Sender: TObject);
|
||
begin
|
||
//cxGrid1.Align:=alClient;
|
||
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
||
BegDate.DateTime := EndDate.DateTime;
|
||
canshu1 := Trim(DParameters1);
|
||
canshu2 := Trim(DParameters2);
|
||
canshu3 := Trim(DParameters3);
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.*,jsMoney=cast(ROUND(price*qty,2) as decimal(18,2)) ');
|
||
sql.Add(' from CK_SXPB_CR A');
|
||
sql.add(' where A.CRTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''');
|
||
sql.Add(' and A.CRTime<''' + Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)) + '''');
|
||
sql.Add(' and isnull(CKName,'''')=''ɴ<><C9B4>''');
|
||
SQL.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
if chkprice.Checked then
|
||
SQL.Add(' and isnull(price,0)=0 ');
|
||
{if Trim(canshu2)<>'' then
|
||
begin
|
||
SQL.Add(' and isnull(DeptName,'''')='''+Trim(canshu2)+'''');
|
||
end;}
|
||
if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
Sql.Add(' and ZFFlag=0 ');
|
||
end
|
||
else if cxTabControl1.TabIndex = 1 then
|
||
begin
|
||
Sql.Add(' and ZFFlag=1 ');
|
||
end;
|
||
if Trim(Self.Caption) = 'ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
Sql.Add(' and filler=' + quotedstr(Trim(DName)));
|
||
end;
|
||
SQL.Add(' order by CRTime desc');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
BegDate.SetFocus;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', Tv1, 'ɴ<>ֿ߲<DFB2>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid('ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', Tv1, 'ɴ<>ֿ߲<DFB2>');
|
||
TBRKQC.Visible := False;
|
||
TBRKZD.Visible := False;
|
||
TBRKCGJG.Visible := False;
|
||
TBRKHC.Visible := False;
|
||
TBDel.Visible := False;
|
||
TBEdit.Visible := False;
|
||
TBZF.Visible := False;
|
||
cxTabControl1.Visible := False;
|
||
TBPrice.Visible := False;
|
||
|
||
if Trim(Self.Caption) = 'ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
TBRKQC.Visible := true;
|
||
TBRKZD.Visible := true;
|
||
TBRKCGJG.Visible := true;
|
||
TBRKHC.Visible := true;
|
||
TBDel.Visible := true;
|
||
TBEdit.Visible := true;
|
||
TBZF.Visible := true;
|
||
cxTabControl1.Visible := true;
|
||
end;
|
||
if Trim(Self.Caption) = 'ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD>ⵥ<EFBFBD><E2B5A5><EFBFBD><EFBFBD>' then
|
||
begin
|
||
TBPrice.Visible := true;
|
||
end;
|
||
|
||
if Trim(Self.Caption) = 'ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><>Ȩ<EFBFBD><C8A8>)' then
|
||
begin
|
||
canshu1 := '<27><>Ȩ<EFBFBD><C8A8>';
|
||
TBRKQC.Visible := true;
|
||
TBRKZD.Visible := true;
|
||
TBRKCGJG.Visible := true;
|
||
TBRKHC.Visible := true;
|
||
TBDel.Visible := true;
|
||
TBEdit.Visible := true;
|
||
TBZF.Visible := true;
|
||
cxTabControl1.Visible := true;
|
||
end;
|
||
//InitGrid();
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
exit;
|
||
TcxGridToExcel('ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', cxGrid2);
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main, True);
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main, False);
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.TBDelClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
Exit;
|
||
if Trim(CDS_Main.fieldbyname('SPID').AsString) <> '' then
|
||
begin
|
||
if Trim(CDS_Main.fieldbyname('CRType').AsString) = 'ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
Application.MessageBox('ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR_Sub where YFPZNO=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EEB2BB>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_SXPB_CR where FZSPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
sql.Add(' and CRQtyFlag=-1');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><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;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' delete CK_SXPB_CR where SPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
sql.Add(' delete GYS_Qty_MX where WBID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵽<EFBFBD><EBB5BD>
|
||
{with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update CaiGou_SQ Set DHPS=(select Sum(PiQty) from CK_SXPB_CR A where A.SQID=CaiGou_SQ.SQID and A.ZFFlag=0');
|
||
sql.Add(' and isnull(A.HZCRType,'''')=''<27>ɹ<EFBFBD><C9B9>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'') ');
|
||
sql.Add(', DHQty=(select Sum(Qty) from CK_SXPB_CR A where A.SQID=CaiGou_SQ.SQID and A.ZFFlag=0 ');
|
||
sql.Add(' and isnull(A.HZCRType,'''')=''<27>ɹ<EFBFBD><C9B9>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'') ');
|
||
sql.Add(' where SQID='''+Trim(CDS_Main.fieldbyname('SQID').AsString)+'''');
|
||
ExecSQL;
|
||
end; }
|
||
//<2F><><EFBFBD>³<EFBFBD><C2B3><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>ز<EFBFBD>
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update CK_SXPB_CR Set HCPS=(select Sum(PiQty) from CK_SXPB_CR A where A.FromSPID=CK_SXPB_CR.SPID and A.ZFFlag=0)');
|
||
sql.Add(', HCQty=(select Sum(Qty) from CK_SXPB_CR A where A.FromSPID=CK_SXPB_CR.SPID and A.ZFFlag=0)');
|
||
sql.Add(' where SPID=''' + Trim(CDS_Main.fieldbyname('FromSPID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
CDS_Main.Delete;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ɾ<><C9BE><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
|
||
end
|
||
else
|
||
begin
|
||
CDS_Main.Delete;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.TBRKHCClick(Sender: TObject);
|
||
begin
|
||
Panel3.Visible := True;
|
||
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.TBEditClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
Exit;
|
||
if Trim(CDS_Main.fieldbyname('CRType').AsString) = 'ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
Application.MessageBox('ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR_Sub where YFPZNO=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EEB2BB><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
frmShaRKInPutWSQ := TfrmShaRKInPutWSQ.Create(Application);
|
||
with frmShaRKInPutWSQ do
|
||
begin
|
||
FBCId := Trim(CDS_Main.fieldbyname('SPID').AsString);
|
||
TBDel.Visible := False;
|
||
TBAdd.Visible := False;
|
||
if Pos('<27>ز<EFBFBD>', Trim(CDS_Main.fieldbyname('CRType').AsString)) > 0 then
|
||
begin
|
||
ZHFlag := '0';
|
||
end;
|
||
canshu88 := Self.canshu1;
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmShaRKInPutWSQ.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.SPIDKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
{if Length(Trim(SPID.Text))<4 then Exit;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.* ');
|
||
sql.Add(',ConNo=(select ConNo from Contract_Main CM where CM.MainId=A.CGMainId)');
|
||
//sql.Add(' ,ConNo=(select ConNo from Contract_Main CM where CM.MainId=A.CGMainId )');
|
||
sql.Add(' from CK_SXPB_CR A');
|
||
sql.add(' where SPID like :SXID');
|
||
Parameters.ParamByName('SXID').Value:='%'+Trim(SXID.Text)+'%';
|
||
Open;
|
||
//ShowMessage(SQL.Text);
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end; }
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.SPIDChange(Sender: TObject);
|
||
begin
|
||
if Length(Trim(SPID.Text)) < 4 then
|
||
begin
|
||
if Trim(SPID.Text) <> '' then
|
||
Exit;
|
||
end;
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.SPSpecChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.FactoryNameChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.TBZFClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
Exit;
|
||
if Trim(CDS_Main.fieldbyname('SPID').AsString) <> '' then
|
||
begin
|
||
if Trim(CDS_Main.fieldbyname('CRType').AsString) = 'ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
Application.MessageBox('ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR_Sub where YFPZNO=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EEB2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_SXPB_CR where FZSPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
sql.Add(' and CRQtyFlag=-1 and ZFFlag=0 ');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
{ else
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
end;}
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' UPdate CK_SXPB_CR Set ZFFlag=1,ZFTime=Getdate(),ZFPerson=''' + Trim(DName) + '''');
|
||
sql.Add(' where FZSPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵽<EFBFBD><EBB5BD>
|
||
// with ADOQueryCmd do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add('Update CaiGou_SQ Set DHPS=(select Sum(PiQty) from CK_SXPB_CR A where A.SQID=CaiGou_SQ.SQID and A.ZFFlag=0');
|
||
// sql.Add(' and isnull(A.HZCRType,'''')=''<27>ɹ<EFBFBD><C9B9>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'') ');
|
||
// sql.Add(', DHQty=(select Sum(Qty) from CK_SXPB_CR A where A.SQID=CaiGou_SQ.SQID and A.ZFFlag=0 ');
|
||
// sql.Add(' and isnull(A.HZCRType,'''')=''<27>ɹ<EFBFBD><C9B9>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'') ');
|
||
// sql.Add(' where SQID='''+Trim(CDS_Main.fieldbyname('SQID').AsString)+'''');
|
||
// ExecSQL;
|
||
// end;
|
||
//<2F><><EFBFBD>³<EFBFBD><C2B3><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>ز<EFBFBD>
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update CK_SXPB_CR Set HCPS=(select Sum(PiQty) from CK_SXPB_CR A where A.FromSPID=CK_SXPB_CR.SPID and A.ZFFlag=0)');
|
||
sql.Add(', HCQty=(select Sum(Qty) from CK_SXPB_CR A where A.FromSPID=CK_SXPB_CR.SPID and A.ZFFlag=0)');
|
||
sql.Add(' where SPID=''' + Trim(CDS_Main.fieldbyname('FromSPID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
CDS_Main.Delete;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
|
||
end
|
||
else
|
||
begin
|
||
CDS_Main.Delete;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.BatchNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key <> #13 then
|
||
Exit;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.* ');
|
||
sql.Add(' from CK_SXPB_CR A');
|
||
sql.add(' where A.BatchNo=''' + Trim(BatchNo.Text) + '''');
|
||
sql.Add(' and isnull(CKName,'''')=''ɴ<><C9B4>''');
|
||
SQL.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
{if Trim(canshu2)<>'' then
|
||
begin
|
||
SQL.Add(' and isnull(DeptName,'''')='''+Trim(canshu2)+'''');
|
||
end;}
|
||
if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
Sql.Add(' and ZFFlag=0 ');
|
||
end
|
||
else if cxTabControl1.TabIndex = 1 then
|
||
begin
|
||
Sql.Add(' and ZFFlag=1 ');
|
||
end;
|
||
SQL.Add(' order by CRTime desc');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.ToolButton1Click(Sender: TObject);
|
||
var
|
||
filepath: string;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
try
|
||
filepath := ExtractFilePath(Application.ExeName) + 'report\ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD>ⱨ<EFBFBD><E2B1A8>.rmf';
|
||
if not FileExists(Pchar(filepath)) then
|
||
begin
|
||
application.MessageBox(pchar('<27>ļ<EFBFBD>[' + filepath + ']<5D><><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>'), '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_IConError);
|
||
exit;
|
||
end;
|
||
RmVariables['begDate'] := FormatDateTime('yyyy-MM-dd', begdate.Date);
|
||
RmVariables['endDate'] := FormatDateTime('yyyy-MM-dd', enddate.Date);
|
||
RM1.LoadFromFile(filepath);
|
||
RM1.ShowReport;
|
||
finally
|
||
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.TBRKQCClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmShaRKInPutWSQ := TfrmShaRKInPutWSQ.Create(Application);
|
||
with frmShaRKInPutWSQ do
|
||
begin
|
||
FBCId := '';
|
||
FCRType := '<27>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD>';
|
||
FHZCRType := '<27>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD>';
|
||
ZHFlag := '1';
|
||
frmShaRKInPutWSQ.canshu3 := Trim(Self.canshu3);
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmShaRKInPutWSQ.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.TBRKZDClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmShaRKInPutWSQ := TfrmShaRKInPutWSQ.Create(Application);
|
||
with frmShaRKInPutWSQ do
|
||
begin
|
||
FBCId := '';
|
||
FCRType := '<27>ͻ<EFBFBD><CDBB>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD>';
|
||
FHZCRType := '<27>ͻ<EFBFBD><CDBB>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD>';
|
||
ZHFlag := '1';
|
||
frmShaRKInPutWSQ.canshu3 := Trim(Self.canshu3);
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmShaRKInPutWSQ.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.TBRKCGJGClick(Sender: TObject);
|
||
begin
|
||
Panel2.Visible := True;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmFileUp := TfrmFileUp.Create(Application);
|
||
with frmFileUp do
|
||
begin
|
||
Code.Text := Trim(Self.CDS_Main.fieldbyname('SPID').AsString);
|
||
CYID := Trim(Self.CDS_Main.fieldbyname('SPID').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
//Self.InitGrid();
|
||
//Self.CDS_Main.Locate('SPID',CYID,[]);
|
||
end;
|
||
end;
|
||
finally
|
||
frmFileUp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.InitImage();
|
||
var
|
||
i, j: integer;
|
||
jpg: TJpegImage;
|
||
myStream: TADOBlobStream;
|
||
begin
|
||
|
||
j := length(Mach);
|
||
if j > 0 then
|
||
begin
|
||
for i := 0 to j - 1 do
|
||
begin
|
||
Mach[i].free;
|
||
end;
|
||
end;
|
||
SetLength(Mach, 0);
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
try
|
||
with adoqueryPicture do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' select A.TFID,A.WBID,A.FilesOther,B.FileName from TP_File A,XD_File B where A.TFID =B.XFID ');
|
||
if CDS_Main.IsEmpty = False then
|
||
begin
|
||
sql.Add('and A.WBID=' + quotedstr(trim(CDS_Main.fieldbyname('SPID').AsString)));
|
||
end
|
||
else
|
||
begin
|
||
sql.add(' and 1=2');
|
||
end;
|
||
open;
|
||
end;
|
||
j := adoqueryPicture.RecordCount;
|
||
if j < 1 then
|
||
exit;
|
||
adoqueryPicture.DisableControls;
|
||
adoqueryPicture.First;
|
||
SetLength(Mach, j);
|
||
jpg := TJpegImage.Create();
|
||
for i := 0 to j - 1 do
|
||
begin
|
||
if triM(adoqueryPicture.fieldbyname('FilesOther').AsString) <> '' then
|
||
begin
|
||
myStream := tadoblobstream.Create(tblobfield(adoqueryPicture.fieldbyname('FilesOther')), bmread);
|
||
jpg.LoadFromStream(myStream);
|
||
Mach[i] := TfrmSlt.Create(Self);
|
||
Mach[i].Name := trim(adoqueryPicture.fieldbyname('TFID').AsString);
|
||
Mach[i].Parent := ScrollBox1;
|
||
Mach[i].Left := 0 + i * 165;
|
||
Mach[i].Init(adoqueryPicture.fieldbyname('TFID').AsString, adoqueryPicture.fieldbyname('FileName').AsString, jpg);
|
||
end;
|
||
adoqueryPicture.Next;
|
||
end;
|
||
adoqueryPicture.EnableControls;
|
||
finally
|
||
jpg.free;
|
||
application.ProcessMessages;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
InitImage();
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
if CDS_Main.IsEmpty = false then
|
||
sql.Add('select * from GYS_Qty_MX where WBID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''')
|
||
else
|
||
sql.Add('select * from GYS_Qty_MX where 1=2');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_MX);
|
||
SInitCDSData20(ADOQueryTemp, CDS_MX);
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.N3Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_MX, True);
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.N4Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_MX, False);
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.ToolButton3Click(Sender: TObject);
|
||
var
|
||
fPrintFile, FFCYID: string;
|
||
DPS, i, j: Integer;
|
||
Txt, fImagePath: string;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
begin
|
||
SPID.SetFocus;
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ɴ<>߱<EFBFBD>ǩ.rmf';
|
||
CDS_Main.DisableControls;
|
||
DPS := 0;
|
||
FFCYID := '';
|
||
i := 1;
|
||
j := 1;
|
||
with CDS_MX do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if CDS_MX.FieldByName('SSel').AsBoolean = True then
|
||
begin
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt := Trim(CDS_MX.fieldbyname('SMID').AsString);
|
||
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
||
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
||
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
||
if FileExists(fImagePath) then
|
||
DeleteFile(fImagePath);
|
||
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
|
||
for i := 1 to j do
|
||
begin
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RMVariables['SPName'] := Trim(CDS_Main.fieldbyname('SPName').AsString);
|
||
RMVariables['FactoryName'] := Trim(CDS_Main.fieldbyname('FactoryName').AsString);
|
||
RMVariables['BatchNo'] := Trim(CDS_Main.fieldbyname('BatchNo').AsString);
|
||
RMVariables['SPColor'] := Trim(CDS_Main.fieldbyname('SPColor').AsString);
|
||
RMVariables['MXQty'] := CDS_MX.fieldbyname('MXQty').Value;
|
||
RM1.PrintReport;
|
||
// RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\ɴ<>߱<EFBFBD>ǩ.rmf'), '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
CDS_Main.EnableControls;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.Button1Click(Sender: TObject);
|
||
begin
|
||
if Trim(CGJGType.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27>ɹ<EFBFBD><C9B9>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
Panel2.Visible := False;
|
||
try
|
||
frmShaRKInPutWSQ := TfrmShaRKInPutWSQ.Create(Application);
|
||
with frmShaRKInPutWSQ do
|
||
begin
|
||
FBCId := '';
|
||
FCRType := Trim(Self.CGJGType.Text);
|
||
ZHFlag := '1';
|
||
frmShaRKInPutWSQ.canshu3 := Trim(Self.canshu3);
|
||
FHZCRType := '<27>ɹ<EFBFBD><C9B9>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmShaRKInPutWSQ.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.Button2Click(Sender: TObject);
|
||
begin
|
||
Panel2.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.Button3Click(Sender: TObject);
|
||
begin
|
||
if Trim(JGWZHCType.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27>ӹ<EFBFBD>δ<EFBFBD><CEB4><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
Panel3.Visible := False;
|
||
try
|
||
frmShaRKInPutWSQ := TfrmShaRKInPutWSQ.Create(Application);
|
||
with frmShaRKInPutWSQ do
|
||
begin
|
||
FBCId := '';
|
||
FCRType := Trim(Self.JGWZHCType.Text);
|
||
ZHFlag := '0';
|
||
frmShaRKInPutWSQ.canshu3 := Trim(Self.canshu3);
|
||
FHZCRType := '<27>ӹ<EFBFBD>δ<EFBFBD><CEB4><EFBFBD>ز<EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmShaRKInPutWSQ.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.Button4Click(Sender: TObject);
|
||
begin
|
||
Panel3.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.ToolButton4Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('exec P_Print_SXRK' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date))));
|
||
SQL.Add(',''<27><>'' ');
|
||
Open;
|
||
// ShowMessage(SQL.Text);
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, ClientDataSet1);
|
||
SInitCDSData20(ADOQueryTemp, ClientDataSet1);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>걨<EFBFBD><EAB1A8>.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
// RMVariables['ConNo']:=Order_Main.fieldbyname('ConNo').Value;
|
||
RMGridReport1.LoadFromFile(fPrintFile);
|
||
RMGridReport1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>걨<EFBFBD><EAB1A8>.rmf'), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.ToolButton5Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('exec P_Print_SXRK' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date))));
|
||
SQL.Add(',''<27><>'' ');
|
||
Open;
|
||
// ShowMessage(SQL.Text);
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, ClientDataSet1);
|
||
SInitCDSData20(ADOQueryTemp, ClientDataSet1);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><C2B1><EFBFBD>.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
// RMVariables['ConNo']:=Order_Main.fieldbyname('ConNo').Value;
|
||
RMGridReport1.LoadFromFile(fPrintFile);
|
||
RMGridReport1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><C2B1><EFBFBD>.rmf'), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.ToolButton6Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmShaRKInPutWSQ := TfrmShaRKInPutWSQ.Create(Application);
|
||
with frmShaRKInPutWSQ do
|
||
begin
|
||
FBCId := '';
|
||
FCRType := '<27><>ӯ<EFBFBD><D3AF><EFBFBD><EFBFBD>';
|
||
FHZCRType := '<27><>ӯ<EFBFBD><D3AF><EFBFBD><EFBFBD>';
|
||
ZHFlag := '1';
|
||
frmShaRKInPutWSQ.canshu3 := Trim(Self.canshu3);
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmShaRKInPutWSQ.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.TBPriceClick(Sender: TObject);
|
||
var
|
||
str: string;
|
||
dstr: Double;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
if InputQuery('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', str) then
|
||
begin
|
||
if TryStrToFloat(str, dstr) then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' UPdate CK_SXPB_CR Set Price=' + str);
|
||
sql.Add(' , Money=' + str + '*Qty ');
|
||
sql.Add(' where SPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
Application.MessageBox('ȷ<>ϳɹ<CFB3>!', '<27><>ʾ', 0);
|
||
with CDS_Main do
|
||
begin
|
||
Edit;
|
||
FieldByName('Price').Value := dstr;
|
||
FieldByName('Money').Value := FieldByName('Qty').AsFloat * dstr;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmShaRKListWSQ.chkpriceClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
end.
|
||
|