2027 lines
59 KiB
ObjectPascal
2027 lines
59 KiB
ObjectPascal
![]() |
unit U_JYGLlist;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, ComCtrls, ToolWin, StdCtrls, ExtCtrls, cxStyles, cxCustomData,
|
|||
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData,
|
|||
|
cxButtonEdit, cxDropDownEdit, cxGridLevel, cxGridCustomTableView,
|
|||
|
cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
|
|||
|
cxGrid, DBClient, ADODB, cxGridCustomPopupMenu, cxGridPopupMenu, RM_Common,
|
|||
|
RM_Class, RM_e_Xls, RM_GridReport, RM_System, RM_Dataset, cxTextEdit, cxPC,
|
|||
|
cxCheckBox, Menus, U_SLT, jpeg, cxContainer, cxMaskEdit, MovePanel,
|
|||
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu,
|
|||
|
dxSkinsCore, dxSkinsDefaultPainters, dxSkinscxPCPainter;
|
|||
|
|
|||
|
type
|
|||
|
TfrmJYGLlist = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBExport: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1P_CodeName: TcxGridDBColumn;
|
|||
|
v1P_SPEC: TcxGridDBColumn;
|
|||
|
v1P_MF: TcxGridDBColumn;
|
|||
|
v1P_KZ: TcxGridDBColumn;
|
|||
|
v1Qty: TcxGridDBColumn;
|
|||
|
v1QtyUnit: TcxGridDBColumn;
|
|||
|
v1Note: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
v1CRType: TcxGridDBColumn;
|
|||
|
v1CRTime: TcxGridDBColumn;
|
|||
|
v1CRNO: TcxGridDBColumn;
|
|||
|
v1Filler: TcxGridDBColumn;
|
|||
|
v1FillTime: TcxGridDBColumn;
|
|||
|
Label2: TLabel;
|
|||
|
CRType: TComboBox;
|
|||
|
Label5: TLabel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryTmp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOPrint: TADOQuery;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
v1P_Code: TcxGridDBColumn;
|
|||
|
v1inoutNO: TcxGridDBColumn;
|
|||
|
inoutNo: TEdit;
|
|||
|
Label7: TLabel;
|
|||
|
v1custName: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
cxStyle2: TcxStyle;
|
|||
|
cxStyle_gridRow: TcxStyle;
|
|||
|
cxStyle_gridFoot: TcxStyle;
|
|||
|
cxStyle_gridHead: TcxStyle;
|
|||
|
cxStyle_gridGroupBox: TcxStyle;
|
|||
|
cxStyle_yellow: TcxStyle;
|
|||
|
cxStyle_Red: TcxStyle;
|
|||
|
cxStyle_fontBlack: TcxStyle;
|
|||
|
cxStyle_fontclFuchsia: TcxStyle;
|
|||
|
cxStyle_fontclPurple: TcxStyle;
|
|||
|
cxStyle_fontclGreen: TcxStyle;
|
|||
|
cxStyle_fontclBlue: TcxStyle;
|
|||
|
cxStyle_fontclTeal: TcxStyle;
|
|||
|
cxStyle_fontclOlive: TcxStyle;
|
|||
|
Label8: TLabel;
|
|||
|
ToFactoryName: TEdit;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
v1Column18: TcxGridDBColumn;
|
|||
|
RM1: TRMGridReport;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
P_CodeName: TEdit;
|
|||
|
P_Color: TEdit;
|
|||
|
Label10: TLabel;
|
|||
|
Label11: TLabel;
|
|||
|
P_Code: TEdit;
|
|||
|
Label14: TLabel;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
GroupBox1: TGroupBox;
|
|||
|
ScrollBox1: TScrollBox;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
adoqueryPicture: TADOQuery;
|
|||
|
tbChk: TToolButton;
|
|||
|
tbChkNo: TToolButton;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
btn1: TToolButton;
|
|||
|
cv1Column6: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
btnJieShou: TToolButton;
|
|||
|
MovePanel1: TMovePanel;
|
|||
|
JSY: TcxButtonEdit;
|
|||
|
Label3: TLabel;
|
|||
|
Button1: TButton;
|
|||
|
Button2: TButton;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
btnTJ: TToolButton;
|
|||
|
btnTJCX: TToolButton;
|
|||
|
cxStyle3: TcxStyle;
|
|||
|
cxStyleRepository2: TcxStyleRepository;
|
|||
|
cxStyle4: TcxStyle;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
btn2: TToolButton;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
Label4: TLabel;
|
|||
|
CPLeiBie: TComboBox;
|
|||
|
Label6: TLabel;
|
|||
|
salesman: TEdit;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
cxTabControl2: TcxTabControl;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
Label9: TLabel;
|
|||
|
KUWEI: TEdit;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure OrderNoChange(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBEditClick(Sender: TObject);
|
|||
|
procedure TBDelClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure v1Column6CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure tbChkClick(Sender: TObject);
|
|||
|
procedure tbChkNoClick(Sender: TObject);
|
|||
|
procedure btn1Click(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure btnJieShouClick(Sender: TObject);
|
|||
|
procedure JSYPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure btnTJClick(Sender: TObject);
|
|||
|
procedure btnTJCXClick(Sender: TObject);
|
|||
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure btn2Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure cv1Column6CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
procedure cxTabControl2Change(Sender: TObject);
|
|||
|
procedure salesmanKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure CRTypeChange(Sender: TObject);
|
|||
|
procedure CPLeiBieChange(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
private
|
|||
|
procedure InitGrid();
|
|||
|
function YSData(ADO: TADOQuery): Boolean;
|
|||
|
function YSData_Other(ADO: TADOQuery; fYFName: string; fmoney: double): Boolean;
|
|||
|
procedure SetStatus();
|
|||
|
procedure InitImage();
|
|||
|
procedure PrintCKMDG(MRKOrdID: string);
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1, canshu2, fCKName: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
Mach: array of TfrmSlt;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun10, U_ZDYHelp, U_JYGLCK, u_fun;
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmJYGLlist.PrintCKMDG(MRKOrdID: string);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
ExportFtErpFile('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥.rmf', ADOQueryTmp);
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
|
|||
|
with ADOPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('EXEC P_Print_dysqd4 @FSID=' + quotedstr(Trim(CDS_Main.fieldbyname('CRNO').AsString)));
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim(ADOPrint.fieldbyname('FSID').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;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥.rmf';
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
// RM1.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
|
|||
|
// RM2.PrintReport;
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.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('MJID').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 TfrmJYGLlist.SetStatus();
|
|||
|
begin
|
|||
|
|
|||
|
tbADD.Visible := False;
|
|||
|
tbEdit.Visible := False;
|
|||
|
tbChk.Visible := False;
|
|||
|
tbChkNo.Visible := False;
|
|||
|
TBDel.Visible := False;
|
|||
|
|
|||
|
btnJieShou.Visible := False;
|
|||
|
ToolButton3.Visible := False;
|
|||
|
btnTJ.Visible := False;
|
|||
|
btnTJCX.Visible := False;
|
|||
|
btn2.Visible := True;
|
|||
|
ToolButton4.Visible := true;
|
|||
|
ToolButton2.Visible := true;
|
|||
|
ToolButton5.Visible := False;
|
|||
|
ToolButton1.Visible := TRUE;
|
|||
|
|
|||
|
if (Trim(canshu1) = '¼<><C2BC>') or (Trim(canshu1) = '<27>鳤') then
|
|||
|
begin
|
|||
|
cxTabControl2.Visible := False;
|
|||
|
cxTabControl1.Visible := true;
|
|||
|
btn2.Visible := False;
|
|||
|
end;
|
|||
|
if Trim(canshu1) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
cxTabControl2.Visible := true;
|
|||
|
cxTabControl1.Visible := False;
|
|||
|
|
|||
|
end;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
ToolButton5.Visible := true;
|
|||
|
if (Trim(CanShu1) = '¼<><C2BC>') or (Trim(canshu1) = '<27>鳤') then
|
|||
|
begin
|
|||
|
tbADD.Visible := True;
|
|||
|
tbEdit.Visible := True;
|
|||
|
TBDel.Visible := True;
|
|||
|
btnTJ.Visible := True;
|
|||
|
end;
|
|||
|
if Trim(CanShu1) = '<27>ֿ<EFBFBD>' then
|
|||
|
begin
|
|||
|
tbEdit.Visible := True;
|
|||
|
end;
|
|||
|
ToolButton4.Visible := false;
|
|||
|
ToolButton2.Visible := false;
|
|||
|
ToolButton1.Visible := False;
|
|||
|
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
if Trim(CanShu1) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
btnJieShou.Visible := True;
|
|||
|
end;
|
|||
|
if Trim(CanShu1) = '¼<><C2BC>' then
|
|||
|
begin
|
|||
|
btnTJCX.Visible := True;
|
|||
|
end;
|
|||
|
ToolButton4.Visible := false;
|
|||
|
ToolButton2.Visible := false;
|
|||
|
ToolButton1.Visible := False;
|
|||
|
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
if Trim(CanShu1) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
tbChk.Visible := True;
|
|||
|
ToolButton3.Visible := TRUE;
|
|||
|
end;
|
|||
|
if Trim(CanShu1) = '<27>ֿ<EFBFBD>' then
|
|||
|
begin
|
|||
|
tbChk.Visible := True;
|
|||
|
ToolButton3.Visible := TRUE;
|
|||
|
end;
|
|||
|
end;
|
|||
|
3:
|
|||
|
begin
|
|||
|
if Trim(CanShu1) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
tbChkNo.Visible := True;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
4:
|
|||
|
begin
|
|||
|
ToolButton1.Visible := False;
|
|||
|
ToolButton4.Visible := false;
|
|||
|
ToolButton2.Visible := false;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmJYGLlist.YSData(ADO: TADOQuery): Boolean;
|
|||
|
var
|
|||
|
CRID, YFID, Price, PriceUnit, OrderUnit, FComTaiTou, cust: string;
|
|||
|
begin
|
|||
|
Result := False;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where FactoryName=''' + Trim(ADO.fieldbyname('custName').asstring) + ''' and YFDefFlag1=0 ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if not ADOQueryTmp.IsEmpty then
|
|||
|
begin
|
|||
|
CRID := ADOQueryTmp.fieldbyname('CRID').AsString;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
|
|||
|
sql.Add('select * from YF_Money_CRID ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
CRID := ADOQueryCmd.fieldbyname('CRID').AsString;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CRID').Value := StrToInt(CRID);
|
|||
|
FieldByName('FactoryName').Value := Trim(ADO.fieldbyname('custName').asstring);
|
|||
|
FieldByName('ZdyStr1').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete from YF_Money_CR ');
|
|||
|
sql.Add(' where MainID=''' + Trim(ADO.fieldbyname('CRNO').AsString) + '''');
|
|||
|
sql.Add(' and subID=''' + Trim(ADO.fieldbyname('CRID').AsString) + '''');
|
|||
|
sql.Add(' and YFName=''<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>'' ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR ');
|
|||
|
sql.Add(' where MainID=''' + Trim(ADO.fieldbyname('CRNO').AsString) + '''');
|
|||
|
sql.Add(' and subID=''' + Trim(ADO.fieldbyname('CRID').AsString) + '''');
|
|||
|
sql.Add(' and YFName=''<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryTmp.IsEmpty then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd, YFID, 'CS', 'YF_Money_CR', 4, 1) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('ȡӦ<C8A1><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('YFID').Value := Trim(YFID);
|
|||
|
FieldByName('YFTypeId').Value := Trim(ADO.fieldbyname('CRNO').AsString);
|
|||
|
FieldByName('CRID').Value := StrToInt(CRID);
|
|||
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
FieldByName('CRType').Value := 'Ӧ<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>';
|
|||
|
FieldByName('CRFlag').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('QtyFlag').Value := 1;
|
|||
|
FieldByName('FactoryName').Value := Trim(ADO.fieldbyname('custName').asstring);
|
|||
|
FieldByName('CRTime').Value := Trim(FormatDateTime('yyyy-MM-dd', ADO.fieldbyname('CRTime').AsDateTime));
|
|||
|
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('ps').Value := ADO.fieldbyname('RollNum').AsFloat;
|
|||
|
FieldByName('Qty').Value := ADO.fieldbyname('Qty').AsFloat;
|
|||
|
FieldByName('Price').Value := ADO.fieldbyname('Price').AsFloat;
|
|||
|
FieldByName('Money').Value := ADO.fieldbyname('Money').AsFloat;
|
|||
|
FieldByName('BBMoney').Value := ADO.fieldbyname('Money').AsFloat;
|
|||
|
FieldByName('HuiLv').Value := 1;
|
|||
|
FieldByName('BZType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('QtyUnit').Value := Trim(ADO.fieldbyname('QtyUnit').AsString);
|
|||
|
FieldByName('ComTaiTou').Value := Trim(cust);
|
|||
|
FieldByName('YFName').Value := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('MainId').Value := Trim(ADO.fieldbyname('CRNO').AsString);
|
|||
|
FieldByName('subID').Value := Trim(ADO.fieldbyname('CRID').AsString);
|
|||
|
FieldByName('status').Value := '0';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
YFID := Trim(ADOQueryTmp.fieldbyname('YFID').AsString);
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(' where CRID=' + CRID);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
Result := True;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmJYGLlist.YSData_Other(ADO: TADOQuery; fYFName: string; fmoney: double): Boolean;
|
|||
|
var
|
|||
|
CRID, YFID, Price, PriceUnit, OrderUnit, FComTaiTou, cust: string;
|
|||
|
begin
|
|||
|
Result := False;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where FactoryName=''' + Trim(ADO.fieldbyname('custName').asstring) + ''' and YFDefFlag1=0 ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if not ADOQueryTmp.IsEmpty then
|
|||
|
begin
|
|||
|
CRID := ADOQueryTmp.fieldbyname('CRID').AsString;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
|
|||
|
sql.Add('select * from YF_Money_CRID ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
CRID := ADOQueryCmd.fieldbyname('CRID').AsString;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CRID').Value := StrToInt(CRID);
|
|||
|
FieldByName('FactoryName').Value := Trim(ADO.fieldbyname('custName').asstring);
|
|||
|
FieldByName('ZdyStr1').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete from YF_Money_CR ');
|
|||
|
sql.Add(' where MainID=''' + Trim(ADO.fieldbyname('CRNO').AsString) + '''');
|
|||
|
sql.Add(' and subID=''' + Trim(ADO.fieldbyname('CRID').AsString) + '''');
|
|||
|
sql.Add(' and YFName=''' + trim(fYFName) + ''' ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR ');
|
|||
|
sql.Add(' where MainID=''' + Trim(ADO.fieldbyname('CRNO').AsString) + '''');
|
|||
|
sql.Add(' and subID=''' + Trim(ADO.fieldbyname('CRID').AsString) + '''');
|
|||
|
sql.Add(' and YFName=''' + trim(fYFName) + ''' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryTmp.IsEmpty then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd, YFID, 'CS', 'YF_Money_CR', 4, 1) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('ȡӦ<C8A1><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('YFID').Value := Trim(YFID);
|
|||
|
FieldByName('YFTypeId').Value := Trim(ADO.fieldbyname('CRNO').AsString);
|
|||
|
FieldByName('CRID').Value := StrToInt(CRID);
|
|||
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
FieldByName('CRType').Value := 'Ӧ<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>';
|
|||
|
FieldByName('CRFlag').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('QtyFlag').Value := 1;
|
|||
|
FieldByName('FactoryName').Value := Trim(ADO.fieldbyname('custName').asstring);
|
|||
|
FieldByName('CRTime').Value := Trim(FormatDateTime('yyyy-MM-dd', ADO.fieldbyname('CRTIme').AsDateTime));
|
|||
|
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('Qty').Value := 1;
|
|||
|
FieldByName('Price').Value := fmoney;
|
|||
|
FieldByName('Money').Value := fmoney;
|
|||
|
FieldByName('BBMoney').Value := fmoney;
|
|||
|
FieldByName('HuiLv').Value := 1;
|
|||
|
FieldByName('BZType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('QtyUnit').Value := '<27><>';
|
|||
|
FieldByName('ComTaiTou').Value := Trim(cust);
|
|||
|
FieldByName('YFName').Value := fYFName;
|
|||
|
FieldByName('MainId').Value := Trim(ADO.fieldbyname('CRNO').AsString);
|
|||
|
FieldByName('subID').Value := Trim(ADO.fieldbyname('CRID').AsString);
|
|||
|
FieldByName('status').Value := '0';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
YFID := Trim(ADOQueryTmp.fieldbyname('YFID').AsString);
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(' where CRID=' + CRID);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
Result := True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.InitGrid();
|
|||
|
var
|
|||
|
Pwhere: string;
|
|||
|
begin
|
|||
|
if SGetFilters(Panel1, 1, 2) <> '' then
|
|||
|
Pwhere := ' and ' + SGetFilters(Panel1, 1, 2);
|
|||
|
try
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.*,ZSEASON=ISNULL(SEASON,'''')+ISNULL(SEASON2,'''') ');
|
|||
|
sql.Add(',CWYRZ=cast((case when isnull((select count(YFPZNO) from YF_Money_CR_Sub X where X.YFPZNO=A.INOUTNO ),0)>0 then 1 else 0 end) as bit)');
|
|||
|
sql.Add(',ISSQ=cast((case when isnull((select count(FROMYPID) from FHSQ_SUB X where X.FROMYPID=A.CRNO ),0)>0 then 1 else 0 end) as bit)');
|
|||
|
SQL.Add(' from CK_Sample_CR A ');
|
|||
|
sql.Add(' where CRFlag=''<27><><EFBFBD><EFBFBD>'' and A.valid=''Y'' ');
|
|||
|
sql.Add(' and VisType=''<27><><EFBFBD><EFBFBD>'' and CKName=' + quotedstr(trim(fCKName)));
|
|||
|
if trim(canshu1) = '¼<><C2BC>' then
|
|||
|
begin
|
|||
|
sql.Add(' AND (FILLER= ' + QuotedStr((DName)));
|
|||
|
SQL.Add('OR salesman=' + QuotedStr((DName)));
|
|||
|
SQL.Add(')');
|
|||
|
end;
|
|||
|
if trim(canshu1) = '<27>鳤' then
|
|||
|
begin
|
|||
|
sql.Add('and (a.filler in (select username from SY_User S where S.UDEPT=(SELECT UDEPT FROM SY_User U WHERE U.USERNAME= ' + QUOTEDSTR(Trim(DName)));
|
|||
|
SQL.Add('))');
|
|||
|
sql.Add('or FILLER= ' + QuotedStr((DName)));
|
|||
|
sql.add(')');
|
|||
|
|
|||
|
end;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(A.Chkstatus,''-1'')=''-1''');
|
|||
|
sql.Add('and a.jsperson is null');
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(A.Chkstatus,''-1'')=''0''');
|
|||
|
sql.Add('and a.jsperson is null');
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(A.Chkstatus,''-1'')=''0''');
|
|||
|
sql.Add(' and CRTime>=''' + formatdateTime('yyyy-MM-dd', begdate.Date) + ''' ');
|
|||
|
sql.Add(' and CRTime<''' + formatdateTime('yyyy-MM-dd', enddate.Date + 1) + ''' ');
|
|||
|
sql.Add('and a.jsperson is not null');
|
|||
|
end;
|
|||
|
3:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(A.Chkstatus,''-1'')=''1''');
|
|||
|
sql.Add(' and CRTime>=''' + formatdateTime('yyyy-MM-dd', begdate.Date) + ''' ');
|
|||
|
sql.Add(' and CRTime<''' + formatdateTime('yyyy-MM-dd', enddate.Date + 1) + ''' ');
|
|||
|
end;
|
|||
|
4:
|
|||
|
begin
|
|||
|
// sql.Add(' and isnull(A.Chkstatus,''-1'')=''1''');
|
|||
|
sql.Add(' and CRTime>=''' + formatdateTime('yyyy-MM-dd', begdate.Date) + ''' ');
|
|||
|
sql.Add(' and CRTime<''' + formatdateTime('yyyy-MM-dd', enddate.Date + 1) + ''' ');
|
|||
|
end;
|
|||
|
5:
|
|||
|
begin
|
|||
|
if canshu1 = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(A.Chkstatus,''-1'')<>''-1''');
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
SQL.Add(Pwhere);
|
|||
|
// showmessage(sql.Text);
|
|||
|
open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := cafree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.TBAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
frmJYGLCK := TfrmJYGLCK.create(self);
|
|||
|
with frmJYGLCK do
|
|||
|
begin
|
|||
|
fkeyNo := '';
|
|||
|
fType := 0;
|
|||
|
fCKName := trim(self.fCKName);
|
|||
|
canshu1 := Self.canshu1;
|
|||
|
jyfs := '<27><><EFBFBD><EFBFBD>';
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
self.CDS_Main.Locate('crNo', trim(fkeyNo), []);
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.OrderNoChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQuerymain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQuerymain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS20(ADOQuerymain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQuerymain, CDS_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
readCxGrid(trim(self.Caption), Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>9');
|
|||
|
SetStatus();
|
|||
|
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
EndDate.Date := SGetServerDate10(ADOQueryTmp);
|
|||
|
BegDate.Date := EndDate.Date - 1;
|
|||
|
cxGrid1.Align := alclient;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
writeCxGrid(trim(self.Caption), Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>9');
|
|||
|
close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if cds_main.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
if (cds_main.fieldbyname('Filler').AsString <> trim(DName)) and (trim(canshu2) <> '<27><>Ȩ<EFBFBD><C8A8>') and (canshu1 <> '<27>ֿ<EFBFBD>') then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_Sample_CR where Chkstatus=''1'' ');
|
|||
|
SQL.Add('and inoutno=' + quotedstr(trim(cds_main.fieldbyname('inoutno').AsString)));
|
|||
|
SQL.Add('AND VALID=''Y''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTmp.IsEmpty = False then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
frmJYGLCK := TfrmJYGLCK.create(self);
|
|||
|
with frmJYGLCK do
|
|||
|
begin
|
|||
|
fkeyNo := self.cds_main.fieldbyname('crno').AsString;
|
|||
|
// ShowMessage(fkeyNo);
|
|||
|
fxiugai := self.cds_main.fieldbyname('inoutno').AsString;
|
|||
|
fType := 1;
|
|||
|
InoutNo.Enabled := false;
|
|||
|
fCKName := trim(self.fCKName);
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
self.CDS_Main.Locate('CRNO', trim(fkeyNo), []);
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.TBDelClick(Sender: TObject);
|
|||
|
var
|
|||
|
YFID, CRID, note: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if canshu1 <> '<27>ֿ<EFBFBD>' then
|
|||
|
begin
|
|||
|
if Trim(CDS_Main.fieldbyname('Filler').AsString) <> Trim(DName) then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_Sample_CR where Chkstatus=''1'' ');
|
|||
|
SQL.Add('and inoutno=' + quotedstr(trim(cds_main.fieldbyname('inoutno').AsString)));
|
|||
|
SQL.Add('AND VALID=''Y''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTmp.IsEmpty = False then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from fhsq_main where ');
|
|||
|
SQL.Add(' FROMCRNO=' + quotedstr(trim(cds_main.fieldbyname('crno').AsString)));
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTmp.IsEmpty = False then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
if Trim(CDS_Main.FieldByName('CRNO').AsString) <> '' then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CK_Sample_CR set Valid=''N'' where CRNO=' + quotedstr(Trim(CDS_Main.FieldByName('CRNO').AsString)));
|
|||
|
sql.Add('delete yp_inout where fromCRNO=' + quotedstr(Trim(CDS_Main.FieldByName('CRNO').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><C6B7><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('crno').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('exec P_Up_SampleKc ' + quotedstr(trim(CDS_Main.fieldbyname('MJID').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
except
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
initGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel(self.Caption, cxgrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.v1Column6CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
var
|
|||
|
colIdx0, colIdx1: integer;
|
|||
|
begin
|
|||
|
colIdx0 := tv1.GetColumnByFieldName('CRNO').Index;
|
|||
|
if (ARow1.Values[colIdx0] = ARow2.Values[colIdx0]) then
|
|||
|
AAreEqual := True
|
|||
|
else
|
|||
|
AAreEqual := False;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
InitImage();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.tbChkClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.Locate('ssel', true, []) = false then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update CK_Sample_CR SET Chkstatus=''1'',Chktime=getdate(),Chker= ' + quotedstr(trim(DName)));
|
|||
|
sql.Add('where CRNO=' + quotedstr(trim(CDS_Main.fieldbyname('CRNO').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('select * from CK_Sample_CR ');
|
|||
|
// sql.Add('where crno=' + quotedstr(trim(CDS_Main.fieldbyname('crno').AsString)));
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// if ADOQueryCmd.fieldbyname('mjid').AsString <> '' then
|
|||
|
// begin
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// SQL.Clear;
|
|||
|
// SQL.Add('exec P_Up_SampleKc ' + quotedstr(trim(CDS_Main.fieldbyname('MJID').AsString)));
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.tbChkNoClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.Locate('ssel', true, []) = false then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from yf_money_cr_sub');
|
|||
|
sql.Add('where yfpzno=' + quotedstr(trim(CDS_Main.fieldbyname('INOUTNO').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTmp.IsEmpty = False then
|
|||
|
begin
|
|||
|
CDS_Main.EnableControls;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>˿<CBBF>ܳ<EFBFBD><DCB3><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update CK_Sample_CR SET Chkstatus=''0'',Chktime=null , Chker=null ');
|
|||
|
sql.Add('where crno=' + quotedstr(trim(CDS_Main.fieldbyname('crno').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('exec P_Up_SampleKc ' + quotedstr(trim(CDS_Main.fieldbyname('MJID').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.btn1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
frmJYGLCK := TfrmJYGLCK.create(self);
|
|||
|
with frmJYGLCK do
|
|||
|
begin
|
|||
|
fkeyNo := '';
|
|||
|
fType := 0;
|
|||
|
fCKName := trim(self.fCKName);
|
|||
|
canshu1 := Self.canshu1;
|
|||
|
jyfs := '<27>ճ<EFBFBD>';
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
self.CDS_Main.Locate('crNo', trim(fkeyNo), []);
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.ToolButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney: string;
|
|||
|
Porderno, LBName, SYRName: string;
|
|||
|
i, j: Integer;
|
|||
|
OrderKg: Double;
|
|||
|
FDate: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
// if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
// begin
|
|||
|
// Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
ExportFtErpFile(Trim(ComboBox1.Text) + '.rmf', ADOQueryTmp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ComboBox1.Text) + '.rmf';
|
|||
|
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('delete TBSubID where DName=''' + Trim(DCode) + '''');
|
|||
|
// ExecSQL;
|
|||
|
// end;
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('SELECT * FROM TBSubID where 1=2 ');
|
|||
|
// open;
|
|||
|
// end;
|
|||
|
// CDS_Main.DisableControls;
|
|||
|
// try
|
|||
|
// ADOQueryCmd.Connection.BeginTrans;
|
|||
|
// with CDS_Main do
|
|||
|
// begin
|
|||
|
// First;
|
|||
|
// while not Eof do
|
|||
|
// begin
|
|||
|
// if Fieldbyname('Ssel').AsBoolean then
|
|||
|
// begin
|
|||
|
//
|
|||
|
// ADOQueryCmd.append;
|
|||
|
// ADOQueryCmd.fieldbyname('SubId').Value := Trim(CDS_Main.fieldbyname('crno').AsString);
|
|||
|
// ADOQueryCmd.fieldbyname('Dname').Value := Trim(DCode);
|
|||
|
// ADOQueryCmd.post;
|
|||
|
// end;
|
|||
|
// Next;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// ADOQueryCmd.Connection.CommitTrans;
|
|||
|
// except
|
|||
|
// ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
// end;
|
|||
|
// CDS_Main.EnableControls;
|
|||
|
if ComboBox1.Text = '<27><>Ʒ<EFBFBD>뵥1' then
|
|||
|
begin
|
|||
|
with ADOPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('EXEC P_Print_YPMD' + QUOTEDSTR(Trim(CDS_Main.fieldbyname('INOUTNO').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end
|
|||
|
else if ComboBox1.Text = '<27><>Ʒ<EFBFBD>뵥2' then
|
|||
|
begin
|
|||
|
with ADOPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('EXEC P_Print_YPMD2' + QUOTEDSTR(Trim(CDS_Main.fieldbyname('INOUTNO').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end
|
|||
|
else if ComboBox1.Text = 'ɫ<><C9AB><EFBFBD>Ұ<EFBFBD><D2B0>뵥' then
|
|||
|
begin
|
|||
|
with ADOPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('EXEC P_Print_YPMD3' + QUOTEDSTR(Trim(CDS_Main.fieldbyname('INOUTNO').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['CustomerNoName'] := CDS_Main.fieldbyname('ToFactoryName').AsString;
|
|||
|
RMVariables['ShouHuoer'] := CDS_Main.fieldbyname('SHer').AsString;
|
|||
|
RMVariables['KHDH'] := CDS_Main.fieldbyname('SHDianHua').AsString;
|
|||
|
RMVariables['FHDZ'] := CDS_Main.fieldbyname('SHDiZhi').AsString;
|
|||
|
RMVariables['filler'] := CDS_Main.fieldbyname('filler').AsString;
|
|||
|
RMVariables['NOTE'] := CDS_Main.fieldbyname('zbzNOTE').AsString;
|
|||
|
RMVariables['crtime'] := CDS_Main.fieldbyname('CRTime').AsDateTime;
|
|||
|
RMVariables['YWY'] := CDS_Main.fieldbyname('SALESMAN').AsString;
|
|||
|
RMVariables['SQDLX'] := CDS_Main.fieldbyname('CPLeiBie').AsString;
|
|||
|
//RMVariables['enddate']:=enddate.DateTime;
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim((trim(CDS_Main.fieldbyname('inoutno').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;
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.btnJieShouClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.Locate('ssel', true, []) = false then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
MovePanel1.VISIBLE := True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.JSYPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'JSPERSON';
|
|||
|
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
JSY.TEXT := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
MovePanel1.visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.Button1Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney: string;
|
|||
|
Porderno, LBName, SYRName: string;
|
|||
|
i, j: Integer;
|
|||
|
OrderKg: Double;
|
|||
|
FDate: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
if JSY.Text = '' then
|
|||
|
begin
|
|||
|
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if (Fieldbyname('ssel').AsBoolean) then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
// sql.Add(' select A.* ');
|
|||
|
// SQL.Add(' from CK_Sample_CR A ');
|
|||
|
// sql.Add(' where CRFlag=''<27><><EFBFBD><EFBFBD>'' and A.valid=''Y'' ');
|
|||
|
// sql.Add(' and VisType=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
// SQL.Add('and crno=' + quotedstr(Trim(CDS_Main.fieldbyname('crno').AsString)));
|
|||
|
|
|||
|
sql.Add(' select A.* ');
|
|||
|
SQL.Add(' from CK_Sample_CR A ');
|
|||
|
sql.Add(' where CRFlag=''<27><><EFBFBD><EFBFBD>'' and A.valid=''Y'' ');
|
|||
|
sql.Add(' and VisType=''<27><><EFBFBD><EFBFBD>'' and CKName=' + quotedstr(trim(fCKName)));
|
|||
|
sql.Add(' and isnull(A.Chkstatus,''-1'')=''0''');
|
|||
|
sql.Add('and a.jsperson is null ');
|
|||
|
SQL.Add('and crno=' + quotedstr(Trim(CDS_Main.fieldbyname('crno').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.IsEmpty = True then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27>ò<EFBFBD><C3B2><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD>ύ״̬', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update CK_Sample_CR SET jsperson=' + quotedstr(Trim(JSY.Text)));
|
|||
|
sql.Add(',jstime=getdate()');
|
|||
|
sql.Add('where CRNO=' + quotedstr(trim(CDS_Main.fieldbyname('CRNO').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
if (CDS_Main.Fieldbyname('CKLX').ASSTRING <> '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>') then
|
|||
|
begin
|
|||
|
ExportFtErpFile('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ.rmf', ADOQueryTmp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ.rmf';
|
|||
|
with ADOPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
SQL.Add(' from CK_Sample_CR A ');
|
|||
|
sql.Add(' where CRFlag=''<27><><EFBFBD><EFBFBD>'' and A.valid=''Y'' ');
|
|||
|
sql.Add(' and VisType=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
SQL.Add('and crno=' + quotedstr(Trim(CDS_Main.fieldbyname('crno').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim((trim(CDS_Main.fieldbyname('crno').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;
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD>ճɹ<D5B3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
MovePanel1.visible := False;
|
|||
|
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update CK_Sample_CR SET jsperson=NULL');
|
|||
|
sql.Add(',jstime=NULL,jsflag=0');
|
|||
|
sql.Add('where CRNO=' + quotedstr(trim(CDS_Main.fieldbyname('CRNO').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.ToolButton4Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney: string;
|
|||
|
Porderno, LBName, SYRName: string;
|
|||
|
i, j: Integer;
|
|||
|
OrderKg: Double;
|
|||
|
FDate: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete TBSubID where DName=''' + Trim(DCode) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT * FROM TBSubID where 1=2 ');
|
|||
|
open;
|
|||
|
end;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('Ssel').AsBoolean then
|
|||
|
begin
|
|||
|
|
|||
|
ADOQueryCmd.append;
|
|||
|
ADOQueryCmd.fieldbyname('SubId').Value := Trim(CDS_Main.fieldbyname('crno').AsString);
|
|||
|
ADOQueryCmd.fieldbyname('Dname').Value := Trim(DCode);
|
|||
|
ADOQueryCmd.post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ExportFtErpFile('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ.rmf', ADOQueryTmp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ.rmf';
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('Ssel').AsBoolean then
|
|||
|
begin
|
|||
|
|
|||
|
with ADOPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
SQL.Add(' from CK_Sample_CR A ');
|
|||
|
sql.Add(' where CRFlag=''<27><><EFBFBD><EFBFBD>'' and A.valid=''Y'' ');
|
|||
|
sql.Add(' and VisType=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
SQL.Add('and crno=' + quotedstr(Trim(CDS_Main.fieldbyname('crno').AsString)));
|
|||
|
// sql.Add('and EXISTS(select SubId from TBSubID X where X.SubId=A.crno and X.DName=' + quotedstr(Trim(DCode)));
|
|||
|
// sql.Add(')');
|
|||
|
// ShowMessage(sql.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
// RMVariables['EngMoney']:=EngMoney;
|
|||
|
//RMVariables['enddate']:=enddate.DateTime;
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim((trim(CDS_Main.fieldbyname('crno').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;
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.btnTJClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.Locate('ssel', true, []) = false then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
if (CDS_Main.fieldbyname('CPLeiBie').AsString = '<27>Ұ<EFBFBD>') or (CDS_Main.fieldbyname('CPLeiBie').AsString = 'ɫ<><C9AB>') then
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update CK_Sample_CR SET jsperson=''ֱ<><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',Chkstatus=0');
|
|||
|
sql.Add(',jstime=getdate()');
|
|||
|
sql.Add('where inoutno=' + quotedstr(trim(CDS_Main.fieldbyname('inoutno').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update CK_Sample_CR SET Chkstatus=''0'',tjdate=geTdate() ');
|
|||
|
sql.Add('where inoutno=' + quotedstr(trim(CDS_Main.fieldbyname('inoutno').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
application.MessageBox('<27>ύ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27>ύʧ<E1BDBB>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.btnTJCXClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.Locate('ssel', true, []) = false then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_Sample_CR ');
|
|||
|
sql.Add('where CRNO=' + quotedstr(trim(CDS_Main.fieldbyname('CRNO').AsString)));
|
|||
|
sql.Add('and jsperson is not null ');
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryTmp.IsEmpty = false then
|
|||
|
begin
|
|||
|
application.MessageBox('<27>ѱ<EFBFBD><D1B1><EFBFBD><EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update CK_Sample_CR SET Chkstatus=''-1'',JSFLAG=''0'',jsperson=NULL,JSTIME=NULL,tjdate=NULL ');
|
|||
|
sql.Add('where CRNO=' + quotedstr(trim(CDS_Main.fieldbyname('CRNO').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
application.MessageBox('<27>ύ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27>ύʧ<E1BDBB>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
// if (AViewInfo.GridRecord.Values[Tv1Column1.Index] <> null) then
|
|||
|
// begin
|
|||
|
// ACanvas.font.Color := clred;
|
|||
|
// end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.btn2Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if (cds_main.Fieldbyname('ssel').AsBoolean = true) and (cds_main.fieldbyname('CKLX').AsString = trim('<27><>Ʒ<EFBFBD>ֿ<EFBFBD>')) and (cds_main.fieldbyname('ISSQ').AsBoolean <> True) then
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('exec P_DO_SCDYSCD @crno=' + quotedstr(trim(CDS_Main.fieldbyname('crno').AsString)));
|
|||
|
SQL.Add(',@dname=' + quotedstr(trim(DName)));
|
|||
|
ExecSQL;
|
|||
|
// ShowMessage(sql.Text);
|
|||
|
end;
|
|||
|
with ADOPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select a.*,fsid=(select top 1 fsid from fhsq_sub v where v.FROMYPID=a.crno) from CK_Sample_CR a where crno=' + quotedstr(Trim(CDS_Main.fieldbyname('crno').AsString)));
|
|||
|
// SQL.Add('EXEC P_Print_dysqd4 @FSID=' + quotedstr(Trim(CDS_Main.fieldbyname('CRNO').AsString)));
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim(ADOPrint.fieldbyname('fsid').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;
|
|||
|
|
|||
|
ExportFtErpFile('<27><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>.rmf', ADOQueryTmp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>.rmf';
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
|||
|
RM1.PrintReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
CDS_Main.EnableControls;
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
// First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
// try
|
|||
|
//
|
|||
|
// ADOQueryCmd.Connection.BeginTrans;
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// SQL.Clear;
|
|||
|
// SQL.Add('exec P_DO_SCDYSCD @crno=' + quotedstr(trim(CDS_Main.fieldbyname('crno').AsString)));
|
|||
|
// SQL.Add(',@dname=' + quotedstr(trim(DName)));
|
|||
|
// ExecSQL;
|
|||
|
// end;
|
|||
|
// ADOQueryCmd.Connection.CommitTrans;
|
|||
|
//// if Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) = IDYES then
|
|||
|
//// begin
|
|||
|
//// PrintCKMDG(Trim(CDS_Main.fieldbyname('crno').AsString));
|
|||
|
//// end;
|
|||
|
// InitGrid();
|
|||
|
// except
|
|||
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.ToolButton2Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if CDS_Main.fieldbyname('ISSQ').AsBoolean <> TRUE then
|
|||
|
begin
|
|||
|
application.MessageBox('δ<><CEB4><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_Main.FieldByName('SSel').AsBoolean = True then
|
|||
|
begin
|
|||
|
|
|||
|
with ADOPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select a.*,fsid=(select top 1 fsid from fhsq_sub v where v.FROMYPID=a.crno) from CK_Sample_CR a where crno=' + quotedstr(Trim(CDS_Main.fieldbyname('crno').AsString)));
|
|||
|
// SQL.Add('EXEC P_Print_dysqd4 @FSID=' + quotedstr(Trim(CDS_Main.fieldbyname('CRNO').AsString)));
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim(ADOPrint.fieldbyname('fsid').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;
|
|||
|
|
|||
|
ExportFtErpFile('<27><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>.rmf', ADOQueryTmp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>.rmf';
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
|||
|
RM1.PrintReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
CDS_Main.EnableControls;
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.cv1Column6CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
begin
|
|||
|
if (ARow1.Values[v1inoutNO.Index] = ARow2.Values[v1inoutNO.Index]) then
|
|||
|
AAreEqual := True
|
|||
|
else
|
|||
|
AAreEqual := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.cxTabControl2Change(Sender: TObject);
|
|||
|
begin
|
|||
|
cxTabControl1.TabIndex := cxTabControl2.TabIndex + 1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.salesmanKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.CRTypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.CPLeiBieChange(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJYGLlist.ToolButton5Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney: string;
|
|||
|
Porderno, LBName, SYRName: string;
|
|||
|
i, j: Integer;
|
|||
|
OrderKg: Double;
|
|||
|
FDate: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
// if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
// begin
|
|||
|
// Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
ExportFtErpFile('<27><>Ʒ<EFBFBD>ͻ<EFBFBD>ȷ<EFBFBD>ϵ<EFBFBD>.rmf', ADOQueryTmp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><>Ʒ<EFBFBD>ͻ<EFBFBD>ȷ<EFBFBD>ϵ<EFBFBD>.rmf';
|
|||
|
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('delete TBSubID where DName=''' + Trim(DCode) + '''');
|
|||
|
// ExecSQL;
|
|||
|
// end;
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('SELECT * FROM TBSubID where 1=2 ');
|
|||
|
// open;
|
|||
|
// end;
|
|||
|
// CDS_Main.DisableControls;
|
|||
|
// try
|
|||
|
// ADOQueryCmd.Connection.BeginTrans;
|
|||
|
// with CDS_Main do
|
|||
|
// begin
|
|||
|
// First;
|
|||
|
// while not Eof do
|
|||
|
// begin
|
|||
|
// if Fieldbyname('Ssel').AsBoolean then
|
|||
|
// begin
|
|||
|
//
|
|||
|
// ADOQueryCmd.append;
|
|||
|
// ADOQueryCmd.fieldbyname('SubId').Value := Trim(CDS_Main.fieldbyname('crno').AsString);
|
|||
|
// ADOQueryCmd.fieldbyname('Dname').Value := Trim(DCode);
|
|||
|
// ADOQueryCmd.post;
|
|||
|
// end;
|
|||
|
// Next;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// ADOQueryCmd.Connection.CommitTrans;
|
|||
|
// except
|
|||
|
// ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
// end;
|
|||
|
// CDS_Main.EnableControls;
|
|||
|
|
|||
|
with ADOPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('EXEC P_Print_YPMD2' + QUOTEDSTR(Trim(CDS_Main.fieldbyname('INOUTNO').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['CustomerNoName'] := CDS_Main.fieldbyname('ToFactoryName').AsString;
|
|||
|
RMVariables['ShouHuoer'] := CDS_Main.fieldbyname('SHer').AsString;
|
|||
|
RMVariables['KHDH'] := CDS_Main.fieldbyname('SHDianHua').AsString;
|
|||
|
RMVariables['FHDZ'] := CDS_Main.fieldbyname('SHDiZhi').AsString;
|
|||
|
RMVariables['filler'] := CDS_Main.fieldbyname('filler').AsString;
|
|||
|
RMVariables['NOTE'] := CDS_Main.fieldbyname('zbzNOTE').AsString;
|
|||
|
RMVariables['crtime'] := CDS_Main.fieldbyname('CRTime').AsDateTime;
|
|||
|
RMVariables['YWY'] := CDS_Main.fieldbyname('SALESMAN').AsString;
|
|||
|
RMVariables['SQDLX'] := CDS_Main.fieldbyname('CPLeiBie').AsString;
|
|||
|
//RMVariables['enddate']:=enddate.DateTime;
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim((trim(CDS_Main.fieldbyname('inoutno').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;
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|