1106 lines
31 KiB
ObjectPascal
1106 lines
31 KiB
ObjectPascal
|
|
unit U_SKCR_YF;
|
|||
|
|
|
|||
|
|
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, cxPC, RM_e_Xls, cxCurrencyEdit;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmSKCR_YF = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
YWY: TEdit;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
RMDB_PB: TRMDBDataSet;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
CustomerNoName: TEdit;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
begdate: TDateTimePicker;
|
|||
|
|
Enddate: TDateTimePicker;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
DS_HZ: TDataSource;
|
|||
|
|
CDS_HZ: TClientDataSet;
|
|||
|
|
TCK: TToolButton;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
ConNo: TEdit;
|
|||
|
|
TPrint: TToolButton;
|
|||
|
|
Order_PB: TClientDataSet;
|
|||
|
|
Order_FYZC: TClientDataSet;
|
|||
|
|
Order_RF: TClientDataSet;
|
|||
|
|
Order_XS: TClientDataSet;
|
|||
|
|
Order_SK: TClientDataSet;
|
|||
|
|
RMDB_FYZC: TRMDBDataSet;
|
|||
|
|
RMD_RF: TRMDBDataSet;
|
|||
|
|
RMDB_XS: TRMDBDataSet;
|
|||
|
|
RMDB_SK: TRMDBDataSet;
|
|||
|
|
ADOQuery1: TADOQuery;
|
|||
|
|
RMXLSExport1: TRMXLSExport;
|
|||
|
|
ADOQuery2: TADOQuery;
|
|||
|
|
ADOQuery3: TADOQuery;
|
|||
|
|
ADOQuery4: TADOQuery;
|
|||
|
|
ADOQuery5: TADOQuery;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
THTCX: TToolButton;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
OrderNo: TEdit;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
Tv2: TcxGridDBTableView;
|
|||
|
|
V1OrdDate: TcxGridDBColumn;
|
|||
|
|
v2ConNo: TcxGridDBColumn;
|
|||
|
|
v2OrderNo: TcxGridDBColumn;
|
|||
|
|
v2MPRTCodeName: TcxGridDBColumn;
|
|||
|
|
v2YWY: TcxGridDBColumn;
|
|||
|
|
v2CustomerNoName: TcxGridDBColumn;
|
|||
|
|
v2CJJGBiLV: TcxGridDBColumn;
|
|||
|
|
v2JFJGMoney: TcxGridDBColumn;
|
|||
|
|
v2Qty: TcxGridDBColumn;
|
|||
|
|
v2QTYUnit: TcxGridDBColumn;
|
|||
|
|
v2YSZMoney: TcxGridDBColumn;
|
|||
|
|
v2FLMoney: TcxGridDBColumn;
|
|||
|
|
v2TSMoney: TcxGridDBColumn;
|
|||
|
|
v2SKMoney: TcxGridDBColumn;
|
|||
|
|
v2ZFMoney: TcxGridDBColumn;
|
|||
|
|
v2PBMoney: TcxGridDBColumn;
|
|||
|
|
v2JGMoney: TcxGridDBColumn;
|
|||
|
|
v2MLMoney: TcxGridDBColumn;
|
|||
|
|
v2YGMoney: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
Order_FL: TClientDataSet;
|
|||
|
|
RMD_FL: TRMDBDataSet;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure CustomerNoNameChange(Sender: TObject);
|
|||
|
|
procedure Button2Click(Sender: TObject);
|
|||
|
|
procedure cxGridDBColumn8PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure cxGridDBColumn5PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure cxGridDBColumn1PropertiesEditValueChanged(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 ConNoChange(Sender: TObject);
|
|||
|
|
procedure v2Column1PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure v2DerateMoneyPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure v2ComTaitouPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure TCKClick(Sender: TObject);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure ConNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure TPrintClick(Sender: TObject);
|
|||
|
|
procedure THTCXClick(Sender: TObject);
|
|||
|
|
procedure v2CJJGBiLVPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
|
|||
|
|
procedure InitGridHZ();
|
|||
|
|
procedure InitGrid();
|
|||
|
|
function SaveData(): Boolean;
|
|||
|
|
procedure SetStatus();
|
|||
|
|
public
|
|||
|
|
fflag: integer;
|
|||
|
|
{ Public declarations }
|
|||
|
|
RKFlag, FCYID, fmanage: string;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmSKCR_YF: TfrmSKCR_YF;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_Fun, U_ZDYHelp, U_ProductOrderList, U_ProductOrderNewList,
|
|||
|
|
U_ZdyAttachment, U_ProductOrderListSel, U_JYOrderYS, U_JYOrderCon_CX;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.SetStatus();
|
|||
|
|
var
|
|||
|
|
i: integer;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.InitGrid();
|
|||
|
|
var
|
|||
|
|
ZDY: string;
|
|||
|
|
begin
|
|||
|
|
ZDY := ' and OrdDate>=''' + Trim(FormatDateTime('yyyy-MM-dd', begdate.DateTime)) + '''' + ' and OrdDate<''' + Trim(FormatDateTime('yyyy-MM-dd', Enddate.DateTime + 1)) + ''' ';
|
|||
|
|
|
|||
|
|
case cxTabControl1.TabIndex of
|
|||
|
|
0:
|
|||
|
|
begin
|
|||
|
|
ZDY := ZDY + ' and isnull(WCStatus,'''')='''''
|
|||
|
|
end;
|
|||
|
|
1:
|
|||
|
|
begin
|
|||
|
|
ZDY := ZDY + ' and isnull(WCStatus,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'''
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('exec P_YFFK_HZCX :ZDY');
|
|||
|
|
Parameters.ParamByName('ZDY').Value := ZDY;
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain, CDS_HZ);
|
|||
|
|
SInitCDSData20(ADOQueryMain, CDS_HZ);
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.InitGridHZ();
|
|||
|
|
begin
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmSKCR_YF := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid('<27><><EFBFBD><EFBFBD>ë<EFBFBD><C3AB>', 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_YF.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ReadCxGrid('<27><><EFBFBD><EFBFBD>ë<EFBFBD><C3AB>', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
Enddate.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
|
begdate.DateTime := SGetServerDate(ADOQueryTemp) - 15;
|
|||
|
|
//SetStatus();
|
|||
|
|
//InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
CustomerNoName.SetFocus;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.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_YF.CustomerNoNameChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolButton2.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.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_YF.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) + ''' ');
|
|||
|
|
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>';
|
|||
|
|
// FieldByName('YFDefFlag1').Value:=fFlag;
|
|||
|
|
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('YFDefFlag1').Value := fFlag;
|
|||
|
|
FieldByName('status').Value := 0;
|
|||
|
|
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_YF.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_YF.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;
|
|||
|
|
tv2.Controller.EditingController.ShowEdit();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.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;
|
|||
|
|
tv2.Controller.EditingController.ShowEdit();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.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_YF.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_YF.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_YF.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
SelExportData(Tv2, ADOQueryMain, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.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;
|
|||
|
|
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;
|
|||
|
|
tv2.Controller.EditingController.ShowEdit();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.v2Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmProductOrderListSel := TfrmProductOrderListSel.Create(Application);
|
|||
|
|
with frmProductOrderListSel do
|
|||
|
|
begin
|
|||
|
|
FFInt := 1;
|
|||
|
|
//frmProductOrderList.v1Column4.Visible:=True;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('MainId').Value := Trim(frmProductOrderListSel.Order_Main.fieldbyname('MainId').AsString);
|
|||
|
|
FieldByName('OrderNo').Value := Trim(frmProductOrderListSel.Order_Main.fieldbyname('OrderNo').AsString);
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate YF_Money_CR ');
|
|||
|
|
sql.Add(' Set MainId=''' + Trim(frmProductOrderListSel.Order_Main.fieldbyname('MainId').AsString) + '''');
|
|||
|
|
sql.Add(' ,OrderNo=''' + Trim(frmProductOrderListSel.Order_Main.fieldbyname('OrderNo').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
|
|||
|
|
frmProductOrderListSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.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;
|
|||
|
|
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;
|
|||
|
|
tv2.Controller.EditingController.ShowEdit();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.ConNoChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolButton2.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.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;
|
|||
|
|
tv2.Controller.EditingController.ShowEdit();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.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;
|
|||
|
|
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;
|
|||
|
|
tv2.Controller.EditingController.ShowEdit();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SetStatus();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.v2ComTaitouPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'ComTaiTou';
|
|||
|
|
flagname := '<27><>˾̧ͷ';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('ComTaiTou').Value := Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate YF_Money_CR ');
|
|||
|
|
sql.Add(' Set ComTaiTou=''' + 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_YF.TCKClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
FrmJYOrderYS := TFrmJYOrderYS.create(self);
|
|||
|
|
with FrmJYOrderYS do
|
|||
|
|
begin
|
|||
|
|
FConnO := trim(CDS_HZ.fieldbyname('ConNO').AsString);
|
|||
|
|
FYWY := trim(CDS_HZ.fieldbyname('ConPerson1').AsString);
|
|||
|
|
FKHName := trim(CDS_HZ.fieldbyname('CustomerNoName').AsString);
|
|||
|
|
FMaoLMoney := trim(CDS_HZ.fieldbyname('MLMoney').AsString);
|
|||
|
|
FYGMoney := trim(CDS_HZ.fieldbyname('YGMoney').AsString);
|
|||
|
|
FMainid := trim(CDS_HZ.fieldbyname('Mainid').AsString);
|
|||
|
|
FJFJGMoney := trim(CDS_HZ.fieldbyname('JFJGMoney').AsString);
|
|||
|
|
if showmodal = 1 then
|
|||
|
|
begin
|
|||
|
|
initgrid();
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
cxGrid2.Align := alClient;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.ConNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
var
|
|||
|
|
ZDY: string;
|
|||
|
|
begin
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
ZDY := ' and ConNO like ''' + '%' + trim(ConNO.Text) + '%' + ''' ';
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('exec P_YFFK_HZCX :ZDY');
|
|||
|
|
Parameters.ParamByName('ZDY').Value := ZDY;
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain, CDS_HZ);
|
|||
|
|
SInitCDSData20(ADOQueryMain, CDS_HZ);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.TPrintClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile: string;
|
|||
|
|
FPBPS, FPBQty, FPBMoney: double;
|
|||
|
|
FRFPS, FRFQty, FRFMoney: double;
|
|||
|
|
FRFHXPS, FRFHXQty, FRFHXMoney: double;
|
|||
|
|
FPS, FQty, FRMBMoney, FUSDMoney: double;
|
|||
|
|
FSKRMBMoney, FSKUSDMoney: double;
|
|||
|
|
FFLMoney, FFLQty: double;
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
with Adoquery1 do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.clear;
|
|||
|
|
sql.add('exec P_LR_PB @Mainid=' + quotedstr(trim(CDS_HZ.fieldbyname('Mainid').AsString)));
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(Adoquery1, Order_PB);
|
|||
|
|
SInitCDSData20(Adoquery1, Order_PB);
|
|||
|
|
FPBPS := 0;
|
|||
|
|
FPBQty := 0;
|
|||
|
|
FPBMoney := 0;
|
|||
|
|
with Order_PB do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
// FPBPS := FPBPS + fieldbyname('TTPS').AsFloat;
|
|||
|
|
FPBQty := FPBQty + fieldbyname('TTQty').AsFloat;
|
|||
|
|
FPBMoney := FPBMoney + fieldbyname('PBMoney').AsFloat;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with Adoquery1 do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.clear;
|
|||
|
|
sql.add('exec P_LR_JG @Mainid=' + quotedstr(trim(CDS_HZ.fieldbyname('Mainid').AsString)));
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(Adoquery1, Order_RF);
|
|||
|
|
SInitCDSData20(Adoquery1, Order_RF);
|
|||
|
|
FRFPS := 0;
|
|||
|
|
FRFQty := 0;
|
|||
|
|
FRFMoney := 0;
|
|||
|
|
with Order_RF do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
FRFQty := FRFQty + fieldbyname('JGQty').AsFloat;
|
|||
|
|
FRFMoney := FRFMoney + fieldbyname('JGMoney').AsFloat;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with Adoquery1 do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.clear;
|
|||
|
|
sql.add('exec P_LR_YSK @Mainid=' + quotedstr(trim(CDS_HZ.fieldbyname('Mainid').AsString)));
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(Adoquery1, Order_XS);
|
|||
|
|
SInitCDSData20(Adoquery1, Order_XS);
|
|||
|
|
FPS := 0;
|
|||
|
|
FQty := 0;
|
|||
|
|
FRMBMoney := 0;
|
|||
|
|
FUSDMoney := 0;
|
|||
|
|
with Order_XS do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
FPS := FPS + fieldbyname('PS').asfloat;
|
|||
|
|
FQty := FQty + fieldbyname('Qty').asfloat;
|
|||
|
|
FRMBMoney := FRMBMoney + fieldbyname('RMBMoney').asfloat;
|
|||
|
|
// FUSDMoney := FUSDMoney + fieldbyname('USDMoney').asfloat;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
with AdoQuery1 do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.clear;
|
|||
|
|
sql.add('exec P_LR_SK @Mainid=' + quotedstr(trim(CDS_HZ.fieldbyname('Mainid').AsString)));
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(Adoquery1, Order_SK);
|
|||
|
|
SInitCDSData20(Adoquery1, Order_SK);
|
|||
|
|
FSKRMBMoney := 0;
|
|||
|
|
FSKUSDMoney := 0;
|
|||
|
|
with Order_SK do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
FSKRMBMoney := FSKRMBMoney + fieldbyname('RMBMoney').asfloat;
|
|||
|
|
FSKUSDMoney := FSKUSDMoney + fieldbyname('USDMoney').asfloat;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
with AdoQuery1 do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.clear;
|
|||
|
|
sql.add('exec P_LR_FYZC @Mainid=' + quotedstr(trim(CDS_HZ.fieldbyname('Mainid').AsString)));
|
|||
|
|
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(Adoquery1, Order_FYZC);
|
|||
|
|
SInitCDSData20(Adoquery1, Order_FYZC);
|
|||
|
|
|
|||
|
|
with AdoQuery1 do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.clear;
|
|||
|
|
sql.add('exec P_LR_FL @Mainid=' + quotedstr(trim(CDS_HZ.fieldbyname('Mainid').AsString)));
|
|||
|
|
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(Adoquery1, Order_FL);
|
|||
|
|
SInitCDSData20(Adoquery1, Order_FL);
|
|||
|
|
|
|||
|
|
FFLQty := 0;
|
|||
|
|
FFLMoney := 0;
|
|||
|
|
with Order_SK do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
FFLQty := FFLQty + fieldbyname('FLQty').asfloat;
|
|||
|
|
FFLMoney := FFLMoney + fieldbyname('FLMoney').asfloat;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.rmf';
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
RMVariables['FOrderNo'] := trim(CDS_HZ.fieldbyname('ORDERNO').asstring);
|
|||
|
|
RMVariables['FConPerson1'] := trim(CDS_HZ.fieldbyname('YWY').asstring);
|
|||
|
|
RMVariables['FCustomerNoName'] := trim(CDS_HZ.fieldbyname('CustomerNoName').asstring);
|
|||
|
|
RMVariables['MLMoney'] := CDS_HZ.fieldbyname('MLMoney').AsFloat;
|
|||
|
|
RMVariables['YGMoney'] := CDS_HZ.fieldbyname('YGMoney').AsFloat;
|
|||
|
|
RMVariables['FPBPS'] := FPBPS;
|
|||
|
|
RMVariables['FPBQty'] := FPBQty;
|
|||
|
|
RMVariables['FPBMoney'] := FPBMoney;
|
|||
|
|
RMVariables['FRFPS'] := FRFPS;
|
|||
|
|
RMVariables['FRFQty'] := FRFQty;
|
|||
|
|
RMVariables['FRFMoney'] := FRFMoney;
|
|||
|
|
RMVariables['FPS'] := FPS;
|
|||
|
|
RMVariables['FQty'] := FQty;
|
|||
|
|
RMVariables['FRMBMoney'] := FRMBMoney;
|
|||
|
|
RMVariables['FUSDMoney'] := FUSDMoney;
|
|||
|
|
RMVariables['FSKRMBMoney'] := FSKRMBMoney;
|
|||
|
|
RMVariables['FSKUSDMoney'] := FSKUSDMoney;
|
|||
|
|
RMVariables['FRFHXPS'] := FRFHXPS;
|
|||
|
|
RMVariables['FRFHXQty'] := FRFHXQty;
|
|||
|
|
RMVariables['FRFHXMoney'] := FRFHXMoney;
|
|||
|
|
RMVariables['FFLQty'] := FFLQty;
|
|||
|
|
RMVariables['FFLMoney'] := FFLMoney;
|
|||
|
|
|
|||
|
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
RM1.ShowReport;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.rmf'), '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.THTCXClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
frmJYorderConCX := TfrmJYorderConCX.create(self);
|
|||
|
|
with frmJYorderConCX do
|
|||
|
|
begin
|
|||
|
|
formid := '3';
|
|||
|
|
FConNO := trim(CDS_HZ.fieldbyname('ConNO').AsString);
|
|||
|
|
if showmodal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_YF.v2CJJGBiLVPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue, FFieldName, FJGNote, FMainID, FSubID, FFactId, FSJGFactory: string;
|
|||
|
|
FJGPrice: double;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
|
FFieldName := Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
|
Post;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update JYOrder_Main set CJJGBiLV =' + mvalue);
|
|||
|
|
sql.Add(' where Mainid=' + quotedstr(trim(CDS_HZ.FieldByName('Mainid').Asstring)));
|
|||
|
|
// showmessage(sql.Text);
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
tv2.Controller.EditingController.ShowEdit();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|