1000 lines
28 KiB
ObjectPascal
1000 lines
28 KiB
ObjectPascal
![]() |
unit U_DJBCKOutList;
|
|||
|
|
|||
|
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,
|
|||
|
RM_BarCode, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
|||
|
dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel,
|
|||
|
dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
|
|||
|
dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans,
|
|||
|
dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky,
|
|||
|
dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
|||
|
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
|||
|
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
|||
|
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
|||
|
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
|
|||
|
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin,
|
|||
|
dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
|
|||
|
dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
|
|||
|
dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine,
|
|||
|
dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue, dxSkinscxPCPainter;
|
|||
|
|
|||
|
type
|
|||
|
TfrmDJBCKOutList = 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;
|
|||
|
RMDBMain: TRMDBDataSet;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
RMDBHZ: TRMDBDataSet;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
CDS_PRT: TClientDataSet;
|
|||
|
TBDel: TToolButton;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column16: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v2Column6: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column18: TcxGridDBColumn;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
v1Column17: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
Label3: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Label8: TLabel;
|
|||
|
Label12: TLabel;
|
|||
|
Label6: TLabel;
|
|||
|
Label7: TLabel;
|
|||
|
SPName: TEdit;
|
|||
|
FactoryName: TEdit;
|
|||
|
SPID: TEdit;
|
|||
|
SPSpec: TEdit;
|
|||
|
CRType: TComboBox;
|
|||
|
SPCF: TEdit;
|
|||
|
QCorderNo: TEdit;
|
|||
|
Label10: TLabel;
|
|||
|
CKorderNo: TEdit;
|
|||
|
Label11: TLabel;
|
|||
|
FromFactoryName: TEdit;
|
|||
|
Label13: TLabel;
|
|||
|
ToFactoryName: TEdit;
|
|||
|
Label9: TLabel;
|
|||
|
Label14: TLabel;
|
|||
|
RCGangNo: TEdit;
|
|||
|
GangNo: TEdit;
|
|||
|
v1Column15: TcxGridDBColumn;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
v1Column21: TcxGridDBColumn;
|
|||
|
Label15: TLabel;
|
|||
|
PRTColor: TEdit;
|
|||
|
Label16: TLabel;
|
|||
|
SOrddefstr1: TEdit;
|
|||
|
Label17: TLabel;
|
|||
|
PRTHX: TEdit;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMBarCodeObject1: TRMBarCodeObject;
|
|||
|
v1Column22: TcxGridDBColumn;
|
|||
|
v1Column23: TcxGridDBColumn;
|
|||
|
v1Column24: TcxGridDBColumn;
|
|||
|
v1Column25: TcxGridDBColumn;
|
|||
|
v1Column26: TcxGridDBColumn;
|
|||
|
v1Column27: TcxGridDBColumn;
|
|||
|
Label18: TLabel;
|
|||
|
SOrddefstr4: TEdit;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
Panel2: TPanel;
|
|||
|
Label19: TLabel;
|
|||
|
Label20: TLabel;
|
|||
|
Button1: TButton;
|
|||
|
Button2: TButton;
|
|||
|
FirstJ: TEdit;
|
|||
|
LastJ: TEdit;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
ToolButton6: TToolButton;
|
|||
|
RM2: TRMGridReport;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
Tv1Column9: 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 SPNameChange(Sender: TObject);
|
|||
|
procedure SPIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure TBDelClick(Sender: TObject);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure TBEditClick(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
private
|
|||
|
canshu1, canshu2: string;
|
|||
|
procedure InitGrid();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmDJBCKOutList: TfrmDJBCKOutList;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_DJBCKOutPut, U_Fun, U_DJBJYInput, U_FjList;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmDJBCKOutList := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
//cxGrid1.Align:=alClient;
|
|||
|
canshu1 := Trim(DParameters1);
|
|||
|
canshu2 := Trim(DParameters2);
|
|||
|
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
|||
|
BegDate.DateTime := EndDate.DateTime - 7;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ,B.SOrddefstr1,B.SOrddefstr4,B.PRTColor,B.PRTHX,B.PRTkuanNO');
|
|||
|
sql.Add(',ismx=cast(case when (select Count(*) from WFB_MJJY_DJB X where X.apid=A.spid)=0 then 0 ');
|
|||
|
|
|||
|
sql.Add(' else 1 end as bit)');
|
|||
|
|
|||
|
sql.Add(',isFJ=cast((case when (select count(*) from TP_File X where X.wbid=A.spid and X.TFType=''DJBCK'')>0 then 1 else 0 end) as bit)');
|
|||
|
|
|||
|
sql.Add(' from CK_SXPB_CR A');
|
|||
|
sql.Add(' left join JYOrder_Sub B on A.ORDSubIdCK=B.SubId');
|
|||
|
sql.add(' where A.CRTime>=:begdate and A.CRTime<:enddate');
|
|||
|
SQL.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
SQL.Add(' and isnull(CKName,'''')=''<27><><EFBFBD>첼'' ');
|
|||
|
|
|||
|
Parameters.ParamByName('begdate').Value := Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
|
|||
|
Parameters.ParamByName('enddate').Value := Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1));
|
|||
|
Open;
|
|||
|
//ShowMessage(SQL.Text);
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
BegDate.SetFocus;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27><><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>PMD', Tv1, '<27><><EFBFBD>ӹ<EFBFBD><D3B9>ֿ<EFBFBD>1');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(canshu2) = '<27>鿴' then
|
|||
|
begin
|
|||
|
TBAdd.Visible := False;
|
|||
|
TBDel.Visible := False;
|
|||
|
TBEdit.Visible := False;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
TBAdd.Visible := True;
|
|||
|
TBDel.Visible := True;
|
|||
|
TBEdit.Visible := True;
|
|||
|
end;
|
|||
|
ReadCxGrid('<27><><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>PMD', Tv1, '<27><><EFBFBD>ӹ<EFBFBD><D3B9>ֿ<EFBFBD>1');
|
|||
|
//InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
exit;
|
|||
|
TcxGridToExcel('<27><><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', cxGrid2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.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 TfrmDJBCKOutList.SPNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.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(' 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 TfrmDJBCKOutList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if Trim(CDS_Main.fieldbyname('CRType').AsString) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value := True;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.TBDelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if Trim(CDS_Main.fieldbyname('SPID').AsString) <> '' then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select Top 1 * from WFB_MJJY where isnull(APID,'''')=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>Ѽ<EFBFBD><D1BC>鲻<EFBFBD><E9B2BB>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(CDS_Main.fieldbyname('CRType').AsString) = 'ƽ<>Ƴ<EFBFBD><C6B3><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_SXPB_CR where FZSPID=');
|
|||
|
sql.Add('(select SPID from CK_SXPB_CR where PYID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
sql.Add(' and isnull(CRType,'''')=''ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'')');
|
|||
|
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;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(CDS_Main.fieldbyname('CRType').AsString) = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_GenDan_CR where FZSPID=');
|
|||
|
sql.Add('(select SPID from CK_GenDan_CR where PYID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
sql.Add(' and isnull(CRType,'''')=''<27><><EFBFBD>첼<EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'')');
|
|||
|
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;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(CDS_Main.fieldbyname('CRType').AsString) = '<27><><EFBFBD><EFBFBD><DEB3><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_GenDan_CR where FZSPID=');
|
|||
|
sql.Add('(select SPID from CK_GenDan_CR where PYID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
sql.Add(' and isnull(CRType,'''')=''<27><><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'')');
|
|||
|
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;
|
|||
|
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(' Update CK_SXPB_CR Set MXKCQty=(select sum(isnull(Qty,0)*CRQtyFlag) from CK_SXPB_CR A where A.FZSPID=CK_SXPB_CR.SPID)');
|
|||
|
sql.Add(',MXKCPiQty=(select sum(isnull(PiQty,0)*CRQtyFlag) from CK_SXPB_CR A where A.FZSPID=CK_SXPB_CR.SPID)');
|
|||
|
sql.Add(',MXKCzhis=(select sum(isnull(zhis,0)*CRQtyFlag) from CK_SXPB_CR A where A.FZSPID=CK_SXPB_CR.SPID)');
|
|||
|
sql.Add(' where SPID=''' + Trim(CDS_Main.fieldbyname('FZSPID').AsString) + '''');
|
|||
|
if Trim(CDS_Main.fieldbyname('CRType').AsString) = 'ƽ<>Ƴ<EFBFBD><C6B3><EFBFBD>' then
|
|||
|
begin
|
|||
|
sql.Add(' delete CK_SXPB_CR where isnull(PYID,''1'')=''' + Trim(CDS_Main.fieldbyname('PYID').AsString) + '''');
|
|||
|
end;
|
|||
|
if Trim(CDS_Main.fieldbyname('CRType').AsString) = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
sql.Add(' delete CK_GenDan_CR where isnull(PYID,''1'')=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
end;
|
|||
|
if Trim(CDS_Main.fieldbyname('CRType').AsString) = '<27><><EFBFBD><EFBFBD><DEB3><EFBFBD>' then
|
|||
|
begin
|
|||
|
sql.Add(' delete CK_GenDan_CR where isnull(PYID,''1'')=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
end;
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ɾ<><C9BE><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.TBAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmDJBCKOutPut := TfrmDJBCKOutPut.Create(Application);
|
|||
|
with frmDJBCKOutPut do
|
|||
|
begin
|
|||
|
FBCId := '';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmDJBCKOutPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_SXPB_CR where FZSPID=');
|
|||
|
sql.Add('(select SPID from CK_SXPB_CR where PYID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
sql.Add(' and isnull(CRType,'''')=''ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'')');
|
|||
|
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><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
frmDJBCKOutPut := TfrmDJBCKOutPut.Create(Application);
|
|||
|
with frmDJBCKOutPut do
|
|||
|
begin
|
|||
|
FBCId := Trim(CDS_Main.fieldbyname('SPID').AsString);
|
|||
|
TBDel.Visible := False;
|
|||
|
TBAdd.Visible := False;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmDJBCKOutPut.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.ToolButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
//if Trim(CDS_Main.fieldbyname('CRType').AsString)<>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then Exit;
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD>ǩ.rmf';
|
|||
|
ExportFtErpFile('<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD>ǩ.rmf', ADOQueryCmd);
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while CDS_Main.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ,B.SOrddefstr1,B.PRTColor,B.PRTHX,B.PrtKuanNO,C.OrderNo,C.MPRTCodeName');
|
|||
|
sql.Add(',C.CustomerNoName,C.ConNo');
|
|||
|
sql.Add(',khCode=(select zdyNameZ from KH_Zdy_Attachment X where X.zdyname=C.CustomerNoName and X.Type=''KHName'') ');
|
|||
|
sql.Add(',khConNo=(select top 1 khConNo from JYOrderCon_Main X where X.ConNO=C.conNO) ');
|
|||
|
sql.Add(' from CK_SXPB_CR A');
|
|||
|
sql.Add(' left join JYOrder_Sub B on A.ORDSubIdCK=B.SubId');
|
|||
|
sql.Add(' left join JYOrder_Main C on A.ORDMainIdCK=C.MainId');
|
|||
|
sql.Add(' where A.SPId=''' + Trim(CDS_Main.fieldbyname('SPId').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryPrint, CDS_PRT);
|
|||
|
SInitCDSData20(ADOQueryPrint, CDS_PRT);
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim(CDS_PRT.fieldbyname('SPID').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
|
|||
|
CDS_Main.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
RM1.PreviewButtons := [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS, pbExport, pbNavigator];
|
|||
|
RM2.PreviewButtons := [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS, pbExport, pbNavigator];
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
//RM1.ShowReport;
|
|||
|
RM1.PrintReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
CDS_Main.EnableControls;
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD>ǩ.rmf'), '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value := False;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
// if Trim(CDS_Main.fieldbyname('CRType').AsString) <> '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
// begin
|
|||
|
// Tv1.OptionsSelection.CellSelect := False;
|
|||
|
// end
|
|||
|
// else
|
|||
|
// begin
|
|||
|
// Tv1.OptionsSelection.CellSelect := True;
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
// with CDS_Main do
|
|||
|
// begin
|
|||
|
// First;
|
|||
|
// while not eof do
|
|||
|
// begin
|
|||
|
// if CDS_Main.Locate('SSel', True, []) then
|
|||
|
// begin
|
|||
|
// with ADOQueryTemp do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('select Top 1 * from WFB_MJJY where isnull(APID,'''')=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// if ADOQueryTemp.IsEmpty = False then
|
|||
|
// begin
|
|||
|
// Application.MessageBox('<27>Ѽ<EFBFBD><D1BC>鲻<EFBFBD><E9B2BB><EFBFBD>ľ<DEB8><C4BE><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// next;
|
|||
|
// end;
|
|||
|
//
|
|||
|
// end;
|
|||
|
FirstJ.Text := '';
|
|||
|
LastJ.Text := '';
|
|||
|
Panel2.Visible := True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
panel2.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.Button1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(FirstJ.Text) = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if Trim(lastJ.Text) = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if CDS_Main.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update CK_SXPB_CR set firstJ=''' + trim(FirstJ.Text) + ''' ,lastJ=''' + trim(lastJ.Text) + '''');
|
|||
|
sql.Add('where spid=''' + cds_main.fieldbyname('spid').AsString + ''' ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ɾ<><C9BE><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('ssel').value := False;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
Panel2.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.ToolButton2Click(Sender: TObject);
|
|||
|
var
|
|||
|
key: Char;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmDJBJYInput := TfrmDJBJYInput.Create(Application);
|
|||
|
with frmDJBJYInput do
|
|||
|
begin
|
|||
|
APID.Text := CDS_Main.fieldbyname('SPID').AsString;
|
|||
|
FLen1 := StrTofloatDef(CDS_Main.fieldbyname('Qty').AsString, 0);
|
|||
|
key := #13;
|
|||
|
APIDKeyPress(APID, key);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmDJBJYInput.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.ToolButton4Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile, fPrintFile10, FMainID, FCNN: string;
|
|||
|
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;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + trim('<27>ӹ<EFBFBD><D3B9>뵥') + '.rmf';
|
|||
|
ExportFtErpFile(trim('<27>ӹ<EFBFBD><D3B9>뵥') + '.rmf', ADOQueryCmd);
|
|||
|
|
|||
|
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;
|
|||
|
FMainID := '';
|
|||
|
FCNN := '';
|
|||
|
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('SPID').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 ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select mjid from wfb_mjjy_DJB A');
|
|||
|
sql.Add('WHERE EXISTS (select SubId from TBSubID X where X.SubId=A.APID and X.DName=''' + Trim(DCode) + ''' )');
|
|||
|
Open;
|
|||
|
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;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
ADOQueryCmd.append;
|
|||
|
ADOQueryCmd.fieldbyname('SubId').Value := Trim(ADOQueryTemp.fieldbyname('MJID').AsString);
|
|||
|
ADOQueryCmd.fieldbyname('Dname').Value := Trim(DCode);
|
|||
|
ADOQueryCmd.post;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Print_CKMDYDLJG_DJB ');
|
|||
|
sql.add('@DName=' + quotedstr(Trim(DCode)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_HZ);
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd_HZ_DJB ');
|
|||
|
sql.add('@mainID=' + quotedstr(Trim('')));
|
|||
|
sql.add(',@DName=' + quotedstr(Trim(DCode)));
|
|||
|
sql.add(',@flag=''3'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_PRT);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_PRT);
|
|||
|
RM1.PreviewButtons := [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS, pbExport, pbNavigator];
|
|||
|
RM2.PreviewButtons := [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS, pbExport, pbNavigator];
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
RM2.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.ToolButton5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
frmFjList := TfrmFjlist.create(self);
|
|||
|
with frmFjlist do
|
|||
|
begin
|
|||
|
fkeyNo := trim(CDS_Main.fieldbyname('spid').AsString);
|
|||
|
ftype := 'DJBCK';
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
;
|
|||
|
end;
|
|||
|
frmFjlist.Free;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDJBCKOutList.ToolButton6Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile, fPrintFile10, FMainID, FCNN, FSPID, FColor: string;
|
|||
|
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;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + trim('<27><><EFBFBD>첼<EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>') + '.rmf';
|
|||
|
ExportFtErpFile(trim('<27><><EFBFBD>첼<EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>') + '.rmf', ADOQueryCmd);
|
|||
|
|
|||
|
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;
|
|||
|
FMainID := '';
|
|||
|
// FSPID := '';
|
|||
|
FColor := '';
|
|||
|
FCNN := '';
|
|||
|
CDS_Main.DisableControls;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('Ssel').AsBoolean then
|
|||
|
begin
|
|||
|
if FMainID = '' then
|
|||
|
begin
|
|||
|
FMainID := Trim(CDS_Main.fieldbyname('ORDMainIdCK').AsString);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if Trim(CDS_Main.fieldbyname('ORDMainIdCK').AsString) <> FMainID then
|
|||
|
begin
|
|||
|
application.MessageBox('ѡ<><D1A1><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>ͬһ<CDAC><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
EnableControls;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
if FColor = '' then
|
|||
|
begin
|
|||
|
FColor := Trim(CDS_Main.fieldbyname('PRTColor').AsString);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if Trim(CDS_Main.fieldbyname('PRTColor').AsString) <> FColor then
|
|||
|
begin
|
|||
|
application.MessageBox('ѡ<><D1A1><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>ͬһ<CDAC><D2BB><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
EnableControls;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.append;
|
|||
|
ADOQueryCmd.fieldbyname('SubId').Value := Trim(CDS_Main.fieldbyname('SPID').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 ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Print_DJBHZ ');
|
|||
|
sql.add('@DName=' + quotedstr(Trim(DCode)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_HZ);
|
|||
|
RM1.PreviewButtons := [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS, pbExport, pbNavigator];
|
|||
|
RM2.PreviewButtons := [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS, pbExport, pbNavigator];
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|