718 lines
20 KiB
ObjectPascal
718 lines
20 KiB
ObjectPascal
![]() |
unit U_CKProductBCPKCList;
|
|||
|
|
|||
|
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, MovePanel, cxCheckBox,
|
|||
|
Menus, cxCalendar, RM_System, RM_Common, RM_Class, RM_GridReport;
|
|||
|
|
|||
|
type
|
|||
|
TfrmCKProductBCPKCList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBExport: TToolButton;
|
|||
|
TBPrint: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
Label3: TLabel;
|
|||
|
PRTCodeName: TEdit;
|
|||
|
Label1: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v2Column3: TcxGridDBColumn;
|
|||
|
v2Column5: TcxGridDBColumn;
|
|||
|
v2Column6: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
Label5: TLabel;
|
|||
|
orderNo: TEdit;
|
|||
|
Label6: TLabel;
|
|||
|
MJID: TEdit;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
Label8: TLabel;
|
|||
|
PRTKZ: TEdit;
|
|||
|
Label9: TLabel;
|
|||
|
PRTMF: TEdit;
|
|||
|
Label7: TLabel;
|
|||
|
CPType: TComboBox;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
Panel4: TPanel;
|
|||
|
Label11: TLabel;
|
|||
|
Panel10: TPanel;
|
|||
|
Image2: TImage;
|
|||
|
RichEdit1: TRichEdit;
|
|||
|
MovePanel2: TMovePanel;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
TBZD: TToolButton;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
Label4: TLabel;
|
|||
|
Label10: TLabel;
|
|||
|
PRTColor: TComboBox;
|
|||
|
AOrdDefStr1: TComboBox;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
ThreeColorBase: TcxStyleRepository;
|
|||
|
SHuangSe: TcxStyle;
|
|||
|
SkyBlue: TcxStyle;
|
|||
|
Default: TcxStyle;
|
|||
|
QHuangSe: TcxStyle;
|
|||
|
Red: TcxStyle;
|
|||
|
FontBlue: TcxStyle;
|
|||
|
TextSHuangSe: TcxStyle;
|
|||
|
FonePurple: TcxStyle;
|
|||
|
FoneClMaroon: TcxStyle;
|
|||
|
FoneRed: TcxStyle;
|
|||
|
RowColor: TcxStyle;
|
|||
|
handBlack: TcxStyle;
|
|||
|
cxBlue: TcxStyle;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
Label12: TLabel;
|
|||
|
baoNo: TEdit;
|
|||
|
CheckBox1: TCheckBox;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
CDS_PRT: TClientDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
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 PRTCodeNameChange(Sender: TObject);
|
|||
|
procedure Panel10MouseMove(Sender: TObject; Shift: TShiftState; X,
|
|||
|
Y: Integer);
|
|||
|
procedure Image2Click(Sender: TObject);
|
|||
|
procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton;
|
|||
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure TBZDClick(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure Tv1CellClick(Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure PRTColorChange(Sender: TObject);
|
|||
|
procedure AOrdDefStr1Change(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
procedure TBPrintClick(Sender: TObject);
|
|||
|
private
|
|||
|
FLeft,FTop:Integer;
|
|||
|
procedure InitGrid();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmCKProductBCPKCList: TfrmCKProductBCPKCList;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_DataLink,U_Fun,U_ProductOrderListSel;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmCKProductBCPKCList:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.FormClose(Sender: TObject;
|
|||
|
var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
|
|||
|
EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp)
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('exec P_View_CPKCMX :WSQl');
|
|||
|
if Trim(DParameters2)<>'<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
Parameters.ParamByName('WSQl').Value:=' and B.Filler='''+Trim(DName)+'''';
|
|||
|
end else
|
|||
|
begin
|
|||
|
Parameters.ParamByName('WSQl').Value:='';
|
|||
|
end;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
// BegDate.SetFocus;
|
|||
|
MovePanel2.Visible:=True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
InitGrid();
|
|||
|
MovePanel2.Visible:=False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
ReadCxGrid('<27>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
if Trim(DParameters2)='<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
// TBZD.Visible:=True;
|
|||
|
ToolButton1.Visible:=true;
|
|||
|
TBZD.Visible:=False;
|
|||
|
v1Column12.Visible:=true;
|
|||
|
// v1Column14.Options.Editing:=true;
|
|||
|
end else
|
|||
|
begin
|
|||
|
TBZD.Visible:=False;
|
|||
|
ToolButton1.Visible:=false;
|
|||
|
v1Column12.Visible:=true;
|
|||
|
v1Column14.Options.Editing:=False;
|
|||
|
end;
|
|||
|
//InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then exit;
|
|||
|
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',cxGrid2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.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 TfrmCKProductBCPKCList.PRTCodeNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.Panel10MouseMove(Sender: TObject;
|
|||
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
ReleaseCapture;
|
|||
|
TWinControl(Panel4).Perform(WM_SYSCOMMAND,$F012,0);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.Image2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel4.Visible:=False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.Tv1MouseUp(Sender: TObject;
|
|||
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
FLeft:=X;
|
|||
|
FTop:=Y;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.Tv1CellDblClick(
|
|||
|
Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
{if Trim(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName)<>'CDQK' then Exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select CDQK=dbo.F_Get_Order_SubStr(:MJID,''MJCDHZSL'')');
|
|||
|
Parameters.ParamByName('MJID').Value:=Trim(CDS_Main.fieldbyname('MJID').AsString);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('CDQK').Value:=Trim(ADOQueryTemp.fieldbyname('CDQK').AsString);
|
|||
|
Post;
|
|||
|
end; }
|
|||
|
Panel4.Left:=FLeft;
|
|||
|
Panel4.Top:=FTop+110;
|
|||
|
Panel4.Visible:=True;
|
|||
|
Panel4.Refresh;
|
|||
|
Panel10.Caption:=Trim(TV1.Controller.FocusedColumn.Caption);
|
|||
|
|
|||
|
RichEdit1.Text:=CDS_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.TBZDClick(Sender: TObject);
|
|||
|
var
|
|||
|
FMainid,FSubId,FOrderNo,FColor,FSH,FHX,FCodeName,FMPRTMF,FMPRTKZ:String;
|
|||
|
begin
|
|||
|
if CDS_Main.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
FMainid:='';
|
|||
|
try
|
|||
|
frmProductOrderListSel:=TfrmProductOrderListSel.Create(Application);
|
|||
|
with frmProductOrderListSel do
|
|||
|
begin
|
|||
|
FFInt:=1;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
FMainid:=frmProductOrderListSel.Order_Main.fieldbyname('Mainid').AsString;
|
|||
|
FSubId:=frmProductOrderListSel.Order_Main.fieldbyname('SubId').AsString;
|
|||
|
FOrderNo:=frmProductOrderListSel.Order_Main.fieldbyname('OrderNo').Value;
|
|||
|
FCodeName:=frmProductOrderListSel.Order_Main.fieldbyname('PRTCodeName').Value;
|
|||
|
FColor:=frmProductOrderListSel.Order_Main.fieldbyname('PRTColor').Value;
|
|||
|
if Trim(frmProductOrderListSel.Order_Main.fieldbyname('SOrddefstr1').AsString)<>'' then
|
|||
|
FSH:=frmProductOrderListSel.Order_Main.fieldbyname('SOrddefstr1').AsString;
|
|||
|
if Trim(frmProductOrderListSel.Order_Main.fieldbyname('PRTHX').AsString)<>'' then
|
|||
|
FHX:=frmProductOrderListSel.Order_Main.fieldbyname('PRTHX').Value;
|
|||
|
FMPRTMF:=frmProductOrderListSel.Order_Main.fieldbyname('PRTMF').AsString;
|
|||
|
FMPRTKZ:=frmProductOrderListSel.Order_Main.fieldbyname('PRTKZ').AsString;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmProductOrderListSel.Free;
|
|||
|
end;
|
|||
|
if Trim(FMainid)<>'' then
|
|||
|
begin
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
MovePanel2.Visible:=True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
try
|
|||
|
Self.ADOQueryCmd.Connection.BeginTrans;
|
|||
|
Self.CDS_Main.DisableControls;
|
|||
|
with Self.CDS_Main do
|
|||
|
begin
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Self.CDS_Main.FieldByName('SSEl').AsBoolean=True then
|
|||
|
begin
|
|||
|
with Self.ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate CK_BanCP_CR Set MainId='''+Trim(FMainid)+'''');
|
|||
|
sql.Add(',SubId='''+Trim(FSubId)+'''');
|
|||
|
sql.Add(',ZDPerson='''+Trim(DName)+''',ZDTime=getdate() ');
|
|||
|
sql.Add(' where CRID='+self.CDS_Main.fieldbyname('CRID').AsString);
|
|||
|
SQL.Add(' and CRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add('UPdate WFB_MJJY Set MainId='''+Trim(FMainid)+'''');
|
|||
|
sql.Add(',SubId='''+Trim(FSubId)+'''');
|
|||
|
//sql.Add(',ZDPerson='''+Trim(DName)+''',ZDTime=getdate() ');
|
|||
|
sql.Add(' where MJID='+self.CDS_Main.fieldbyname('MJID').AsString);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Edit;
|
|||
|
FieldByName('OrderNo').Value:=FOrderNo;
|
|||
|
FieldByName('PRTCodeName').Value:=FCodeName;
|
|||
|
FieldByName('PRTColor').Value:=FColor;
|
|||
|
FieldByName('SOrddefstr1').Value:=FSH;
|
|||
|
FieldByName('PRTHX').Value:=FHX;
|
|||
|
FieldByName('PRTMF').Value:=FMPRTMF;
|
|||
|
FieldByName('PRTKZ').Value:=FMPRTKZ;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Self.CDS_Main.EnableControls;
|
|||
|
Self.ADOQueryCmd.Connection.CommitTrans;
|
|||
|
MovePanel2.Visible:=False;
|
|||
|
except
|
|||
|
Self.ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
MovePanel2.Visible:=False;
|
|||
|
Application.MessageBox('ת<><D7AA>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0) ;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main,True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main,False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.Tv1CellClick(
|
|||
|
Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty=False then
|
|||
|
begin
|
|||
|
InitOrderColor(Trim(CDS_Main.fieldbyname('MainId').AsString),PRTColor,ADOQueryTemp);
|
|||
|
InitBCGangNo(Trim(CDS_Main.fieldbyname('SubId').AsString),AOrdDefStr1,ADOQueryTemp);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.PRTColorChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
if CDS_Main.IsEmpty=False then
|
|||
|
begin
|
|||
|
//InitOrderColor(Trim(CDS_Main.fieldbyname('MainId').AsString),PRTColor,ADOQueryTemp);
|
|||
|
InitBCGangNo(Trim(CDS_Main.fieldbyname('SubId').AsString),AOrdDefStr1,ADOQueryTemp);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.AOrdDefStr1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
IF CDS_main.IsEmpty then exit;
|
|||
|
orderNo.SetFocus;
|
|||
|
if CDS_Main.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
try
|
|||
|
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_BanCP_CR ');
|
|||
|
sql.Add('SET baoNO='+quotedstr(CDS_Main.fieldbyname('baoNO').AsString));
|
|||
|
sql.Add('where BCID='+quotedstr(CDS_Main.fieldbyname('BCID').AsString));
|
|||
|
sql.Add('and MJID='+quotedstr(CDS_Main.fieldbyname('MJID').AsString));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
first;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
exit;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.CheckBox1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
first;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
edit;
|
|||
|
fieldbyname('ssel').Value:=checkbox1.Checked;
|
|||
|
post;
|
|||
|
next;
|
|||
|
end;
|
|||
|
first;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.TBPrintClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile,fPrintFile10,FMainID:String;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then Exit;
|
|||
|
if trim(ComboBox1.Text)='' 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(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;
|
|||
|
FMainID:='';
|
|||
|
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('mainID').AsString);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
IF Trim(CDS_Main.fieldbyname('mainID').AsString)<>FMainID then
|
|||
|
begin
|
|||
|
application.MessageBox('ѡ<><D1A1><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>ͬһ<CDAC><D2BB>ָʾ<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;
|
|||
|
ADOQueryCmd.append;
|
|||
|
ADOQueryCmd.fieldbyname('SubId').Value:=Trim(CDS_Main.fieldbyname('MJID').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 (trim(ComboBox1.Text)='<27><><EFBFBD><EFBFBD><EFBFBD>뵥') then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Print_CKMD ');
|
|||
|
sql.add('@mainID='+quotedstr(Trim('')));
|
|||
|
sql.add(',@DName='+quotedstr(Trim(DCode)));
|
|||
|
// sql.add(',@flag=''0'' ');
|
|||
|
// sql.add(',@CNum=''10'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_HZ);
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd_HZ ');
|
|||
|
sql.add('@mainID='+quotedstr(Trim('')));
|
|||
|
sql.add(',@DName='+quotedstr(Trim(DCode)));
|
|||
|
sql.add(',@flag=''2'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_PRT);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_PRT);
|
|||
|
end;
|
|||
|
|
|||
|
IF (trim(ComboBox1.Text)='<27><>ɫ<EFBFBD><C9AB>װ') OR (trim(ComboBox1.Text)='<27><>ɫ<EFBFBD><C9AB>װ-<2D><><EFBFBD><EFBFBD>') OR (trim(ComboBox1.Text)='<27><>װ') then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd20 ');
|
|||
|
sql.add('@mainID='+quotedstr(Trim('')));
|
|||
|
sql.add(',@DName='+quotedstr(Trim(DCode)));
|
|||
|
sql.add(',@flag=''0'' ');
|
|||
|
sql.add(',@CNum=''10'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_HZ);
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd_HZ ');
|
|||
|
sql.add('@mainID='+quotedstr(Trim('')));
|
|||
|
sql.add(',@DName='+quotedstr(Trim(DCode)));
|
|||
|
sql.add(',@flag=''0'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_PRT);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_PRT);
|
|||
|
end;
|
|||
|
|
|||
|
// IF (trim(ComboBox1.Text)='<27><>װ') then
|
|||
|
// begin
|
|||
|
// with ADOQueryTemp do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.add('select A.OrderNo,B.* from WFB_MJJY B left join JYOrder_Main A on A.MainId=B.MainId ');
|
|||
|
// sql.add('where A.OrderNo ='+Trim(CDS_Main.fieldbyname('orderNo').AsString));
|
|||
|
// sql.add('order by b.MJXH');
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// SCreateCDS20(ADOQueryTemp,CDS_HZ);
|
|||
|
// SInitCDSData20(ADOQueryTemp,CDS_HZ);
|
|||
|
//
|
|||
|
// with ADOQueryTemp do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.add('exec P_Do_PrintMd_HZ ');
|
|||
|
// sql.add('@mainID='+quotedstr(Trim('')));
|
|||
|
// sql.add(',@DName='+quotedstr(Trim(DCode)));
|
|||
|
// sql.add(',@flag=''0'' ');
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// SCreateCDS20(ADOQueryTemp,CDS_PRT);
|
|||
|
// SInitCDSData20(ADOQueryTemp,CDS_PRT);
|
|||
|
// end;
|
|||
|
|
|||
|
IF trim(ComboBox1.Text)='<27><>ɫ<EFBFBD><C9AB>װ-10ɫ' then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd30 ');
|
|||
|
sql.add('@mainID='+quotedstr(Trim('')));
|
|||
|
sql.add(',@DName='+quotedstr(Trim(DCode)));
|
|||
|
sql.add(',@flag=''0'' ');
|
|||
|
sql.add(',@CNum=''10'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_HZ);
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd_HZ ');
|
|||
|
sql.add('@mainID='+quotedstr(Trim('')));
|
|||
|
sql.add(',@DName='+quotedstr(Trim(DCode)));
|
|||
|
sql.add(',@flag=''1'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_PRT);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_PRT);
|
|||
|
end;
|
|||
|
IF trim(ComboBox1.Text)='<27><>ɫ<EFBFBD><C9AB>װ-<2D><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd30 ');
|
|||
|
sql.add('@mainID='+quotedstr(Trim('')));
|
|||
|
sql.add(',@DName='+quotedstr(Trim(DCode)));
|
|||
|
sql.add(',@flag=''0'' ');
|
|||
|
sql.add(',@CNum=''10'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_HZ);
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd_HZ ');
|
|||
|
sql.add('@mainID='+quotedstr(Trim('')));
|
|||
|
sql.add(',@DName='+quotedstr(Trim(DCode)));
|
|||
|
sql.add(',@flag=''1'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_PRT);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_PRT);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
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.
|