1308 lines
38 KiB
ObjectPascal
1308 lines
38 KiB
ObjectPascal
unit U_SKCR;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
||
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
|
||
StdCtrls, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
||
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdFTP,ShellAPI,IniFiles, cxCheckBox, cxCalendar,
|
||
cxButtonEdit, cxTextEdit, cxLookAndFeels, cxLookAndFeelPainters,
|
||
cxNavigator, 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
|
||
TfrmSKCR = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
Panel1: TPanel;
|
||
ToolButton2: TToolButton;
|
||
Label1: TLabel;
|
||
YFName: TEdit;
|
||
ADOQueryMain: TADOQuery;
|
||
ToolButton1: TToolButton;
|
||
RM1: TRMGridReport;
|
||
RMDB_Main: TRMDBDataSet;
|
||
Label3: TLabel;
|
||
FactoryName: TEdit;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Label2: TLabel;
|
||
Label6: TLabel;
|
||
begdate: TDateTimePicker;
|
||
Enddate: TDateTimePicker;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
DS_HZ: TDataSource;
|
||
CDS_HZ: TClientDataSet;
|
||
ToolButton3: TToolButton;
|
||
VHL: TcxGridDBColumn;
|
||
VBZ: TcxGridDBColumn;
|
||
VYB: TcxGridDBColumn;
|
||
VBB: TcxGridDBColumn;
|
||
v2Column6: TcxGridDBColumn;
|
||
VOrderNo: TcxGridDBColumn;
|
||
Label4: TLabel;
|
||
OrderNo: TEdit;
|
||
v2Column1: TcxGridDBColumn;
|
||
v2DerateMoney: TcxGridDBColumn;
|
||
v2Column2: TcxGridDBColumn;
|
||
v2SYRName: TcxGridDBColumn;
|
||
Tsave: TToolButton;
|
||
Panel2: TPanel;
|
||
Label5: TLabel;
|
||
Edit1: TEdit;
|
||
Label7: TLabel;
|
||
JZdate: TDateTimePicker;
|
||
Label8: TLabel;
|
||
Edit2: TEdit;
|
||
Edit3: TEdit;
|
||
Label9: TLabel;
|
||
Edit4: TEdit;
|
||
Label10: TLabel;
|
||
Label11: TLabel;
|
||
v2Column3: TcxGridDBColumn;
|
||
v2Column4: TcxGridDBColumn;
|
||
ToolButton4: TToolButton;
|
||
CheckBox1: TCheckBox;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure FactoryNameChange(Sender: TObject);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure cxGridDBColumn8PropertiesEditValueChanged(Sender: TObject);
|
||
procedure cxGridDBColumn5PropertiesEditValueChanged(Sender: TObject);
|
||
procedure cxGridDBColumn1PropertiesEditValueChanged(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure cxGridDBColumn3PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure cxGridDBColumn6PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure v2Column3PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure v2Column4PropertiesEditValueChanged(Sender: TObject);
|
||
procedure v2Column1PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure VBBPropertiesEditValueChanged(Sender: TObject);
|
||
procedure OrderNoChange(Sender: TObject);
|
||
procedure v2Column1PropertiesEditValueChanged(Sender: TObject);
|
||
procedure v2DerateMoneyPropertiesEditValueChanged(Sender: TObject);
|
||
procedure v2SYRNamePropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure TsaveClick(Sender: TObject);
|
||
procedure Panel2DblClick(Sender: TObject);
|
||
procedure JZdateChange(Sender: TObject);
|
||
procedure v2Column4PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure CheckBox1Click(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
fopevent:string;
|
||
procedure InitGrid();
|
||
function SaveData():Boolean;
|
||
procedure SetStatus();
|
||
Procedure JsYe();
|
||
procedure geteditRzhi();
|
||
function SaveZL():Boolean;
|
||
public
|
||
fDParameters1,fDParameters3:string;
|
||
fSYRName:string;
|
||
fstr2:string;
|
||
{ Public declarations }
|
||
RKFlag,FCYID:String;
|
||
|
||
end;
|
||
|
||
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_Fun,U_ZDYHelp, U_ProductOrderList, U_ProductOrderNewList,
|
||
U_ZdyAttachment, U_SysLogHelp;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmSKCR.geteditRzhi();
|
||
begin
|
||
fopevent:='';
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from YF_Money_LL where fromMainID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+''' ');
|
||
// showmessage(SQL.text);
|
||
open;
|
||
end;
|
||
IF not ADOQueryTemp.IsEmpty then
|
||
begin
|
||
|
||
IF formatdateTime('yyyy-MM-dd',CDS_HZ.fieldbyname('CRTime').AsDateTime)<> formatdateTime('yyyy-MM-dd',ADOQueryTemp.fieldbyName('CRTime').AsDateTime) then
|
||
fopevent:=fopevent+' <20><><EFBFBD><EFBFBD>:'+formatdateTime('yyyy-MM-dd',ADOQueryTemp.fieldbyName('CRTime').AsDateTime )+'->'+formatdateTime('yyyy-MM-dd',CDS_HZ.fieldbyname('CRTime').AsDateTime);
|
||
|
||
IF CDS_HZ.fieldbyname('BBMoney').AsFloat<> ADOQueryTemp.fieldbyName('inMoney').AsFloat then
|
||
fopevent:=fopevent+' <20><><EFBFBD><EFBFBD>:'+ADOQueryTemp.fieldbyName('inMoney').AsString+'->'+CDS_HZ.fieldbyname('BBMoney').AsString;
|
||
|
||
IF trim(CDS_HZ.fieldbyname('bankNo').AsString)<> trim(ADOQueryTemp.fieldbyName('factoryName').AsString) then
|
||
fopevent:=fopevent+' <20>˻<EFBFBD>:'+trim(ADOQueryTemp.fieldbyName('factoryName').AsString)+'->'+trim(CDS_HZ.fieldbyname('bankNo').AsString);
|
||
|
||
IF fopevent<>'' then
|
||
fopevent:='<27>Է<EFBFBD><D4B7><EFBFBD>λ:'+Trim(CDS_HZ.fieldbyname('factoryName').AsString)+fopevent;
|
||
end;
|
||
end;
|
||
|
||
function TfrmSKCR.SaveZL():Boolean;
|
||
var
|
||
LLNO:string;
|
||
begin
|
||
result:=false;
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR where YFID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+''' ');
|
||
open;
|
||
end;
|
||
IF ADOQueryTemp.IsEmpty then
|
||
begin
|
||
ADOQueryCMD.Connection.RollbackTrans;
|
||
exit;
|
||
end;
|
||
if GetLSNo(ADOQueryCMD,LLNO,'YL','YF_Money_LL',3,1)=False then
|
||
begin
|
||
ADOQueryCMD.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ');
|
||
Exit;
|
||
end;
|
||
|
||
try
|
||
with ADOqueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('delete from YF_Money_LL where fromMainID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+''' ');
|
||
execsql;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from YF_Money_LL where fromMainID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+''' ');
|
||
Open;
|
||
append;
|
||
fieldbyname('filler').Value:=trim(Dname);
|
||
FieldByName('LLNO').Value:=Trim(LLNO);
|
||
fieldbyname('CRTime').Value:=formatdateTime('yyyy-MM-dd',CDS_HZ.fieldbyname('CRTime').AsDateTime);
|
||
fieldbyname('CRType').Value:=Trim(CDS_HZ.fieldbyname('YFName').AsString);
|
||
fieldbyname('factoryName').Value:=Trim(CDS_HZ.fieldbyname('bankNo').AsString);
|
||
fieldbyname('TOfactoryName').Value:=Trim(CDS_HZ.fieldbyname('factoryName').AsString);
|
||
fieldbyname('NOTE').Value:=Trim(CDS_HZ.fieldbyname('note').AsString);
|
||
fieldbyname('inMoney').Value:=CDS_HZ.fieldbyname('BBMoney').AsFloat;
|
||
fieldbyname('OutMoney').Value:=0;
|
||
fieldbyname('status').Value:='0';
|
||
FieldByName('fromMainID').Value:=Trim(CDS_HZ.fieldbyname('YFID').AsString);
|
||
FieldByName('syrName').Value:=Trim(fsyrName);
|
||
Post;
|
||
end;
|
||
|
||
IF trim(fopevent)<>'' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
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('<27>տ<EFBFBD><D5BF>Ǽ<EFBFBD>')));
|
||
sql.Add(','+quotedstr(trim('<27>տ<EFBFBD><D5BF>Ǽ<EFBFBD><C7BC><EFBFBD>')));
|
||
sql.Add(','+quotedstr(trim(fopevent)));
|
||
sql.Add(','+quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
end;
|
||
result:=true;
|
||
except
|
||
end;
|
||
end;
|
||
|
||
Procedure TfrmSKCR.JsYe();
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select ysk=sum(case when CRType=''Ӧ<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>'' then 1*(money - T_money) else 0 end), ');
|
||
sql.Add(' sk=sum(case when CRType=''<27>տ<EFBFBD><D5BF>Ǽ<EFBFBD>'' then 1*(BBmoney + DerateMoney) else 0 end) ');
|
||
sql.Add('from YF_Money_CR ');
|
||
sql.Add(' where CRTime<'''+formatdateTime('yyyy-MM-dd',JZdate.DateTime+1)+''' ' );
|
||
sql.Add(' and FactoryName='+quotedstr(trim(edit1.Text)));
|
||
sql.Add(' and syrName='+quotedstr(trim(fsyrName)));
|
||
sql.Add(' and CRFlag =''Ӧ<><D3A6><EFBFBD><EFBFBD>'' ');
|
||
open;
|
||
edit2.Text:=fieldbyname('ysk').AsString;
|
||
edit3.Text:=fieldbyname('sk').AsString;
|
||
edit4.Text:=format('%.2f',[fieldbyname('ysk').AsFloat - fieldbyname('sk').AsFloat]);
|
||
Panel2.Visible:=true;
|
||
end;
|
||
|
||
end;
|
||
procedure TfrmSKCR.SetStatus();
|
||
begin
|
||
TBDel.Visible:=true;
|
||
IF trim(fDParameters1)='<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
TBDel.Visible:=true;
|
||
end
|
||
else
|
||
IF trim(fDParameters1)='<27><>ѯ' then
|
||
begin
|
||
tv2.OptionsData.Editing:=false;
|
||
TBDel.Visible:=false;
|
||
ToolButton3.Visible:=false;
|
||
end
|
||
else
|
||
begin
|
||
|
||
end;
|
||
// IF trim(fSYRName)<>'<27><><EFBFBD>˷<EFBFBD>֯' then Tsave.Visible:=false;
|
||
end;
|
||
|
||
|
||
|
||
|
||
procedure TfrmSKCR.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select A.*,C.OrderNo ');
|
||
sql.Add(' from YF_Money_CR A');
|
||
sql.Add(' left join YF_Money_KC B on A.CRID=B.CRID');
|
||
SQL.Add(' left join JYOrder_Main C on A.MainId=C.MainId');
|
||
sql.Add('where A.CRTime>='''+FormatDateTime('yyyy-MM-dd',begdate.DateTime)+''' ');
|
||
sql.Add(' and CRTime<'''+FormatDateTime('yyyy-MM-dd',Enddate.DateTime+1)+''' ');
|
||
sql.Add(' and A.CRType=''<27>տ<EFBFBD><D5BF>Ǽ<EFBFBD>'' ');
|
||
IF trim(fSYRName)<>'' then
|
||
sql.Add(' and A.SYRName='+quotedstr(trim(fSyrName)));
|
||
IF trim(FactoryName.Text)<>'' then
|
||
sql.Add(' and A.FactoryName like '+quotedstr('%'+trim(FactoryName.Text)+'%'));
|
||
sql.Add(' and isnull(A.fstr2,'''')='+quotedstr(trim(fstr2)));
|
||
// ShowMessage(SQL.text);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
ToolButton2.Click;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSKCR.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmSKCR.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27>տ<EFBFBD><D5BF>Ǽ<EFBFBD>',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
{with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete CK_YP_CR where isnull(CRTime,'''')='''' and CYID='''+Trim(FCYID)+''' and CRType='''+Trim(RKFlag)+'''');
|
||
ExecSQL;
|
||
end;}
|
||
Close;
|
||
end;
|
||
procedure TfrmSKCR.TBDelClick(Sender: TObject);
|
||
var
|
||
FBBMoney,CRID:string;
|
||
begin
|
||
if CDS_HZ.IsEmpty then Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
if Trim(CDS_HZ.fieldbyname('YFID').AsString)<>'' then
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete YF_Money_CR where YFID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+'''');
|
||
sql.Add('delete YF_Money_LL where fromMainID='''+Trim(CDS_HZ.fieldbyname('YFID').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>ɾ<EFBFBD><C9BE>')));
|
||
sql.Add(','+quotedstr(trim('<27>ͻ<EFBFBD>:'+trim(CDS_HZ.FieldByName('factoryName').AsString)+' <20><><EFBFBD><EFBFBD>:'+trim(CDS_HZ.FieldByName('BBmoney').AsString))));
|
||
sql.Add(','+quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
ExecSQL;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
CDS_HZ.Delete;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox('ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmSKCR.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid('<27>տ<EFBFBD><D5BF>Ǽ<EFBFBD>',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
Enddate.DateTime:=SGetServerDate(ADOQueryTemp);
|
||
begdate.DateTime:=Enddate.DateTime;
|
||
if Trim(DParameters1)='<27><EFBFBD><DEB6><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
VOrderNo.Hidden:=True;
|
||
VOrderNo.Visible:=False;
|
||
label4.Visible:=False;
|
||
OrderNo.Visible:=False;
|
||
end;
|
||
if Trim(DParameters2)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
VHL.Hidden:=True;
|
||
VHL.Visible:=False;
|
||
VBZ.Hidden:=True;
|
||
VBZ.Visible:=False;
|
||
VYB.Hidden:=True;
|
||
VYB.Visible:=False;
|
||
VBB.Caption:='ʵ<>ս<EFBFBD><D5BD><EFBFBD>';
|
||
end;
|
||
IF trim(fDParameters3)<>'' then
|
||
begin
|
||
factoryName.Text:=trim(fDParameters3);
|
||
factoryName.Enabled:=false;
|
||
end;
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmSKCR.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmSKCR.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSKCR.FactoryNameChange(Sender: TObject);
|
||
begin
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmSKCR.Button2Click(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
if Trim(CDS_HZ.fieldbyname('SubID').AsString)<>'' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete YCL_SG_HZ where SubID='''+Trim(CDS_HZ.fieldbyname('SubID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
CDS_HZ.Delete;
|
||
end;
|
||
|
||
function TfrmSKCR.SaveData():Boolean;
|
||
var
|
||
maxId,CRID:String;
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
if GetLSNo(ADOQueryCmd,maxId,'FK','YF_Money_CR',4,1)=False then
|
||
begin
|
||
Result:=False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from YF_Money_KC where FactoryName='''+Trim(CDS_HZ.fieldbyname('FactoryName').AsString)+''' and YFDefFlag1=0 ');
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.IsEmpty=False then
|
||
begin
|
||
CRID:=ADOQueryCmd.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('FactoryNo').Value:=Trim(CDS_HZ.fieldbyname('FactoryNo').AsString);
|
||
FieldByName('FactoryName').Value:=Trim(CDS_HZ.fieldbyname('FactoryName').AsString);
|
||
FieldByName('ZdyStr1').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
||
Post;
|
||
end;
|
||
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(maxId);
|
||
FieldByName('CRID').Value:=StrToInt(CRID);
|
||
//SSetSaveDataCDSNew(ADOQueryCmd,Tv2,CDS_HZ,'YF_Money_CR',3);
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
FieldByName('CRType').Value:='<27>տ<EFBFBD><D5BF>Ǽ<EFBFBD>';
|
||
FieldByName('CRFlag').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
||
FieldByName('QtyFlag').Value:=-1;
|
||
FieldByName('FactoryNo').Value:=Trim(CDS_HZ.fieldbyname('FactoryNo').AsString);
|
||
FieldByName('FactoryName').Value:=Trim(CDS_HZ.fieldbyname('FactoryName').AsString);
|
||
FieldByName('CRTime').Value:=SGetServerDate(ADOQueryTemp);
|
||
FieldByName('SyRName').Value:=trim(fSyrName);
|
||
FieldByName('fstr2').Value:=trim(fstr2);
|
||
Post;
|
||
end;
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('YFId').Value:=Trim(maxId);
|
||
FieldByName('CRID').Value:=StrToInt(CRID);
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result:=True;
|
||
except
|
||
Result:=True;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSKCR.cxGridDBColumn8PropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
mvalue,FFieldName:String;
|
||
begin
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value:=Trim(mvalue);
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YCL_SG_HZ ');
|
||
if Trim(mvalue)<>'' then
|
||
begin
|
||
sql.Add(' Set '+FFieldName+'='''+Trim(mvalue)+'''');
|
||
end else
|
||
begin
|
||
sql.Add(' Set '+FFieldName+'=NULL');
|
||
end;
|
||
SQL.Add(',Editer='''+Trim(DName)+'''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where SubId='''+Trim(CDS_HZ.fieldbyname('SubId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSKCR.cxGridDBColumn5PropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
mvalue,FQty,FPrice,FMoney,FHuiLv,FBBMoney,FKCBB,FFieldName:String;
|
||
begin
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue)='' then
|
||
begin
|
||
mvalue:='0';
|
||
end;
|
||
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value:=Trim(mvalue);
|
||
Post;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select isnull(BBMoney,0) BBMoney from YF_Money_CR where YFID='''+cds_hz.fieldbyname('YFID').AsString+'''');
|
||
Open;
|
||
end;
|
||
FKCBB:=ADOQueryTemp.fieldbyname('BBMoney').AsString;
|
||
|
||
FQty:=Trim(CDS_HZ.fieldbyname('Qty').AsString);
|
||
if Trim(FQty)='' then FQty:='0';
|
||
|
||
FPrice:=Trim(CDS_HZ.fieldbyname('Price').AsString);
|
||
if Trim(FPrice)='' then FPrice:='0';
|
||
FQty:=Trim(CDS_HZ.fieldbyname('Qty').AsString);
|
||
if Trim(FQty)='' then FQty:='0';
|
||
|
||
FMoney:=Trim(CDS_HZ.fieldbyname('Money').AsString);
|
||
if Trim(FMoney)='' then FMoney:='0';
|
||
|
||
FHuiLv:=Trim(CDS_HZ.fieldbyname('HuiLv').AsString);
|
||
if Trim(FHuiLv)='' then FHuiLv:='0';
|
||
|
||
{FBBMoney:=Trim(CDS_HZ.fieldbyname('BBMoney').AsString);
|
||
if Trim(FBBMoney)='' then FBBMoney:='0'; }
|
||
|
||
if Trim(FFieldName)<>'Money' then
|
||
begin
|
||
if Trim(FFieldName)<>'HuiLv' then
|
||
begin
|
||
FBBMoney:=FloatToStr(StrToFloat(FQty)*StrToFloat(FPrice)*StrToFloat(FHuiLv));
|
||
FMoney:=FloatToStr(StrToFloat(FQty)*StrToFloat(FPrice));
|
||
end else
|
||
begin
|
||
FBBMoney:=FloatToStr(StrToFloat(FMoney)*StrToFloat(FHuiLv));
|
||
end;
|
||
|
||
end else
|
||
begin
|
||
FBBMoney:=FloatToStr(StrToFloat(FMoney)*StrToFloat(FHuiLv));
|
||
end;
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('Money').Value:=StrToFloat(FMoney);
|
||
FieldByName('BBMoney').Value:=StrToFloat(FBBMoney);
|
||
Post;
|
||
end;
|
||
{ with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_CR ');
|
||
sql.Add(' Set '+FFieldName+'='+Trim(mvalue));
|
||
if Trim(FFieldName)<>'Money' then
|
||
begin
|
||
sql.Add(',Money='+FMoney);
|
||
end;
|
||
|
||
sql.Add(',BBMoney='+FBBMoney);
|
||
SQL.Add(',Editer='''+Trim(DName)+'''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
||
|
||
SQL.Add('Update YF_Money_KC Set KCBBMoney=KCBBMoney-'+FKCBB+'+'+FBBMoney);
|
||
sql.Add(' where CRID='''+Trim(CDS_HZ.fieldbyname('CRID').AsString)+'''');
|
||
ExecSQL;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmSKCR.cxGridDBColumn1PropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
mvalue,FFieldName:String;
|
||
begin
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value:=Trim(mvalue);
|
||
Post;
|
||
end;
|
||
{ with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_CR ');
|
||
if Trim(mvalue)<>'' then
|
||
begin
|
||
sql.Add(' Set '+FFieldName+'='''+Trim(mvalue)+'''');
|
||
end else
|
||
begin
|
||
sql.Add(' Set '+FFieldName+'=NULL');
|
||
end;
|
||
SQL.Add(',Editer='''+Trim(DName)+'''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
try
|
||
geteditRzhi();
|
||
with ADOqueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('delete from YF_Money_LL where fromMainID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+''' ');
|
||
execsql;
|
||
end;
|
||
IF (CDS_HZ.FieldByName('BBMoney').AsFloat<>0) and
|
||
(trim(CDS_HZ.fieldbyname('bankNo').AsString)<>'') then
|
||
begin
|
||
IF not saveZL() then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD>ˮ<EFBFBD><CBAE>Ϣʧ<CFA2><CAA7>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
end;
|
||
end;
|
||
except
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmSKCR.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZdyAttachment:=TfrmZdyAttachment.Create(Application);
|
||
with frmZdyAttachment do
|
||
begin
|
||
fkhType:=trim(fsyrName);
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.CDS_HZ do
|
||
begin
|
||
Append;
|
||
FieldByName('FactoryNo').Value:=Trim(CDS_HZ.fieldbyname('ZdyCode').AsString);
|
||
FieldByName('FactoryName').Value:=Trim(CDS_HZ.fieldbyname('ZdyName').AsString);
|
||
FieldByName('SYRName').Value:=Trim(fSYRName);
|
||
FieldByName('CRTime').Value:=SGetServerDate(ADOQueryTemp);
|
||
if Trim(DParameters2)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
FieldByName('HuiLv').Value:=1;
|
||
end;
|
||
Post;
|
||
end;
|
||
Self.SaveData();
|
||
IF fsyrName='<27><><EFBFBD>˷<EFBFBD>֯' then
|
||
begin
|
||
edit1.Text:=Self.CDS_HZ.fieldbyname('FactoryName').AsString;
|
||
JZdate.DateTime:=Self.CDS_HZ.fieldbyname('CRTime').AsDateTime;
|
||
jsYe();
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZdyAttachment.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSKCR.cxGridDBColumn3PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='YFName';
|
||
flagname:='<27><>Ŀ<EFBFBD><C4BF>ժҪ';
|
||
if Trim(DParameters3)='<27><>Ŀ<EFBFBD>ֿ<EFBFBD>' then
|
||
MainType:='<27>տ<EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('YFCode').Value:=Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString);
|
||
FieldByName('YFName').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
{ with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_CR ');
|
||
sql.Add(' Set YFCode='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
|
||
sql.Add(' ,YFName='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
||
SQL.Add(',Editer='''+Trim(DName)+'''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
||
ExecSQL;
|
||
end; }
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSKCR.cxGridDBColumn6PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='OrderUnit';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.CDS_HZ.Edit;
|
||
Self.CDS_HZ.FieldByName('QtyUnit').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_CR ');
|
||
sql.Add(' Set QtyUnit='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
||
SQL.Add(',Editer='''+Trim(DName)+'''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSKCR.v2Column3PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='BZType';
|
||
flagname:='<27><><EFBFBD><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.CDS_HZ.Edit;
|
||
Self.CDS_HZ.FieldByName('BZType').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
{ with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_CR ');
|
||
sql.Add(' Set BZType='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
||
SQL.Add(',Editer='''+Trim(DName)+'''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
||
ExecSQL;
|
||
end;}
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSKCR.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then Exit;
|
||
SelExportData(Tv2,ADOQueryMain,'<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmSKCR.v2Column4PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue,FMoney,FHuiLv,FBBMoney,FKCBB,FFieldName:String;
|
||
begin
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue)='' then
|
||
begin
|
||
mvalue:='0';
|
||
end;
|
||
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value:=Trim(mvalue);
|
||
Post;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select isnull(BBMoney,0) BBMoney from YF_Money_CR where YFID='''+cds_hz.fieldbyname('YFID').AsString+'''');
|
||
Open;
|
||
end;
|
||
FKCBB:=ADOQueryTemp.fieldbyname('BBMoney').AsString;
|
||
|
||
FMoney:=Trim(CDS_HZ.fieldbyname('Money').AsString);
|
||
if Trim(FMoney)='' then FMoney:='0';
|
||
|
||
FHuiLv:=Trim(CDS_HZ.fieldbyname('HuiLv').AsString);
|
||
if Trim(FHuiLv)='' then FHuiLv:='0';
|
||
|
||
{FBBMoney:=Trim(CDS_HZ.fieldbyname('BBMoney').AsString);
|
||
if Trim(FBBMoney)='' then FBBMoney:='0'; }
|
||
|
||
FBBMoney:=FloatToStr(StrToFloat(FMoney)*StrToFloat(FHuiLv));
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('Money').Value:=StrToFloat(FMoney);
|
||
FieldByName('BBMoney').Value:=StrToFloat(FBBMoney);
|
||
Post;
|
||
end;
|
||
{ IF trim(fSYRName)<>'<27><><EFBFBD>˷<EFBFBD>֯' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_CR ');
|
||
sql.Add(' Set '+FFieldName+'='+Trim(mvalue));
|
||
sql.Add(',BBMoney='+FBBMoney);
|
||
SQL.Add(',Editer='''+Trim(DName)+'''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
||
|
||
SQL.Add('Update YF_Money_KC Set KCBBMoney=KCBBMoney+'+FKCBB+'-'+FBBMoney);
|
||
sql.Add(' where CRID='''+Trim(CDS_HZ.fieldbyname('CRID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
try
|
||
geteditRzhi();
|
||
with ADOqueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('delete from YF_Money_LL where fromMainID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+''' ');
|
||
execsql;
|
||
end;
|
||
IF (CDS_HZ.FieldByName('BBMoney').AsFloat<>0) and
|
||
(trim(CDS_HZ.fieldbyname('bankNo').AsString)<>'') then
|
||
begin
|
||
IF not saveZL() then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD>ˮ<EFBFBD><CBAE>Ϣʧ<CFA2><CAA7>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
end;
|
||
end;
|
||
except
|
||
end;}
|
||
end;
|
||
|
||
procedure TfrmSKCR.v2Column1PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmProductOrderNewList:=TfrmProductOrderNewList.Create(Application);
|
||
with frmProductOrderNewList do
|
||
begin
|
||
DParameters1:='<27><>Ȩ<EFBFBD><C8A8>';
|
||
fsyrName:=self.fsyrName;
|
||
//frmProductOrderList.v1Column4.Visible:=True;
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('MainId').Value:=Trim(frmProductOrderNewList.Order_Main.fieldbyname('MainId').AsString);
|
||
FieldByName('OrderNo').Value:=Trim(frmProductOrderNewList.Order_Main.fieldbyname('OrderNo').AsString);
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_CR ');
|
||
sql.Add(' Set MainId='''+Trim(frmProductOrderNewList.Order_Main.fieldbyname('MainId').AsString)+'''');
|
||
//sql.Add(' ,SubId='''+Trim(frmProductOrderList.Order_Main.fieldbyname('SubId').AsString)+'''');
|
||
SQL.Add(',Editer='''+Trim(DName)+'''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmProductOrderNewList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSKCR.VBBPropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue,FKCBB:string;
|
||
begin
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select isnull(BBMoney,0) BBMoney from YF_Money_CR where YFID='''+cds_hz.fieldbyname('YFID').AsString+'''');
|
||
Open;
|
||
end;
|
||
FKCBB:=ADOQueryTemp.fieldbyname('BBMoney').AsString;
|
||
if Trim(mvalue)='' then mvalue:='0';
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('BBMoney').Value:=StrToFloat(mvalue);
|
||
Post;
|
||
end;
|
||
{ IF trim(fSYRName)<>'<27><><EFBFBD>˷<EFBFBD>֯' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_CR ');
|
||
sql.Add(' set BBMoney='+mvalue);
|
||
SQL.Add(',Editer='''+Trim(DName)+'''');
|
||
SQL.Add(',Edittime=getdate() ');
|
||
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
||
|
||
SQL.Add('Update YF_Money_KC Set KCBBMoney=KCBBMoney+'+FKCBB+'-'+mvalue);
|
||
sql.Add(' where CRID='''+Trim(CDS_HZ.fieldbyname('CRID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
try
|
||
geteditRzhi();
|
||
with ADOqueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('delete from YF_Money_LL where fromMainID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+''' ');
|
||
execsql;
|
||
end;
|
||
IF (CDS_HZ.FieldByName('BBMoney').AsFloat<>0) and
|
||
(trim(CDS_HZ.fieldbyname('bankNo').AsString)<>'') then
|
||
begin
|
||
IF not saveZL() then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD>ˮ<EFBFBD><CBAE>Ϣʧ<CFA2><CAA7>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
end;
|
||
end;
|
||
except
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmSKCR.OrderNoChange(Sender: TObject);
|
||
begin
|
||
if Length(Trim(OrderNo.Text))<3 then Exit;
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmSKCR.v2Column1PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue,FFieldName:String;
|
||
begin
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value:=Trim(mvalue);
|
||
Post;
|
||
end;
|
||
{ with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_CR ');
|
||
sql.Add(' Set '+FFieldName+'='''+Trim(mvalue)+'''');
|
||
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
||
ExecSQL;
|
||
end; }
|
||
end;
|
||
procedure TfrmSKCR.v2DerateMoneyPropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
mvalue:string;
|
||
begin
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
|
||
if Trim(mvalue)='' then mvalue:='0';
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('DerateMoney').Value:=StrToFloatdef(mvalue,0);
|
||
Post;
|
||
end;
|
||
{ IF trim(fSYRName)<>'<27><><EFBFBD>˷<EFBFBD>֯' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_CR ');
|
||
sql.Add(' set DerateMoney='+mvalue);
|
||
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmSKCR.v2SYRNamePropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='SYRName';
|
||
flagname:='<27><>˾̧ͷ';
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('SYRName').Value:=Trim(ClientDataSet1.fieldbyname('zdyName').AsString);
|
||
end;
|
||
{ with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_CR ');
|
||
sql.Add(' Set SYRName='''+Trim(CDS_HZ.fieldbyname('SYRName').AsString)+'''');
|
||
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
||
ExecSQL;
|
||
end; }
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSKCR.TsaveClick(Sender: TObject);
|
||
begin
|
||
IF CDS_HZ.IsEmpty then exit;
|
||
begdate.SetFocus;
|
||
if CDS_HZ.Locate('ssel',true,[])=false then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with CDS_HZ do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
IF Fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
{ IF trim(fieldbyName('bankNo').AsString)='' then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox('<27>տ<EFBFBD><D5BF>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
|
||
exit;
|
||
end; }
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_CR SET ');
|
||
sql.Add(' Money='''+floattostr(CDS_HZ.fieldbyname('Money').AsFloat)+''' ');
|
||
sql.Add(',BBMoney='''+floattostr(CDS_HZ.fieldbyname('BBMoney').AsFloat)+''' ');
|
||
sql.Add(',DerateMoney='''+floattostr(CDS_HZ.fieldbyname('DerateMoney').AsFloat)+''' ');
|
||
sql.Add(',bankNo='''+trim(CDS_HZ.fieldbyname('bankNo').AsString)+''' ');
|
||
sql.Add(',CRTime='''+formatdateTIme('yyyy-MM-dd',CDS_HZ.fieldbyname('CRTime').AsDateTime)+''' ');
|
||
sql.Add(',Note='''+trim(CDS_HZ.fieldbyname('Note').AsString)+''' ');
|
||
sql.Add(',huilv='''+floattostr(CDS_HZ.fieldbyname('huilv').AsFloat)+''' ');
|
||
sql.Add(',YFName='''+trim(CDS_HZ.fieldbyname('YFName').AsString)+''' ');
|
||
sql.Add(',BZType='''+trim(CDS_HZ.fieldbyname('BZType').AsString)+''' ');
|
||
sql.Add(',fstr1='''+trim(CDS_HZ.fieldbyname('fstr1').AsString)+''' ');
|
||
sql.Add(',SYRName='''+trim(CDS_HZ.fieldbyname('SYRName').AsString)+''' ');
|
||
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
||
// ShowMessage(sql.text);
|
||
execsql;
|
||
end;
|
||
try
|
||
geteditRzhi();
|
||
IF trim(fieldbyName('bankNo').AsString)<>'' then
|
||
begin
|
||
with ADOqueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('delete from YF_Money_LL where fromMainID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+''' ');
|
||
execsql;
|
||
end;
|
||
IF (CDS_HZ.FieldByName('BBMoney').AsFloat<>0) and
|
||
(trim(CDS_HZ.fieldbyname('bankNo').AsString)<>'') then
|
||
begin
|
||
IF not saveZL() then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD>ˮ<EFBFBD><CBAE>Ϣʧ<CFA2><CAA7>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
end;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with ADOqueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('delete from YF_Money_LL where fromMainID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+''' ');
|
||
// ShowMessage(sql.text);
|
||
execsql;
|
||
end;
|
||
end;
|
||
except
|
||
end;
|
||
end;
|
||
next;
|
||
end;
|
||
First;
|
||
EnableControls;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
//InitGrid();
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSKCR.Panel2DblClick(Sender: TObject);
|
||
begin
|
||
Panel2.Visible:=false;
|
||
end;
|
||
|
||
procedure TfrmSKCR.JZdateChange(Sender: TObject);
|
||
begin
|
||
jsYe();
|
||
end;
|
||
|
||
procedure TfrmSKCR.v2Column4PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:=trim(fsyrName)+'XJLLFLAG';
|
||
flagname:='<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('bankNo').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
{ with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_CR ');
|
||
sql.Add(' Set bankNo='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
||
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
||
ExecSQL;
|
||
end; }
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
tv2.Controller.EditingController.ShowEdit();
|
||
|
||
{ try
|
||
geteditRzhi();
|
||
with ADOqueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('delete from YF_Money_LL where fromMainID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+''' ');
|
||
execsql;
|
||
end;
|
||
IF (CDS_HZ.FieldByName('BBMoney').AsFloat<>0) and
|
||
(trim(CDS_HZ.fieldbyname('bankNo').AsString)<>'') then
|
||
begin
|
||
IF not saveZL() then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD>ˮ<EFBFBD><CBAE>Ϣʧ<CFA2><CAA7>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
end;
|
||
end;
|
||
except
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmSKCR.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
frmSysLogHelp:=TfrmSysLogHelp.create(self);
|
||
with frmSysLogHelp do
|
||
begin
|
||
facction:='<27>տ<EFBFBD><D5BF>Ǽ<EFBFBD><C7BC><EFBFBD>';
|
||
showmodal;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSKCR.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
IF CDS_HZ.IsEmpty then exit;
|
||
with CDS_HZ do
|
||
begin
|
||
DisableControls;
|
||
first;
|
||
while not eof do
|
||
begin
|
||
edit;
|
||
fieldbyname('ssel').Value:=checkbox1.Checked;
|
||
post;
|
||
next;
|
||
end;
|
||
First;
|
||
EnableControls;
|
||
end;
|
||
end;
|
||
|
||
end.
|