531 lines
16 KiB
ObjectPascal
531 lines
16 KiB
ObjectPascal
![]() |
unit U_PBCKlistSel;
|
|||
|
|
|||
|
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, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,
|
|||
|
dxSkinsDefaultPainters, dxSkinscxPCPainter, cxNavigator, dxBarBuiltInMenu,
|
|||
|
cxCalendar, 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
|
|||
|
TfrmPBCKlistSel = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBExport: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
Label2: TLabel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryTmp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOPrint: TADOQuery;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
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;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
RM1: TRMGridReport;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column16: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v2Column6: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
v1Column22: TcxGridDBColumn;
|
|||
|
v1Column24: TcxGridDBColumn;
|
|||
|
v1Column29: TcxGridDBColumn;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Label3: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Label8: TLabel;
|
|||
|
Label12: TLabel;
|
|||
|
Label13: TLabel;
|
|||
|
Label14: TLabel;
|
|||
|
Label15: TLabel;
|
|||
|
SPName: TEdit;
|
|||
|
FactoryName: TEdit;
|
|||
|
SPID: TEdit;
|
|||
|
SPSpec: TEdit;
|
|||
|
CRType: TComboBox;
|
|||
|
ToFactoryName: TEdit;
|
|||
|
SPCode: TEdit;
|
|||
|
FZSPID: TEdit;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure OrderNoChange(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(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 ToolButton1Click(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
private
|
|||
|
procedure InitGrid();
|
|||
|
function YSData(ADO: TADOQuery): Boolean;
|
|||
|
function YSData_Other(ADO: TADOQuery; fYFName: string; fmoney: double): Boolean;
|
|||
|
procedure SetStatus();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
fCKName, FZZType: string;
|
|||
|
canshu1, canshu2: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmPBCKlistSel: TfrmPBCKlistSel;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun10, U_ZDYHelp;
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmPBCKlistSel.SetStatus();
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmPBCKlistSel.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 TfrmPBCKlistSel.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 TfrmPBCKlistSel.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
sql.Add(',ISSC=cast((case when isnull((select count(WBID) from TP_File X where X.WBID=A.spid and X.TFType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''),0)>0 then 1 else 0 end) as bit)');
|
|||
|
SQL.Add(',IST=CAST(ISNULL(ISTS,''0'') AS BIT)');
|
|||
|
sql.Add(' from CK_SXPB_CR A');
|
|||
|
|
|||
|
sql.Add(' where A.CRTime>=' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime))) + ' and A.CRTime<' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1))));
|
|||
|
SQL.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
SQL.Add(' and isnull(CKName,'''')=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
if cxTabControl1.TabIndex = 0 then
|
|||
|
SQL.Add(' and not exists(select YFPZNO from YF_Money_CR_Sub X where X.YFPZNO=A.spid AND KXTYPE=''<27>ⷢ<EFBFBD><E2B7A2><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'' ) ')
|
|||
|
else
|
|||
|
SQL.Add(' and exists(select YFPZNO from YF_Money_CR_Sub X where X.YFPZNO=A.spid AND KXTYPE=''<27>ⷢ<EFBFBD><E2B7A2><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'' )');
|
|||
|
|
|||
|
open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBCKlistSel.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caHide;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBCKlistSel.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmPBCKlistSel := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBCKlistSel.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 TfrmPBCKlistSel.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
readCxGrid(self.Caption + 'TV1', Tv1, '<27><><EFBFBD>ϲֿ<CFB2>');
|
|||
|
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBCKlistSel.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
EndDate.Date := SGetServerDate10(ADOQueryTmp);
|
|||
|
BegDate.Date := EndDate.Date - 1;
|
|||
|
cxGrid1.Align := alclient;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBCKlistSel.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
writeCxGrid(self.Caption + 'TV1', Tv1, '<27><><EFBFBD>ϲֿ<CFB2>');
|
|||
|
close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBCKlistSel.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
initGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBCKlistSel.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 TfrmPBCKlistSel.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBCKlistSel.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBCKlistSel.ToolButton1Click(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 TfrmPBCKlistSel.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if cxTabControl1.TabIndex <> 0 then
|
|||
|
exit;
|
|||
|
ModalResult := 1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPBCKlistSel.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|