1015 lines
30 KiB
ObjectPascal
1015 lines
30 KiB
ObjectPascal
![]() |
unit U_TCCKlist;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, ComCtrls, ToolWin, StdCtrls, ExtCtrls, cxStyles, cxCustomData,
|
|||
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData,
|
|||
|
cxButtonEdit, cxDropDownEdit, cxGridLevel, cxGridCustomTableView,
|
|||
|
cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
|
|||
|
cxGrid, DBClient, ADODB, cxGridCustomPopupMenu, cxGridPopupMenu, RM_Common,
|
|||
|
RM_Class, RM_e_Xls, RM_GridReport, RM_System, RM_Dataset, cxTextEdit, cxPC,
|
|||
|
cxCheckBox, Menus, Clipbrd, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
|||
|
dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters, dxSkinscxPCPainter,
|
|||
|
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, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
|
|||
|
dxSkinXmas2008Blue;
|
|||
|
|
|||
|
type
|
|||
|
TfrmTCCKlist = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBExport: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1P_CodeName: TcxGridDBColumn;
|
|||
|
v1P_SPEC: TcxGridDBColumn;
|
|||
|
v1P_MF: TcxGridDBColumn;
|
|||
|
v1P_KZ: TcxGridDBColumn;
|
|||
|
v1Qty: TcxGridDBColumn;
|
|||
|
v1QtyUnit: TcxGridDBColumn;
|
|||
|
v1Note: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
v1CRType: TcxGridDBColumn;
|
|||
|
v1CRTime: TcxGridDBColumn;
|
|||
|
v1Filler: TcxGridDBColumn;
|
|||
|
v1FillTime: TcxGridDBColumn;
|
|||
|
Label2: TLabel;
|
|||
|
Label3: TLabel;
|
|||
|
OrderNo: TEdit;
|
|||
|
CRType: TComboBox;
|
|||
|
Label5: TLabel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryTmp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
v1MJID: TcxGridDBColumn;
|
|||
|
v1P_Color: TcxGridDBColumn;
|
|||
|
ADOPrint: TADOQuery;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
v1P_Code: TcxGridDBColumn;
|
|||
|
v1inoutNO: TcxGridDBColumn;
|
|||
|
inoutNo: TEdit;
|
|||
|
Label7: TLabel;
|
|||
|
v1custName: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
cxStyle2: TcxStyle;
|
|||
|
cxStyle_gridRow: TcxStyle;
|
|||
|
cxStyle_gridFoot: TcxStyle;
|
|||
|
cxStyle_gridHead: TcxStyle;
|
|||
|
cxStyle_gridGroupBox: TcxStyle;
|
|||
|
cxStyle_yellow: TcxStyle;
|
|||
|
cxStyle_Red: TcxStyle;
|
|||
|
cxStyle_fontBlack: TcxStyle;
|
|||
|
cxStyle_fontclFuchsia: TcxStyle;
|
|||
|
cxStyle_fontclPurple: TcxStyle;
|
|||
|
cxStyle_fontclGreen: TcxStyle;
|
|||
|
cxStyle_fontclBlue: TcxStyle;
|
|||
|
cxStyle_fontclTeal: TcxStyle;
|
|||
|
cxStyle_fontclOlive: TcxStyle;
|
|||
|
Label8: TLabel;
|
|||
|
ToFactoryName: TEdit;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
v1Column18: TcxGridDBColumn;
|
|||
|
RM1: TRMGridReport;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
P_CodeName: TEdit;
|
|||
|
P_Color: TEdit;
|
|||
|
Label10: TLabel;
|
|||
|
Label11: TLabel;
|
|||
|
P_Code: TEdit;
|
|||
|
Label14: TLabel;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
CDS_MX: TClientDataSet;
|
|||
|
DS_MX: TDataSource;
|
|||
|
Panel2: TPanel;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
TvMX: TcxGridDBTableView;
|
|||
|
vMXColumn1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn8: TcxGridDBColumn;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
ToolBar2: TToolBar;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
Label4: TLabel;
|
|||
|
RKNO: TEdit;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
Label6: TLabel;
|
|||
|
ganghao: TEdit;
|
|||
|
N3: TMenuItem;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
ToolButton6: TToolButton;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure OrderNoChange(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBEditClick(Sender: TObject);
|
|||
|
procedure TBDelClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure v1Column6CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure TvMXCustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure cxGridDBColumn8PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure vMXColumn1PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure N3Click(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
private
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitMXGrid(MCRNO: string);
|
|||
|
function YSData(ADO: TADOQuery): Boolean;
|
|||
|
function YSData_Other(ADO: TADOQuery; fYFName: string; fmoney: double): Boolean;
|
|||
|
procedure SetStatus();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1, canshu2: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmTCCKlist: TfrmTCCKlist;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun10, U_ZDYHelp, U_TCCk, U_TCTQCk, U_DJBCKMXLR, U_SysLogHelp;
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmTCCKlist.InitMXGrid(MCRNO: string);
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_ML_CRMX where CRNO=' + quotedstr(Trim(MCRNO)));
|
|||
|
sql.Add(' order by MXID');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTmp, CDS_MX);
|
|||
|
SInitCDSData20(ADOQueryTmp, CDS_MX);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.SetStatus();
|
|||
|
begin
|
|||
|
TBEdit.Visible := False;
|
|||
|
TBDel.Visible := False;
|
|||
|
|
|||
|
if Trim(canshu1) = '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
begin
|
|||
|
TBEdit.Visible := true;
|
|||
|
TBDel.Visible := true;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmTCCKlist.YSData(ADO: TADOQuery): Boolean;
|
|||
|
var
|
|||
|
CRID, YFID, Price, PriceUnit, OrderUnit, FComTaiTou, cust: string;
|
|||
|
begin
|
|||
|
Result := False;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where FactoryName=''' + Trim(ADO.fieldbyname('custName').asstring) + ''' and YFDefFlag1=0 ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if not ADOQueryTmp.IsEmpty then
|
|||
|
begin
|
|||
|
CRID := ADOQueryTmp.fieldbyname('CRID').AsString;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
|
|||
|
sql.Add('select * from YF_Money_CRID ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
CRID := ADOQueryCmd.fieldbyname('CRID').AsString;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CRID').Value := StrToInt(CRID);
|
|||
|
FieldByName('FactoryName').Value := Trim(ADO.fieldbyname('custName').asstring);
|
|||
|
FieldByName('ZdyStr1').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete from YF_Money_CR ');
|
|||
|
sql.Add(' where MainID=''' + Trim(ADO.fieldbyname('CRNO').AsString) + '''');
|
|||
|
sql.Add(' and subID=''' + Trim(ADO.fieldbyname('CRID').AsString) + '''');
|
|||
|
sql.Add(' and YFName=''<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>'' ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR ');
|
|||
|
sql.Add(' where MainID=''' + Trim(ADO.fieldbyname('CRNO').AsString) + '''');
|
|||
|
sql.Add(' and subID=''' + Trim(ADO.fieldbyname('CRID').AsString) + '''');
|
|||
|
sql.Add(' and YFName=''<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryTmp.IsEmpty then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd, YFID, 'CS', 'YF_Money_CR', 4, 1) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('ȡӦ<C8A1><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('YFID').Value := Trim(YFID);
|
|||
|
FieldByName('YFTypeId').Value := Trim(ADO.fieldbyname('CRNO').AsString);
|
|||
|
FieldByName('CRID').Value := StrToInt(CRID);
|
|||
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
FieldByName('CRType').Value := 'Ӧ<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>';
|
|||
|
FieldByName('CRFlag').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('QtyFlag').Value := 1;
|
|||
|
FieldByName('FactoryName').Value := Trim(ADO.fieldbyname('custName').asstring);
|
|||
|
FieldByName('CRTime').Value := Trim(FormatDateTime('yyyy-MM-dd', ADO.fieldbyname('CRTime').AsDateTime));
|
|||
|
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('ps').Value := ADO.fieldbyname('RollNum').AsFloat;
|
|||
|
FieldByName('Qty').Value := ADO.fieldbyname('Qty').AsFloat;
|
|||
|
FieldByName('Price').Value := ADO.fieldbyname('Price').AsFloat;
|
|||
|
FieldByName('Money').Value := ADO.fieldbyname('Money').AsFloat;
|
|||
|
FieldByName('BBMoney').Value := ADO.fieldbyname('Money').AsFloat;
|
|||
|
FieldByName('HuiLv').Value := 1;
|
|||
|
FieldByName('BZType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('QtyUnit').Value := Trim(ADO.fieldbyname('QtyUnit').AsString);
|
|||
|
FieldByName('ComTaiTou').Value := Trim(cust);
|
|||
|
FieldByName('YFName').Value := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('MainId').Value := Trim(ADO.fieldbyname('CRNO').AsString);
|
|||
|
FieldByName('subID').Value := Trim(ADO.fieldbyname('CRID').AsString);
|
|||
|
FieldByName('status').Value := '0';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
YFID := Trim(ADOQueryTmp.fieldbyname('YFID').AsString);
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(' where CRID=' + CRID);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
Result := True;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmTCCKlist.YSData_Other(ADO: TADOQuery; fYFName: string; fmoney: double): Boolean;
|
|||
|
var
|
|||
|
CRID, YFID, Price, PriceUnit, OrderUnit, FComTaiTou, cust: string;
|
|||
|
begin
|
|||
|
Result := False;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where FactoryName=''' + Trim(ADO.fieldbyname('custName').asstring) + ''' and YFDefFlag1=0 ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if not ADOQueryTmp.IsEmpty then
|
|||
|
begin
|
|||
|
CRID := ADOQueryTmp.fieldbyname('CRID').AsString;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
|
|||
|
sql.Add('select * from YF_Money_CRID ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
CRID := ADOQueryCmd.fieldbyname('CRID').AsString;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CRID').Value := StrToInt(CRID);
|
|||
|
FieldByName('FactoryName').Value := Trim(ADO.fieldbyname('custName').asstring);
|
|||
|
FieldByName('ZdyStr1').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete from YF_Money_CR ');
|
|||
|
sql.Add(' where MainID=''' + Trim(ADO.fieldbyname('CRNO').AsString) + '''');
|
|||
|
sql.Add(' and subID=''' + Trim(ADO.fieldbyname('CRID').AsString) + '''');
|
|||
|
sql.Add(' and YFName=''' + trim(fYFName) + ''' ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR ');
|
|||
|
sql.Add(' where MainID=''' + Trim(ADO.fieldbyname('CRNO').AsString) + '''');
|
|||
|
sql.Add(' and subID=''' + Trim(ADO.fieldbyname('CRID').AsString) + '''');
|
|||
|
sql.Add(' and YFName=''' + trim(fYFName) + ''' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryTmp.IsEmpty then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd, YFID, 'CS', 'YF_Money_CR', 4, 1) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('ȡӦ<C8A1><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('YFID').Value := Trim(YFID);
|
|||
|
FieldByName('YFTypeId').Value := Trim(ADO.fieldbyname('CRNO').AsString);
|
|||
|
FieldByName('CRID').Value := StrToInt(CRID);
|
|||
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
FieldByName('CRType').Value := 'Ӧ<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>';
|
|||
|
FieldByName('CRFlag').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('QtyFlag').Value := 1;
|
|||
|
FieldByName('FactoryName').Value := Trim(ADO.fieldbyname('custName').asstring);
|
|||
|
FieldByName('CRTime').Value := Trim(FormatDateTime('yyyy-MM-dd', ADO.fieldbyname('CRTIme').AsDateTime));
|
|||
|
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('Qty').Value := 1;
|
|||
|
FieldByName('Price').Value := fmoney;
|
|||
|
FieldByName('Money').Value := fmoney;
|
|||
|
FieldByName('BBMoney').Value := fmoney;
|
|||
|
FieldByName('HuiLv').Value := 1;
|
|||
|
FieldByName('BZType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('QtyUnit').Value := '<27><>';
|
|||
|
FieldByName('ComTaiTou').Value := Trim(cust);
|
|||
|
FieldByName('YFName').Value := fYFName;
|
|||
|
FieldByName('MainId').Value := Trim(ADO.fieldbyname('CRNO').AsString);
|
|||
|
FieldByName('subID').Value := Trim(ADO.fieldbyname('CRID').AsString);
|
|||
|
FieldByName('status').Value := '0';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
YFID := Trim(ADOQueryTmp.fieldbyname('YFID').AsString);
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(' where CRID=' + CRID);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
Result := True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
sql.Add(' ,RKNO=(select X.INoutNo from CK_ML_CR X where X.MJID=A.MJID and CRFlag=''<27><><EFBFBD><EFBFBD>'') ');
|
|||
|
sql.Add(' ,RKQty=(select Qty from CK_ML_CR X where X.MJID=A.MJID and X.CRFLAG=''<27><><EFBFBD><EFBFBD>'') ');
|
|||
|
SQL.Add(' from CK_ML_CR A ');
|
|||
|
sql.Add(' where CRTime>=''' + formatdateTime('yyyy-MM-dd', begdate.Date) + ''' ');
|
|||
|
sql.Add(' and CRTime<''' + formatdateTime('yyyy-MM-dd', enddate.Date + 1) + ''' ');
|
|||
|
sql.Add(' and CKName=''<27><><EFBFBD>첼'' and CRFlag=''<27><><EFBFBD><EFBFBD>'' and A.valid=''Y'' ');
|
|||
|
if cxTabControl1.TabIndex <> 2 then
|
|||
|
begin
|
|||
|
if cxTabControl1.TabIndex = 0 then
|
|||
|
SQL.Add(' and not exists(select YFPZNO from YF_Money_CR_Sub X where X.YFPZNO=A.CRNO ) ')
|
|||
|
else
|
|||
|
SQL.Add(' and exists(select YFPZNO from YF_Money_CR_Sub X where X.YFPZNO=A.CRNO )');
|
|||
|
end;
|
|||
|
open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := cafree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmTCCKlist := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.TBAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
frmTCCk := TfrmTCCk.create(self);
|
|||
|
with frmTCCk do
|
|||
|
begin
|
|||
|
fkeyNo := '';
|
|||
|
fType := 0;
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
self.CDS_Main.Locate('crNo', trim(fkeyNo), []);
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.OrderNoChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQuerymain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQuerymain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS20(ADOQuerymain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQuerymain, CDS_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
readCxGrid(self.Caption, Tv1, '<27><><EFBFBD>ϲֿ<CFB2>');
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
EndDate.Date := SGetServerDate10(ADOQueryTmp);
|
|||
|
BegDate.Date := EndDate.Date - 30;
|
|||
|
cxGrid1.Align := alclient;
|
|||
|
canshu1 := trim(DParameters1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
writeCxGrid(self.Caption, Tv1, '<27><><EFBFBD>ϲֿ<CFB2>');
|
|||
|
close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if cds_main.IsEmpty then
|
|||
|
exit;
|
|||
|
if cds_main.Locate('ssel', true, []) = false then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if (cds_main.fieldbyname('Filler').AsString <> trim(DName)) and (trim(canshu2) <> '<27><>Ȩ<EFBFBD><C8A8>') then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from yf_money_cr_sub E WHERE e.yfpzno=' + QuotedStr(Trim(CDS_Main.FieldByName('CRNO').AsString)));
|
|||
|
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryTmp.IsEmpty = False then
|
|||
|
begin
|
|||
|
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if trim(cds_main.fieldbyname('ISRCCK').AsString) = 'Ⱦ<><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CK_ML_CR set ISXG=1 where CRNO=' + quotedstr('R' + Trim(CDS_Main.FieldByName('MJID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
frmTCTQCk := TfrmTCTQCk.create(self);
|
|||
|
with frmTCTQCk do
|
|||
|
begin
|
|||
|
fkeyNo := self.cds_main.fieldbyname('CRNO').AsString;
|
|||
|
fType := 1;
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
self.CDS_Main.Locate('crNo', trim(fkeyNo), []);
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
frmTCCk := TfrmTCCk.create(self);
|
|||
|
with frmTCCk do
|
|||
|
begin
|
|||
|
fkeyNo := self.cds_main.fieldbyname('CRNO').AsString;
|
|||
|
fType := 1;
|
|||
|
InoutNo.Enabled := false;
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
self.CDS_Main.Locate('CRNO', trim(fkeyNo), []);
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.TBDelClick(Sender: TObject);
|
|||
|
var
|
|||
|
YFID, CRID, note: 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;
|
|||
|
if Trim(CDS_Main.fieldbyname('Filler').AsString) <> Trim(DName) then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
if Trim(CDS_Main.FieldByName('CRNO').AsString) <> '' then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from yf_money_cr_sub E WHERE e.yfpzno=' + QuotedStr(Trim(CDS_Main.FieldByName('CRNO').AsString)));
|
|||
|
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryTmp.IsEmpty = False then
|
|||
|
begin
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
if Trim(CDS_Main.FieldByName('ISRCCK').AsString) = 'Ⱦ<><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
sql.Add('update CK_ML_CR set Valid=''N'' where MJID=' + quotedstr(Trim(CDS_Main.FieldByName('MJID').AsString)));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
sql.Add('update CK_ML_CR set Valid=''N'' where CRNO=' + quotedstr(Trim(CDS_Main.FieldByName('CRNO').AsString)));
|
|||
|
end;
|
|||
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
sql.Add(',getdate() ');
|
|||
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>뵥ɾ<EBB5A5><C9BE>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('inoutNO').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('exec P_Up_MLKc ' + quotedstr(Trim(CDS_Main.FieldByName('MJID').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if Trim(ADOQueryCmd.FieldByName('Msg').AsString) = '<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>' then
|
|||
|
begin
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
except
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
initGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel(self.Caption, cxgrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.v1Column6CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
|||
|
var
|
|||
|
colIdx0, colIdx1: integer;
|
|||
|
begin
|
|||
|
colIdx0 := tv1.GetColumnByFieldName('CRNO').Index;
|
|||
|
if (ARow1.Values[colIdx0] = ARow2.Values[colIdx0]) then
|
|||
|
AAreEqual := True
|
|||
|
else
|
|||
|
AAreEqual := False;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
InitMXGrid(Trim(CDS_Main.fieldbyname('CRNO').AsString));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.ToolButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
MaxNo, MMXID, MCRNO, MGangHao: string;
|
|||
|
begin
|
|||
|
MCRNO := Trim(CDS_Main.fieldbyname('CRNO').AsString);
|
|||
|
MGangHao := Trim(CDS_Main.fieldbyname('GangHao').AsString);
|
|||
|
if GetLSNo(ADOQueryTmp, MaxNo, 'MCM', 'CK_ML_CRMX', 3, 1) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
for i := 1 to 10 do
|
|||
|
begin
|
|||
|
MMXID := Trim(MaxNo) + Trim(inttostr(i));
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('insert into CK_ML_CRMX (MXID,CRNO,MXQty,MXGangHao)');
|
|||
|
sql.Add('values(' + quotedstr(MMXID));
|
|||
|
sql.Add(',' + quotedstr(Trim(MCRNO)));
|
|||
|
sql.Add(',0');
|
|||
|
sql.Add(',' + quotedstr(Trim(MGangHao)));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
InitMXGrid(MCRNO);
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('delete CK_ML_CRMX where MXID=' + quotedstr(Trim(CDS_MX.FieldByName('MXID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_MX.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.TvMXCustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
|||
|
var
|
|||
|
FValue: string;
|
|||
|
FBounds: TRect;
|
|||
|
begin
|
|||
|
FBounds := AViewInfo.Bounds;
|
|||
|
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
|
|||
|
begin
|
|||
|
ACanvas.FillRect(FBounds);
|
|||
|
ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);
|
|||
|
FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index + 1);
|
|||
|
InflateRect(FBounds, -1, -1); //Platform specific. May not work on Linux.
|
|||
|
ACanvas.Font.Color := clBlack;
|
|||
|
ACanvas.Brush.Style := bsClear;
|
|||
|
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
|
|||
|
ADone := True;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.ToolButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
EXIT;
|
|||
|
if CDS_Main.fieldbyname('ssel').value <> true then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ݲ<EFBFBD>ȷ!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if ((trim(ComboBox1.Text) = '<27><>ͨ<EFBFBD>뵥') or (trim(ComboBox1.Text) = '<27><><EFBFBD><EFBFBD><EFBFBD>뵥')) then
|
|||
|
begin
|
|||
|
with ADOPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Print_CPCKMD1 ' + quotedstr(Trim(CDS_Main.fieldbyname('inoutNO').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ComboBox1.Text) + '.rmf';
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
// RMVariables['KHName']:=Trim(CDS_Main.fieldbyname('CustomerNoName').AsString);
|
|||
|
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CK_ML_CR set DYCS=DYCS+1 where CRNO=' + quotedstr(Trim(CDS_Main.FieldByName('CRNO').AsString)));
|
|||
|
|
|||
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
sql.Add(',getdate() ');
|
|||
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>뵥<EFBFBD><EBB5A5>ӡ')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('inoutNO').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('DYCS').Value := CDS_Main.fieldbyname('DYCS').AsInteger + 1;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.cxGridDBColumn8PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
begin
|
|||
|
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
FFieldName := Trim(TvMX.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
with CDS_MX do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CK_ML_CRMX set ' + FFieldName + ' = ' + mvalue);
|
|||
|
sql.Add(' where MXID=' + quotedstr(Trim(CDS_MX.FieldByName('MXID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
TvMX.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.vMXColumn1PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
begin
|
|||
|
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
FFieldName := Trim(TvMX.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
with CDS_MX do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CK_ML_CRMX set ' + FFieldName + ' = ' + QuotedStr(Trim(mvalue)));
|
|||
|
sql.Add(' where MXID=' + quotedstr(Trim(CDS_MX.FieldByName('MXID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
TvMX.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
frmTCTQCk := TfrmTCTQCk.create(self);
|
|||
|
with frmTCTQCk do
|
|||
|
begin
|
|||
|
fkeyNo := '';
|
|||
|
fType := 0;
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
self.CDS_Main.Locate('crNo', trim(fkeyNo), []);
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('ISRCCK').index] = 'Ⱦ<><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('RKQty').index] <= 0 then
|
|||
|
begin
|
|||
|
ACanvas.Brush.Color := $00FFFF;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
ACanvas.Font.Color := $0000FF;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.ToolButton5Click(Sender: TObject);
|
|||
|
var
|
|||
|
flx: string;
|
|||
|
begin
|
|||
|
if CDS_Main.fieldbyname('ssel').value <> true then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ݲ<EFBFBD>ȷ!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
frmDJBCKMXLR := TfrmDJBCKMXLR.create(self);
|
|||
|
with frmDJBCKMXLR do
|
|||
|
begin
|
|||
|
fkeyNo := self.cds_main.fieldbyname('CRNO').AsString;
|
|||
|
FMXGangHao := self.cds_main.fieldbyname('GangHao').AsString;
|
|||
|
fType := 0;
|
|||
|
flx := self.cds_main.fieldbyname('CRType').AsString;
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
self.InitGrid();
|
|||
|
self.CDS_Main.Locate('CRNO', fkeyNo, [])
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.N3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Clipboard.SetTextBuf(PChar(Trim(CDS_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
initGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTCCKlist.ToolButton6Click(Sender: TObject);
|
|||
|
begin
|
|||
|
frmSysLogHelp := TfrmSysLogHelp.create(self);
|
|||
|
with frmSysLogHelp do
|
|||
|
begin
|
|||
|
fModel := self.caption;
|
|||
|
// facction:='<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>ɾ<EFBFBD><C9BE>';
|
|||
|
showmodal;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|