677 lines
20 KiB
ObjectPascal
677 lines
20 KiB
ObjectPascal
unit U_BpCklist;
|
||
|
||
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,
|
||
cxCheckBox, cxPC, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
||
dxBarBuiltInMenu, dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint,
|
||
dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide,
|
||
dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
|
||
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin,
|
||
dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
|
||
dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
|
||
dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine,
|
||
dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue, dxSkinscxPCPainter;
|
||
|
||
type
|
||
TfrmBpCklist = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBAdd: TToolButton;
|
||
TBEdit: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBExport: TToolButton;
|
||
TBPrint: 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;
|
||
v1RollNum: TcxGridDBColumn;
|
||
v1Qty: TcxGridDBColumn;
|
||
v1Note: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
v1CRType: TcxGridDBColumn;
|
||
v1CRTime: TcxGridDBColumn;
|
||
v1CRNO: TcxGridDBColumn;
|
||
v1CRID: TcxGridDBColumn;
|
||
v1Filler: TcxGridDBColumn;
|
||
v1FillTime: TcxGridDBColumn;
|
||
Label2: TLabel;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
P_CodeName: TEdit;
|
||
P_Color: TEdit;
|
||
CRType: TComboBox;
|
||
Label5: TLabel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryTmp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
CDS_Main: TClientDataSet;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
v1MJID: TcxGridDBColumn;
|
||
v1MJXH: TcxGridDBColumn;
|
||
v1CPTYPE: TcxGridDBColumn;
|
||
ckName: TComboBox;
|
||
Label6: TLabel;
|
||
v1P_Color: TcxGridDBColumn;
|
||
ADOPrint: TADOQuery;
|
||
RMDB_MD: TRMDBDataSet;
|
||
RMGridReport1: TRMGridReport;
|
||
RMXLSExport1: TRMXLSExport;
|
||
v1P_Code1: TcxGridDBColumn;
|
||
v1inoutNO: TcxGridDBColumn;
|
||
TBsmADD: TToolButton;
|
||
inoutNo: TEdit;
|
||
Label7: TLabel;
|
||
v1custName: TcxGridDBColumn;
|
||
v1TocustName: TcxGridDBColumn;
|
||
TbPrint1: TToolButton;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
ADOPrint1: TADOQuery;
|
||
RMDB_Main: TRMDBDataSet;
|
||
v1Column11: TcxGridDBColumn;
|
||
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;
|
||
custName: TEdit;
|
||
v1validName: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
cxTabControl1: TcxTabControl;
|
||
TBcdel: TToolButton;
|
||
v1Column14: TcxGridDBColumn;
|
||
v1Column15: TcxGridDBColumn;
|
||
orderNo: TEdit;
|
||
Label9: TLabel;
|
||
P_Code: TEdit;
|
||
defstr1: TEdit;
|
||
Label10: TLabel;
|
||
Label11: TLabel;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
DataSource2: TDataSource;
|
||
CDS_Sub: TClientDataSet;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
TV2Column1: TcxGridDBColumn;
|
||
TV2Column14: TcxGridDBColumn;
|
||
TV2Column2: TcxGridDBColumn;
|
||
TV2Column3: TcxGridDBColumn;
|
||
TV2Column4: TcxGridDBColumn;
|
||
TV2Column5: TcxGridDBColumn;
|
||
TV2Column6: TcxGridDBColumn;
|
||
TV2Column7: TcxGridDBColumn;
|
||
TV2Column8: TcxGridDBColumn;
|
||
TV2Column9: TcxGridDBColumn;
|
||
TV2Column10: TcxGridDBColumn;
|
||
TV2Column11: TcxGridDBColumn;
|
||
TV2Column12: TcxGridDBColumn;
|
||
TV2Column13: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
ADOQuerySub: TADOQuery;
|
||
TV2Column15: TcxGridDBColumn;
|
||
TV2Column16: TcxGridDBColumn;
|
||
TV2Column17: TcxGridDBColumn;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure P_CodeNameChange(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 TBPrintClick(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBsmADDClick(Sender: TObject);
|
||
procedure TbPrint1Click(Sender: TObject);
|
||
procedure v1Column6CompareRowValuesForCellMerging(Sender: TcxGridColumn; ARow1: TcxGridDataRow; AProperties1: TcxCustomEditProperties; const AValue1: Variant; ARow2: TcxGridDataRow; AProperties2: TcxCustomEditProperties; const AValue2: Variant; var AAreEqual: Boolean);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure TBcdelClick(Sender: TObject);
|
||
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
private
|
||
procedure InitGrid();
|
||
procedure InitSub();
|
||
procedure SetComboBox();
|
||
procedure SetStatus();
|
||
{ Private declarations }
|
||
public
|
||
fCKName: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmBpCklist: TfrmBpCklist;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun10, U_ZDYHelp, U_BpCk, U_BpSmCk;
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmBpCklist.SetStatus();
|
||
begin
|
||
TBedit.Visible := false;
|
||
Tbdel.Visible := false;
|
||
tbcdel.Visible := false;
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
TBedit.Visible := true;
|
||
Tbdel.Visible := true;
|
||
end;
|
||
1:
|
||
begin
|
||
tbcdel.Visible := true;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBpCklist.SetComboBox();
|
||
begin
|
||
ckName.Items.Clear;
|
||
with adoQueryTmp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_ZDY where Type=''CPCK'' ');
|
||
if trim(fCKName) <> '' then
|
||
sql.Add('and zdyName=' + quotedstr(trim(fCKName)));
|
||
open;
|
||
while not eof do
|
||
begin
|
||
ckName.Items.Add(trim(fieldbyname('zdyName').AsString));
|
||
next;
|
||
end;
|
||
end;
|
||
if ckName.Items.Count > 0 then
|
||
ckName.ItemIndex := 0;
|
||
|
||
CRType.Items.Clear;
|
||
CRType.Items.Add('');
|
||
with adoQueryTmp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_ZDY where Type=''CPCKTYPE''');
|
||
if trim(fCKName) <> '' then
|
||
sql.Add('and note=' + quotedstr(trim(fCKName)));
|
||
open;
|
||
while not eof do
|
||
begin
|
||
CRType.Items.Add(trim(fieldbyname('zdyName').AsString));
|
||
next;
|
||
end;
|
||
end;
|
||
if CRType.Items.Count > 0 then
|
||
CRType.ItemIndex := 0;
|
||
end;
|
||
|
||
procedure TfrmBpCklist.InitGrid();
|
||
begin
|
||
try
|
||
with adoqueryTmp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Get_CP_CK ''' + formatdateTime('yyyy-MM-dd', begdate.Date) + ''',''' + formatdateTime('yyyy-MM-dd', enddate.Date + 1) + ''',''' + inttostr(cxTabControl1.TabIndex) + ''' ');
|
||
// sql.Add('select A.*, ');
|
||
// sql.Add('SMoney=PackFee+YbFee+OtherFee+(select SUM(money) from CP_InOut X where X.CRNO=A.CRNO), ');
|
||
// sql.Add('orderNo=(select Top 1 orderNo from JYOrder_Main X where X.MainID=A.MainID ),');
|
||
// sql.Add('validName=case when valid=''N'' then ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' else ''δ<><CEB4><EFBFBD><EFBFBD>'' end ');
|
||
// sql.Add('from CP_InOut 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 CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
// if trim(FckName) <> '' then
|
||
// sql.Add('and ckName=' + quotedstr(trim(FckName)));
|
||
// if cxTabControl1.TabIndex = 0 then
|
||
// sql.Add('and valid=''Y'' ');
|
||
// if cxTabControl1.TabIndex = 1 then
|
||
// sql.Add('and valid=''N'' ');
|
||
open;
|
||
end;
|
||
SCreateCDS20(adoqueryTmp, CDS_Main);
|
||
SInitCDSData20(adoqueryTmp, CDS_Main);
|
||
finally
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBpCklist.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
writeCxGrid(self.Caption + '1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
Action := cafree;
|
||
end;
|
||
|
||
procedure TfrmBpCklist.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmBpCklist := nil;
|
||
end;
|
||
|
||
procedure TfrmBpCklist.TBAddClick(Sender: TObject);
|
||
begin
|
||
frmbpck := Tfrmbpck.create(self);
|
||
with frmbpck do
|
||
begin
|
||
fkeyNo := '';
|
||
fType := 0;
|
||
fckName := self.fckName;
|
||
if showmodal = 1 then
|
||
begin
|
||
TBRafresh.Click;
|
||
self.CDS_Main.Locate('crNo', trim(fkeyNo), []);
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBpCklist.P_CodeNameChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryTmp.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryTmp, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryTmp, CDS_Main);
|
||
SInitCDSData20(ADOQueryTmp, CDS_Main);
|
||
end;
|
||
|
||
procedure TfrmBpCklist.FormShow(Sender: TObject);
|
||
begin
|
||
readCxGrid(self.Caption + '1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
SetComboBox();
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmBpCklist.FormCreate(Sender: TObject);
|
||
begin
|
||
BegDate.Date := DServerDate - 7;
|
||
EndDate.Date := DServerDate;
|
||
cxGrid1.Align := alclient;
|
||
|
||
end;
|
||
|
||
procedure TfrmBpCklist.TBCloseClick(Sender: TObject);
|
||
begin
|
||
close;
|
||
end;
|
||
|
||
procedure TfrmBpCklist.TBEditClick(Sender: TObject);
|
||
begin
|
||
if cds_main.IsEmpty then
|
||
exit;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR A');
|
||
SQL.Add('where A.mainid=''' + Trim(CDS_Main.fieldbyname('CRNO').AsString) + ''' ');
|
||
sQL.Add('and A.hxNum<>0 ');
|
||
Open;
|
||
end;
|
||
if not ADOQueryCmd.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27>˵<EFBFBD><CBB5>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
|
||
{ with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from BP_InOut A');
|
||
SQL.Add('where A.kcid='''+Trim(CDS_Main.fieldbyname('kcid').AsString)+''' ');
|
||
sQL.Add('and A.CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
||
Open;
|
||
end;
|
||
if not ADOQueryCmd.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
|
||
frmbpck := Tfrmbpck.create(self);
|
||
with frmbpck do
|
||
begin
|
||
fkeyNo := self.cds_main.fieldbyname('CRNO').AsString;
|
||
FCode := self.cds_main.fieldbyname('P_Code').AsString;
|
||
FCodeName := self.cds_main.fieldbyname('P_Codename').AsString;
|
||
FDRCKNO := self.cds_main.fieldbyname('DRCKNO').AsString;
|
||
FDRCKName := self.cds_main.fieldbyname('DRCKName').AsString;
|
||
fType := 1;
|
||
fckName := self.fckName;
|
||
if showmodal = 1 then
|
||
begin
|
||
|
||
end;
|
||
free;
|
||
end;
|
||
TBRafresh.Click;
|
||
|
||
end;
|
||
|
||
procedure TfrmBpCklist.TBDelClick(Sender: TObject);
|
||
var
|
||
YFID, CRID: string;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
{ if Trim(CDS_Main.fieldbyname('Filler').AsString)<>Trim(DName) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR A');
|
||
SQL.Add('where A.mainid=''' + Trim(CDS_Main.fieldbyname('CRNO').AsString) + ''' ');
|
||
sQL.Add('and A.hxNum<>0 ');
|
||
Open;
|
||
end;
|
||
if not ADOQueryCmd.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27>˵<EFBFBD><CBB5>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><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
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update CP_InOut SET valid=''N'' ');
|
||
SQL.Add('where CRNO=''' + Trim(CDS_Main.fieldbyname('CRNO').AsString) + ''' ');
|
||
sql.Add('delete from YF_Money_CR ');
|
||
SQL.Add('where mainID=''' + Trim(CDS_Main.fieldbyname('CRNO').AsString) + ''' ');
|
||
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)');
|
||
execsql;
|
||
end;
|
||
TBRafresh.Click;
|
||
except
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBpCklist.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
initGrid();
|
||
end;
|
||
|
||
procedure TfrmBpCklist.TBPrintClick(Sender: TObject);
|
||
var
|
||
filepath: string;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
|
||
with AdoPrint do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select A.* from CP_InOut A');
|
||
sql.Add('where inoutNO=' + quotedstr(trim(CDS_Main.fieldbyname('inoutNO').AsString)));
|
||
open;
|
||
end;
|
||
|
||
with AdoPrint1 do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Print_cpCkMd ');
|
||
sql.Add('@inoutNo=' + quotedstr(trim(CDS_Main.fieldbyname('inoutNO').AsString)));
|
||
sql.Add(',@flag=' + quotedstr(trim('')));
|
||
open;
|
||
end;
|
||
|
||
try
|
||
filepath := ExtractFilePath(Application.ExeName) + 'report\<5C><><EFBFBD><EFBFBD><EFBFBD>뵥.rmf';
|
||
if not FileExists(Pchar(filepath)) then
|
||
begin
|
||
application.MessageBox(pchar('<27>ļ<EFBFBD>[' + filepath + ']<5D><><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>'), '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_IConError);
|
||
exit;
|
||
end;
|
||
RMVariables['dtxz'] := FormatDateTime('yyyy-mm-dd', date());
|
||
RMVariables['zdr'] := trim(DName);
|
||
RMVariables['Filler'] := trim(CDS_Main.fieldbyname('Filler').AsString);
|
||
RMGridReport1.LoadFromFile(filepath);
|
||
RMGridReport1.ShowReport;
|
||
finally
|
||
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmBpCklist.TBExportClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
TcxGridToExcel(self.Caption, cxgrid1);
|
||
end;
|
||
|
||
procedure TfrmBpCklist.TBsmADDClick(Sender: TObject);
|
||
begin
|
||
frmbpsmck := Tfrmbpsmck.create(self);
|
||
with frmbpsmck do
|
||
begin
|
||
fkeyNo := '';
|
||
fType := 0;
|
||
fckName := self.fckName;
|
||
if showmodal = 1 then
|
||
begin
|
||
TBRafresh.Click;
|
||
// self.CDS_Main.Locate('crNo',trim(fkeyNo),[]) ;
|
||
end;
|
||
TBRafresh.Click;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBpCklist.TbPrint1Click(Sender: TObject);
|
||
var
|
||
filepath: string;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
|
||
with AdoPrint do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from CP_INout A ');
|
||
sql.Add('where A.inoutNo=' + quotedstr(trim(CDS_Main.fieldbyname('inoutNO').AsString)));
|
||
open;
|
||
end;
|
||
|
||
try
|
||
filepath := ExtractFilePath(Application.ExeName) + 'report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.rmf';
|
||
if not FileExists(Pchar(filepath)) then
|
||
begin
|
||
application.MessageBox(pchar('<27>ļ<EFBFBD>[' + filepath + ']<5D><><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>'), '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_IConError);
|
||
exit;
|
||
end;
|
||
RMVariables['dtxz'] := FormatDateTime('yyyy-mm-dd', date());
|
||
RMVariables['zdr'] := trim(DName);
|
||
RMVariables['Filler'] := trim(CDS_Main.fieldbyname('Filler').AsString);
|
||
RMGridReport1.LoadFromFile(filepath);
|
||
RMGridReport1.ShowReport;
|
||
finally
|
||
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmBpCklist.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;
|
||
// colIdx1:= tv1.GetColumnByFieldName('colorname').Index;
|
||
if (ARow1.Values[colIdx0] = ARow2.Values[colIdx0]) then
|
||
AAreEqual := True
|
||
else
|
||
AAreEqual := False;
|
||
|
||
end;
|
||
|
||
procedure TfrmBpCklist.ToolButton1Click(Sender: TObject);
|
||
var
|
||
YFID, CRID: string;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
{ if Trim(CDS_Main.fieldbyname('Filler').AsString)<>Trim(DName) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR A');
|
||
SQL.Add('where A.mainid=''' + Trim(CDS_Main.fieldbyname('CRNO').AsString) + ''' ');
|
||
sQL.Add('and A.hxNum<>0 ');
|
||
Open;
|
||
end;
|
||
if not ADOQueryCmd.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27>˵<EFBFBD><CBB5>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><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
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update CP_InOut SET valid=''N'' ');
|
||
SQL.Add('where CRNO=''' + Trim(CDS_Main.fieldbyname('CRNO').AsString) + ''' ');
|
||
sql.Add('delete from YF_Money_CR ');
|
||
SQL.Add('where mainID=''' + Trim(CDS_Main.fieldbyname('CRNO').AsString) + ''' ');
|
||
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)');
|
||
execsql;
|
||
end;
|
||
TBRafresh.Click;
|
||
except
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBpCklist.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
begin
|
||
// IF AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('validName').Index]='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
// ACanvas.Font.Color:=clred;
|
||
end;
|
||
|
||
procedure TfrmBpCklist.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmBpCklist.TBcdelClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete from CP_InOut where CRNO=''' + Trim(CDS_Main.fieldbyname('CRNO').AsString) + ''' ');
|
||
execsql;
|
||
end;
|
||
TBRafresh.Click;
|
||
except
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBpCklist.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
begin
|
||
initsub();
|
||
end;
|
||
|
||
procedure TfrmBpCklist.InitSub();
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
try
|
||
with ADOQuerySub do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Get_CP_CK_MX ''' + Cds_main.fieldbyname('P_CodeName').AsString + ''' ,''' + Cds_main.fieldbyname('P_Code').AsString + ''',''' + Cds_main.fieldbyname('CRNO').AsString + ''' ');
|
||
sql.Add(' ,''' + cds_main.fieldbyname('DRCKNO').AsString + ''' ,''' + cds_main.fieldbyname('DRCKName').AsString + ''' ');
|
||
// ShowMessage(SQL.text);
|
||
open;
|
||
end;
|
||
SCreateCDS20(ADOQuerySub, CDS_Sub);
|
||
SInitCDSData20(ADOQuerySub, CDS_Sub);
|
||
finally
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|