1262 lines
35 KiB
ObjectPascal
1262 lines
35 KiB
ObjectPascal
unit U_JYOrderCDOne;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
||
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
|
||
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
||
cxGrid, DBClient, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System,
|
||
RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus, MovePanel, cxPC,
|
||
cxContainer, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookAndFeels,
|
||
cxLookAndFeelPainters, dxCore, cxDateUtils, cxNavigator, dxBarBuiltInMenu;
|
||
|
||
type
|
||
TfrmJYOrderCDOnePB = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxGrid1: TcxGrid;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Label3: TLabel;
|
||
OrderNo: TEdit;
|
||
TBExport: TToolButton;
|
||
Label7: TLabel;
|
||
C_Code: TEdit;
|
||
Label8: TLabel;
|
||
Label10: TLabel;
|
||
MJID: TEdit;
|
||
Label2: TLabel;
|
||
CDQK: TEdit;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
Label5: TLabel;
|
||
C_CodeName: TEdit;
|
||
Label6: TLabel;
|
||
MJStr2: TComboBox;
|
||
v1Column17: TcxGridDBColumn;
|
||
v1Column20: TcxGridDBColumn;
|
||
v1Column21: TcxGridDBColumn;
|
||
Filler: TComboBox;
|
||
TBManage: TToolButton;
|
||
v1Column22: TcxGridDBColumn;
|
||
v1Column23: TcxGridDBColumn;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
TBZF: TToolButton;
|
||
TBPrint: TToolButton;
|
||
RM2: TRMGridReport;
|
||
RMDB_Main: TRMDBDataSet;
|
||
ADOQueryPrint: TADOQuery;
|
||
MovePanel2: TMovePanel;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column15: TcxGridDBColumn;
|
||
Label1: TLabel;
|
||
SCPerson: TComboBox;
|
||
v1Column19: TcxGridDBColumn;
|
||
v1Column24: TcxGridDBColumn;
|
||
Label9: TLabel;
|
||
v1Column12: TcxGridDBColumn;
|
||
Label4: TLabel;
|
||
JXPerson: TComboBox;
|
||
v1Column18: TcxGridDBColumn;
|
||
v1Column26: TcxGridDBColumn;
|
||
v1Column27: TcxGridDBColumn;
|
||
v1Column28: TcxGridDBColumn;
|
||
cxTabControl1: TcxTabControl;
|
||
TBCL: TToolButton;
|
||
TBCancel: TToolButton;
|
||
Label12: TLabel;
|
||
ClothType: TComboBox;
|
||
v1Column29: TcxGridDBColumn;
|
||
v1Column30: TcxGridDBColumn;
|
||
Label13: TLabel;
|
||
MJStr3: TComboBox;
|
||
v1Column31: TcxGridDBColumn;
|
||
v1Column32: TcxGridDBColumn;
|
||
CDS_Print: TClientDataSet;
|
||
v1Column16: TcxGridDBColumn;
|
||
Label14: TLabel;
|
||
ZZPerson: TEdit;
|
||
v1Column25: TcxGridDBColumn;
|
||
v1Column33: TcxGridDBColumn;
|
||
CheckBox1: TCheckBox;
|
||
Label15: TLabel;
|
||
CarNo: TEdit;
|
||
cxTabControl2: TcxTabControl;
|
||
Panel4: TPanel;
|
||
Label11: TLabel;
|
||
Panel10: TPanel;
|
||
Image2: TImage;
|
||
RichEdit1: TRichEdit;
|
||
Order_Main: TClientDataSet;
|
||
ADOQueryMain: TADOQuery;
|
||
Panel2: TPanel;
|
||
Label17: TLabel;
|
||
YeShu: TEdit;
|
||
Label18: TLabel;
|
||
JQty: TEdit;
|
||
Label19: TLabel;
|
||
MJJingZ: TEdit;
|
||
Label20: TLabel;
|
||
MJMaoZ: TEdit;
|
||
Label21: TLabel;
|
||
DelMoney: TEdit;
|
||
Label22: TLabel;
|
||
AddMoney: TEdit;
|
||
Label23: TLabel;
|
||
CDGS: TEdit;
|
||
Label24: TLabel;
|
||
Label25: TLabel;
|
||
CDHZQty: TEdit;
|
||
Label26: TLabel;
|
||
CDHZKgQty: TEdit;
|
||
Label27: TLabel;
|
||
Button1: TButton;
|
||
v1Column14: TcxGridDBColumn;
|
||
Label28: TLabel;
|
||
MJStr4: TComboBox;
|
||
v1Column34: TcxGridDBColumn;
|
||
Label29: TLabel;
|
||
CheckBox2: TCheckBox;
|
||
v1Column36: TcxGridDBColumn;
|
||
v1Column37: TcxGridDBColumn;
|
||
Label16: TLabel;
|
||
GCCode: TEdit;
|
||
v1Column35: TcxGridDBColumn;
|
||
Label30: TLabel;
|
||
APBatchNo: TEdit;
|
||
ToolButton1: TToolButton;
|
||
v1Column39: TcxGridDBColumn;
|
||
v1Column40: TcxGridDBColumn;
|
||
v1Column41: TcxGridDBColumn;
|
||
BegDate: TcxDateEdit;
|
||
EndDate: TcxDateEdit;
|
||
v1Column38: TcxGridDBColumn;
|
||
CheJian: TComboBox;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
ToolButton2: TToolButton;
|
||
Panel3: TPanel;
|
||
Label31: TLabel;
|
||
Label32: TLabel;
|
||
XM: TComboBox;
|
||
XMStr: TEdit;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure FormShow(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 TBManageClick(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure TBZFClick(Sender: TObject);
|
||
procedure TBPrintClick(Sender: TObject);
|
||
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure TBCLClick(Sender: TObject);
|
||
procedure TBCancelClick(Sender: TObject);
|
||
procedure C_CodeKeyPress(Sender: TObject; var Key: Char);
|
||
procedure cxTabControl2Change(Sender: TObject);
|
||
procedure ZhenCunTypeChange(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
private
|
||
DQdate: TDateTime;
|
||
FLeft, FTop: Integer;
|
||
procedure InitGridYe();
|
||
procedure IntTab();
|
||
procedure InitHZ();
|
||
procedure InitForm();
|
||
function Savedata(): Boolean;
|
||
procedure InitButton();
|
||
procedure PrintData(FFFMJID: string);
|
||
function ConnData(): Boolean;
|
||
{ Private declarations }
|
||
public
|
||
FFInt: Integer;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
//var
|
||
// frmJYOrderCDOnePB: TfrmJYOrderCDOnePB;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, U_MJEdit; //,U_OrderInPut,U_JFMoneyList
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmJYOrderCDOnePB.FormDestroy(Sender: TObject);
|
||
begin
|
||
//frmJYOrderCDOnePB:=nil;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.InitButton();
|
||
begin
|
||
if Trim(Self.Caption) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ' then
|
||
begin
|
||
TBZF.Visible := False;
|
||
TBManage.Visible := False;
|
||
TBCL.Visible := False;
|
||
TBCancel.Visible := False;
|
||
cxTabControl1.Visible := False;
|
||
cxTabControl1.TabIndex := 2;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.FormCreate(Sender: TObject);
|
||
begin
|
||
DQdate := SGetServerDate(ADOQueryTemp);
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid(Self.Caption, Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1');
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.InitGridYe();
|
||
var
|
||
fsj: string;
|
||
begin
|
||
|
||
OrderNo.SetFocus;
|
||
MovePanel2.Visible := True;
|
||
MovePanel2.Refresh;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Viwe_JYInfo_Ye :begdate,:enddate,:Ye,:WSql ');
|
||
if CheckBox1.Checked = True then
|
||
begin
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
begin
|
||
Parameters.ParamByName('begdate').Value := BegDate.Text;
|
||
Parameters.ParamByName('enddate').Value := EndDate.Text;
|
||
end
|
||
else if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
Parameters.ParamByName('begdate').Value := '';
|
||
Parameters.ParamByName('enddate').Value := '';
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('begdate').Value := '';
|
||
Parameters.ParamByName('enddate').Value := '';
|
||
end;
|
||
|
||
Parameters.ParamByName('Ye').Value := cxTabControl2.TabIndex;
|
||
fsj := SGetFilters(Panel1, 1, 2);
|
||
if Trim(fsj) <> '' then
|
||
begin
|
||
fsj := ' and ' + fsj;
|
||
end
|
||
else
|
||
begin
|
||
fsj := '';
|
||
end;
|
||
if Self.Caption <> '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ' then
|
||
begin
|
||
if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
fsj := fsj + ' and ChuLiFlag=0 ';
|
||
|
||
end
|
||
else if cxTabControl1.TabIndex = 1 then
|
||
begin
|
||
fsj := fsj + ' and ChuLiFlag=1 ';
|
||
end;
|
||
end;
|
||
fsj := fsj + ' and isnull(JTType,'''')<>''<27><><EFBFBD><EFBFBD>'' ';
|
||
if CheckBox2.Checked then
|
||
begin
|
||
fsj := fsj + 'and isnull(CDQK,'''')<>'''' ';
|
||
end;
|
||
Parameters.ParamByName('WSql').Value := fsj;
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
MovePanel2.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.InitHZ();
|
||
var
|
||
fsj: string;
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Viwe_JYInfo_Ye_HZ :begdate,:enddate,:WSql');
|
||
if CheckBox1.Checked = True then
|
||
begin
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
begin
|
||
Parameters.ParamByName('begdate').Value := BegDate.Text;
|
||
Parameters.ParamByName('enddate').Value := enddate.Text;
|
||
end
|
||
else if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
Parameters.ParamByName('begdate').Value := '';
|
||
Parameters.ParamByName('enddate').Value := '';
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('begdate').Value := '';
|
||
Parameters.ParamByName('enddate').Value := '';
|
||
end;
|
||
{if cxTabControl1.TabIndex<>0 then
|
||
begin
|
||
Parameters.ParamByName('begdate').Value:=FormatDateTime('yyyy-MM-dd',BegDate.DateTime);
|
||
Parameters.ParamByName('enddate').Value:=FormatDateTime('yyyy-MM-dd',enddate.DateTime+1);
|
||
end else
|
||
begin
|
||
Parameters.ParamByName('begdate').Value:='2000-01-01';
|
||
Parameters.ParamByName('enddate').Value:='2500-01-01';
|
||
end; }
|
||
fsj := SGetFilters(Panel1, 1, 2);
|
||
if Trim(fsj) <> '' then
|
||
begin
|
||
fsj := ' and ' + fsj;
|
||
end
|
||
else
|
||
begin
|
||
fsj := '';
|
||
end;
|
||
fsj := fsj + ' and isnull(JTType,'''')<>''<27><><EFBFBD><EFBFBD>'' ';
|
||
if CheckBox2.Checked then
|
||
begin
|
||
fsj := fsj + 'and isnull(CDQK,'''')<>'''' ';
|
||
end;
|
||
if Self.Caption <> '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ' then
|
||
begin
|
||
if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
Parameters.ParamByName('WSql').Value := fsj + ' and ChuLiFlag=0 ';
|
||
end
|
||
else if cxTabControl1.TabIndex = 1 then
|
||
begin
|
||
Parameters.ParamByName('WSql').Value := fsj + ' and ChuLiFlag=1 ';
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('WSql').Value := fsj;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('WSql').Value := fsj;
|
||
end;
|
||
// ShowMessage(sql.text);
|
||
Open;
|
||
end;
|
||
YeShu.Text := IntToStr(cxTabControl2.Tabs.Count);
|
||
JQty.Text := Trim(ADOQueryTemp.fieldbyname('JQty').AsString);
|
||
MJJingZ.Text := Trim(ADOQueryTemp.fieldbyname('MJJingZ').AsString);
|
||
MJMaoZ.Text := Trim(ADOQueryTemp.fieldbyname('MJMaoZ').AsString);
|
||
CDGS.Text := Trim(ADOQueryTemp.fieldbyname('CDGS').AsString);
|
||
CDHZQty.Text := Trim(ADOQueryTemp.fieldbyname('CDHZQty').AsString);
|
||
CDHZKgQty.Text := Trim(ADOQueryTemp.fieldbyname('CDHZKgQty').AsString);
|
||
AddMoney.Text := Trim(ADOQueryTemp.fieldbyname('AddMoney').AsString);
|
||
DelMoney.Text := Trim(ADOQueryTemp.fieldbyname('DelMoney').AsString);
|
||
if Trim(SCPerson.Text) <> '' then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Viwe_JYInfo_Ye_HZ_JF :begdate,:enddate,:WSql');
|
||
if CheckBox1.Checked = True then
|
||
begin
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
begin
|
||
Parameters.ParamByName('begdate').Value := BegDate.Text;
|
||
Parameters.ParamByName('enddate').Value := enddate.Text;
|
||
end
|
||
else if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
Parameters.ParamByName('begdate').Value := '';
|
||
Parameters.ParamByName('enddate').Value := '';
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('begdate').Value := '';
|
||
Parameters.ParamByName('enddate').Value := '';
|
||
end;
|
||
{if cxTabControl1.TabIndex<>0 then
|
||
begin
|
||
Parameters.ParamByName('begdate').Value:=FormatDateTime('yyyy-MM-dd',BegDate.DateTime);
|
||
Parameters.ParamByName('enddate').Value:=FormatDateTime('yyyy-MM-dd',enddate.DateTime+1);
|
||
end else
|
||
begin
|
||
Parameters.ParamByName('begdate').Value:='2000-01-01';
|
||
Parameters.ParamByName('enddate').Value:='2500-01-01';
|
||
end; }
|
||
fsj := '';
|
||
fsj := SGetFilters(Panel1, 1, 2);
|
||
if Trim(fsj) <> '' then
|
||
begin
|
||
fsj := ' and ' + fsj;
|
||
end
|
||
else
|
||
begin
|
||
fsj := '';
|
||
end;
|
||
if Self.Caption <> '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ' then
|
||
begin
|
||
if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
Parameters.ParamByName('WSql').Value := fsj + ' and ChuLiFlag=0 ';
|
||
end
|
||
else if cxTabControl1.TabIndex = 1 then
|
||
begin
|
||
Parameters.ParamByName('WSql').Value := fsj + ' and ChuLiFlag=1 ';
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('WSql').Value := fsj;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('WSql').Value := fsj;
|
||
end;
|
||
Open;
|
||
end;
|
||
AddMoney.Text := Trim(ADOQueryTemp.fieldbyname('AddMoney').AsString);
|
||
DelMoney.Text := Trim(ADOQueryTemp.fieldbyname('DelMoney').AsString);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.InitForm();
|
||
var
|
||
fsj: string;
|
||
begin
|
||
ReadCxGrid(Self.Caption, Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1');
|
||
fsj := 'select distinct(Filler) name from WFB_MJJY_PB ';
|
||
SInitComBoxBySql(ADOQueryCmd, Filler, False, fsj);
|
||
// fsj := 'select name=ZdyName from KH_Zdy where Type=''SCPerson'' order by ZdyName ';
|
||
fsj := 'select UserName name from SY_User where Udept=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' order by UserID ';
|
||
SInitComBoxBySql(ADOQueryCmd, SCPerson, False, fsj);
|
||
fsj := 'select name=ZdyName from KH_Zdy where Type=''JXPerson'' order by ZdyName ';
|
||
SInitComBoxBySql(ADOQueryCmd, JXPerson, False, fsj);
|
||
fsj := 'select name=ZdyName from KH_Zdy where Type=''ClothType'' order by ZdyName ';
|
||
SInitComBoxBySql(ADOQueryCmd, ClothType, False, fsj);
|
||
EndDate.Text := FormatDateTime('yyyy-MM-dd', SGetServerDate10(ADOQueryTemp) + 1) + ' 07:30:00';
|
||
BegDate.Text := FormatDateTime('yyyy-MM-dd', SGetServerDate10(ADOQueryTemp) - 1) + ' 07:30:00';
|
||
InitButton();
|
||
//InitGrid();
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.TBExportClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
SelExportData(Tv1, ADOQueryMain, '<27><><EFBFBD>鱨<EFBFBD><E9B1A8>');
|
||
end;
|
||
|
||
function TfrmJYOrderCDOnePB.ConnData(): Boolean;
|
||
begin
|
||
if not Assigned(DataLink_WeavingSchedule) then
|
||
DataLink_WeavingSchedule := TDataLink_WeavingSchedule.Create(Application);
|
||
try
|
||
with DataLink_WeavingSchedule.ADOLink do
|
||
begin
|
||
//if not Connected then
|
||
begin
|
||
Connected := false;
|
||
ConnectionString := DConString;
|
||
LoginPrompt := false;
|
||
Connected := true;
|
||
end;
|
||
end;
|
||
Result := true;
|
||
except
|
||
Result := false;
|
||
application.MessageBox('<27><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><><EFBFBD><EFBFBD>', mb_Ok + MB_ICONERROR);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
IntTab();
|
||
InitGridYe();
|
||
InitHZ();
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.FormShow(Sender: TObject);
|
||
begin
|
||
InitForm();
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.Panel10MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
ReleaseCapture;
|
||
TWinControl(Panel4).Perform(WM_SYSCOMMAND, $F012, 0);
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.Image2Click(Sender: TObject);
|
||
begin
|
||
Panel4.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
FLeft := X;
|
||
FTop := Y;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
Panel4.Left := FLeft;
|
||
Panel4.Top := FTop + 110;
|
||
Panel4.Visible := True;
|
||
Panel4.Refresh;
|
||
Panel10.Caption := Trim(TV1.Controller.FocusedColumn.Caption);
|
||
RichEdit1.Text := Order_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.TBManageClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_PBCP_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
frmMJEditPB := TfrmMJEditPB.Create(Application);
|
||
with frmMJEditPB do
|
||
begin
|
||
MJID.Text := Trim(Self.Order_Main.fieldbyname('MJID').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmMJEditPB.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(Order_Main, True);
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(Order_Main, False);
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.TBZFClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if Order_Main.Locate('ssel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϻ<EFBFBD><CFBA><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ָܻ<DCBB><D6B8><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Order_Main.FieldByName('SSel').AsBoolean = True then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_PBCP_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Order_Main.EnableControls;
|
||
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end
|
||
else
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete WFB_MJJY_PB_DelLog where MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
||
SQL.Add('insert into WFB_MJJY_PB_DelLog ');
|
||
sql.Add('select * from WFB_MJJY_PB where MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
||
// ShowMessage(SQL.Text);
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update WFB_MJJY_PB_DelLog Set Note=Isnull(Note,'''')+''<27><>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>:''+''' + Trim(DName) + '''');
|
||
sql.Add('+'' ''+Convert(Varchar(20),getdate(),120)');
|
||
sql.Add(' where MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
||
// ShowMessage(SQL.Text);
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete WFB_MJJY_PB where MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
||
sql.Add('delete WFB_MJJY_CD_PB where MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
||
sql.Add('delete CK_PBCP_CR where MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
||
sql.Add('delete CK_PBCP_kc where MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('Update JYCon_Sub_AnPai Set JYFlag=0 where APID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
Order_Main.Delete;
|
||
end
|
||
else
|
||
Next;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.PrintData(FFFMJID: string);
|
||
var
|
||
fPrintFile: string;
|
||
i: Integer;
|
||
FDate: string;
|
||
Txt, fImagePath: string;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
begin
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C>ش<EFBFBD><D8B4><EFBFBD>Ʊ<EFBFBD><C6B1>ǩ.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt := Trim(FFFMJID);
|
||
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;
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('exec P_Print_PBLab :MJID');
|
||
Parameters.ParamByName('MJID').Value := Trim(FFFMJID);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint, CDS_Print);
|
||
SInitCDSData20(ADOQueryPrint, CDS_Print);
|
||
RM2.LoadFromFile(fPrintFile);
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RM2.ShowReport;
|
||
// RM2.PrintReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C>ش<EFBFBD><D8B4><EFBFBD>Ʊ<EFBFBD><C6B1>ǩ.rmf'), '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.TBPrintClick(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if Order_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while Order_Main.Locate('SSel', True, []) do
|
||
begin
|
||
PrintData(Trim(Order_Main.FieldByName('MJID').AsString));
|
||
Edit;
|
||
FieldByName('SSel').Value := false;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
end;
|
||
|
||
function TfrmJYOrderCDOnePB.Savedata(): Boolean;
|
||
var
|
||
maxno, LLID: string;
|
||
HXPS: Integer;
|
||
HXQty, HXMQty: Double;
|
||
begin
|
||
HXPS := 0;
|
||
HXQty := 0;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select Top 1 * from Contract_Cloth_LL where OrdSubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
sql.Add(' and FirstName=''' + Trim(Order_Main.fieldbyname('AOrddefstr4').AsString) + '''');
|
||
Open;
|
||
end;
|
||
LLID := Trim(ADOQueryTemp.fieldbyname('LLID').AsString);
|
||
if Trim(LLID) = '' then
|
||
begin
|
||
Result := False;
|
||
Application.MessageBox('û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ļӹ<C4BC><D3B9><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
if GetLSNo(ADOQueryCmd, maxno, 'HX', 'Contract_Cloth_BefChkHX', 2, 1) = False then
|
||
begin
|
||
Result := False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Order_Main.FieldByName('SSel').AsBoolean = True then
|
||
begin
|
||
HXPS := HXPS + 1;
|
||
HXQty := HXQty + Order_Main.FieldByName('MJLen').Value;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('');
|
||
Open;
|
||
end;
|
||
except
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.OrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
IntTab();
|
||
InitGridYe();
|
||
InitHZ();
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
if Self.Caption = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ' then
|
||
Exit;
|
||
IntTab();
|
||
InitGridYe();
|
||
InitHZ();
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.TBCLClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
Exit;
|
||
if Order_Main.Locate('ssel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while Order_Main.Locate('SSel', True, []) do
|
||
begin
|
||
if Order_Main.FieldByName('SSel').AsBoolean = True then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' UPdate WFB_MJJY_PB Set ChuLiFlag=1,ChuLiDate=getdate(),ChuLiPerson=''' + Trim(DName) + '''');
|
||
sql.Add(' where MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.TBCancelClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if cxTabControl1.TabIndex <> 1 then
|
||
Exit;
|
||
if Order_Main.Locate('ssel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while Order_Main.Locate('SSel', True, []) do
|
||
begin
|
||
if Order_Main.FieldByName('SSel').AsBoolean = True then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' UPdate WFB_MJJY_PB Set ChuLiFlag=0,ChuLiDate=getdate(),ChuLiPerson=''' + Trim(DName) + '''');
|
||
sql.Add(' where MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.C_CodeKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
{if Key=#13 then
|
||
begin
|
||
if Length(C_Code.Text)<3 then Exit;
|
||
MovePanel2.Visible:=True;
|
||
MovePanel2.Refresh;
|
||
try
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Viwe_JYInfo :begdate,:enddate,:PState,:FFSql ');
|
||
|
||
Parameters.ParamByName('PState').Value:=3;
|
||
if cxTabControl1.TabIndex=0 then
|
||
begin
|
||
Parameters.ParamByName('FFSql').Value:=' and BB.C_Code='''+Trim(C_Code.Text)+''' and ChuLiFlag=0 ';
|
||
end else
|
||
if cxTabControl1.TabIndex=1 then
|
||
begin
|
||
Parameters.ParamByName('FFSql').Value:=' and BB.C_Code='''+Trim(C_Code.Text)+''' and ChuLiFlag=1 ';
|
||
end else
|
||
begin
|
||
Parameters.ParamByName('FFSql').Value:=' and BB.C_Code='''+Trim(C_Code.Text)+'''';
|
||
end;
|
||
if CheckBox1.Checked=False then
|
||
begin
|
||
Parameters.ParamByName('begdate').Value:='';
|
||
Parameters.ParamByName('enddate').Value:='';
|
||
end else
|
||
begin
|
||
if cxTabControl1.TabIndex<>0 then
|
||
begin
|
||
Parameters.ParamByName('begdate').Value:=FormatDateTime('yyyy-MM-dd',BegDate.DateTime);
|
||
Parameters.ParamByName('enddate').Value:=FormatDateTime('yyyy-MM-dd',enddate.DateTime+1);
|
||
end else
|
||
begin
|
||
Parameters.ParamByName('begdate').Value:='2000-01-01';
|
||
Parameters.ParamByName('enddate').Value:='2500-01-01';
|
||
end;
|
||
end;
|
||
Open;
|
||
end;
|
||
//SCreateCDS20(ADOQueryMain,Order_Main);
|
||
// SInitCDSData20(ADOQueryMain,Order_Main);
|
||
finally
|
||
Order_Main.EnableControls;
|
||
end;
|
||
MovePanel2.Visible:=False;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.IntTab();
|
||
var
|
||
JLInt, YeInt, i: Integer;
|
||
fsj, fsj10: string;
|
||
begin
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select JLInt=isnull(Count(*),0) from (');
|
||
sql.add('select AA.* from (');
|
||
sql.Add('select C.*,CM.ConNo Orderno,BB.C_Code,BB.C_CodeName,BB.BatchNoHZ,BB.C_Spec,BB.C_Color ');
|
||
sql.Add('from WFB_MJJY_PB C ');
|
||
sql.Add(' inner join Cloth_Sub BB on C.MainId=BB.MainId ');
|
||
sql.Add(' inner join Cloth_Main CM on BB.MainId=CM.MainId');
|
||
|
||
if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
sql.Add(' where C.FillTime>=''' + Trim('2000-01-01') + '''');
|
||
sql.Add(' and C.FillTime<''' + Trim('2500-01-01') + '''');
|
||
end
|
||
else
|
||
begin
|
||
if CheckBox1.Checked = True then
|
||
begin
|
||
sql.Add(' where C.FillTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + '''');
|
||
sql.Add(' and C.FillTime<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1)) + '''');
|
||
end
|
||
else
|
||
begin
|
||
sql.Add(' where C.FillTime>=''' + Trim('2000-01-01') + '''');
|
||
sql.Add(' and C.FillTime<''' + Trim('2500-01-01') + '''');
|
||
end;
|
||
end;
|
||
if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
sql.add(' and ChuLiFlag=0 ');
|
||
end
|
||
else if cxTabControl1.TabIndex = 1 then
|
||
begin
|
||
sql.add(' and ChuLiFlag=1 ');
|
||
end;
|
||
|
||
sql.Add(' and isnull(JTType,'''')<>''<27><><EFBFBD><EFBFBD>'' ');
|
||
if CheckBox2.Checked then
|
||
begin
|
||
sql.Add(' and isnull(CDQK,'''')<>'''' ');
|
||
end;
|
||
fsj10 := SGetFilters(Panel1, 1, 2);
|
||
if Trim(fsj10) <> '' then
|
||
begin
|
||
fsj10 := ' and ' + fsj10;
|
||
end
|
||
else
|
||
begin
|
||
fsj10 := '';
|
||
end;
|
||
SQL.Add(' ) AA Where 1=1 ');
|
||
sql.Add(fsj10);
|
||
SQL.Add(') AAA');
|
||
// ShowMessage(SQL.Text);
|
||
open;
|
||
end;
|
||
JLInt := ADOQueryTemp.fieldbyname('JLInt').AsInteger;
|
||
YeInt := JLInt div 500;
|
||
YeInt := YeInt + 1;
|
||
cxTabControl2.Tabs.Clear;
|
||
for i := 1 to YeInt do
|
||
begin
|
||
fsj := '<27><>' + IntToStr(i) + 'ҳ';
|
||
cxTabControl2.Tabs.Add(fsj);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.cxTabControl2Change(Sender: TObject);
|
||
begin
|
||
InitGridYe();
|
||
InitHZ();
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.ZhenCunTypeChange(Sender: TObject);
|
||
begin
|
||
IntTab();
|
||
InitGridYe();
|
||
InitHZ();
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.Button1Click(Sender: TObject);
|
||
begin
|
||
// try
|
||
// frmJFMoneyList:=TfrmJFMoneyList.Create(Application);
|
||
// with frmJFMoneyList do
|
||
// begin
|
||
//
|
||
// frmJFMoneyList.Align:=alClient;
|
||
// if ShowModal=1 then
|
||
// begin
|
||
//
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmJFMoneyList.Free;
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.ToolButton1Click(Sender: TObject);
|
||
var
|
||
fPrintFile, fPrintFile10, FMainID: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
|
||
if Order_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;
|
||
FMainID := '';
|
||
Order_Main.DisableControls;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Fieldbyname('Ssel').AsBoolean then
|
||
begin
|
||
ADOQueryCmd.append;
|
||
ADOQueryCmd.fieldbyname('SubId').Value := Trim(Order_Main.fieldbyname('MJID').AsString);
|
||
ADOQueryCmd.fieldbyname('Dname').Value := Trim(DCode);
|
||
ADOQueryCmd.post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select distinct CONVERT(varchar(100), Filltime, 23) from WFB_MJJY_PB A');
|
||
sql.Add(' where A.MJID in (select SubId from TBSubID where DName=' + quotedstr(Trim(DName)) + ') ');
|
||
Open;
|
||
|
||
end;
|
||
|
||
if ADOQueryTemp.RecordCount > 1 then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ͬһ<CDAC><D2BB>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_Do_Print_JYBBZZ ');
|
||
sql.add(' @DName=' + quotedstr(Trim(DCode)));
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryCmd, CDS_Print);
|
||
SInitCDSData20(ADOQueryCmd, CDS_Print);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><>֯<EFBFBD><D6AF><EFBFBD>鱨<EFBFBD><E9B1A8>.rmf';
|
||
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 TfrmJYOrderCDOnePB.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
var
|
||
FMJStr2, FMJStr4: string;
|
||
begin
|
||
|
||
// if AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('MJStr2').Index] = null then
|
||
// Exit;
|
||
// if AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('MJStr4').Index] = null then
|
||
// Exit;
|
||
FMJStr2 := AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('MJStr2').Index];
|
||
FMJStr4 := AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('MJStr4').Index];
|
||
|
||
// if FMJStr2 = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
// ACanvas.Font.Color := $7280FA;
|
||
if FMJStr4 = 'δ<><CEB4><EFBFBD><EFBFBD>' then
|
||
ACanvas.Font.Color := $FF0000;
|
||
if FMJStr4 = '<27>ѳ<EFBFBD><D1B3><EFBFBD>' then
|
||
ACanvas.Font.Color := $0000FF;
|
||
|
||
end;
|
||
|
||
procedure TfrmJYOrderCDOnePB.ToolButton2Click(Sender: TObject);
|
||
var
|
||
FName: string;
|
||
FReal: Double;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if Trim(XM.Text) = '' then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ŀ!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(XMStr.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><>Ŀֵ<C4BF><D6B5><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Order_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if Application.MessageBox(PChar('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ݵġ<DDB5>' + Trim(XM.Text) + '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>' + Trim(XMStr.Text) + ' <20><><EFBFBD><EFBFBD>'), '', 32 + 4) <> IDYES then
|
||
Exit;
|
||
if Trim(XM.Text) = '<27>鲼<EFBFBD><E9B2BC>' then
|
||
FName := 'FILLER';
|
||
if Trim(XM.Text) = '<27><><EFBFBD><EFBFBD>' then
|
||
FName := 'WorkShift';
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Order_Main.FieldByName('SSel').AsBoolean = True then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate WFB_MJJY_PB Set ' + FName + '=''' + Trim(XMStr.Text) + '''');
|
||
sql.Add(' where mjid=''' + Trim(Order_Main.fieldbyname('mjid').AsString) + '''');
|
||
// sql.Add(' and isnull(FZSPID,'''')<>'''' ');
|
||
ExecSQL;
|
||
end;
|
||
Edit;
|
||
FieldByName(FName).Value := Trim(XMStr.Text);
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ijɹ<C4B3>!', '<27><>ʾ', 0);
|
||
except
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB8>쳣!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|